Understanding Memory Management Techniques: Segmentation vs. Paging

Slide Note
Embed
Share

Memory management is crucial in computer systems to optimize performance and resource utilization. Segmentation and paging are two important techniques used for managing memory efficiently. Segmentation allows for the independent growth and shrinking of different memory tables, while paging provides a way to efficiently use physical memory by breaking data into fixed-size blocks. By comparing these techniques, we can better understand their advantages and limitations in modern computing environments.


Uploaded on Aug 08, 2024 | 2 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Segmentation Segmentation

  2. Problem! Problem! The virtual memory discussed so far is one-dimensional because the virtual addresses go from 0 to some maximum address, one address after another. For many problems, having two or more separate virtual address spaces may be much better than having only one. Ali Akbar Mohammadi 2

  3. Example: Compiler Example: Compiler Compiler has many tables that are built up as compilation proceeds, possibly including: 1. The source text being saved for the printed listing (on batch systems). 2. The symbol table, containing the names and attributes of variables. 3. The table containing all the integer and floating-point constants used. 4. The parse tree, containing the syntactic analysis of the program. 5. The stack used for procedure calls within the compiler. Ali Akbar Mohammadi 3

  4. In a One In a One- - Dimensional Dimensional Address Space Address Space with Growing with Growing Tables, One Table Tables, One Table may Bump into may Bump into Another. Another. Ali Akbar Mohammadi 4

  5. Solution: Segmentation Solution: Segmentation Each segment consists of a linear sequence of addresses, from 0 to some maximum. The length of each segment may be anything from 0 to the maximum allowed. Different segments may, and usually do, have different lengths. Moreover, segment lengths may change during execution. The length of a stack segment may be increased whenever something is pushed onto the stack and decreased whenever something is popped off the stack. Ali Akbar Mohammadi 5

  6. A Segmented Memory Allows Each Table to Grow A Segmented Memory Allows Each Table to Grow or Shrink Independently of the Other Tables. or Shrink Independently of the Other Tables. Ali Akbar Mohammadi 6

  7. Comparison of Paging and Segmentation Comparison of Paging and Segmentation Consideration Paging Segmentation Need the programmer be aware that this technique is being used? No Yes How many linear address spaces are there? 1 Many Can the total address space exceed the size of physical memory? Yes Yes Can procedures and data be distinguished and separately protected? No Yes Can tables whose size fluctuates be accommodated easily? No Yes Is sharing of procedures between users facilitated? No yes Why was this technique invented? To get a large linear address space without having to buy more physical Memory To allow programs and data to be broken up into logically independent address spaces and to aid sharing and Protection Ali Akbar Mohammadi 7

  8. Implementation of Pure Segmentation Implementation of Pure Segmentation The implementation of segmentation differs from paging in an essential way: pages are fixed size and segments are not. Ali Akbar Mohammadi 8

  9. (a) (a)- -(d) Development of (d) Development of checkerboarding (e) Removal of the (e) Removal of the checkerboarding checkerboarding by compaction. checkerboarding. . by compaction. Ali Akbar Mohammadi 9

  10. Checkerboarding Checkerboarding or External Fragmentation or External Fragmentation After the system has been running for a while, memory will be divided up into a number of chunks, some containing segments and some containing holes. This phenomenon, called checkerboarding or external fragmentation, wastes memory in the holes. Ali Akbar Mohammadi 10

  11. Linear Address Linear Address Assuming that the segment is in memory and the offset is in range, the Pentium then adds the 32-bit base field in the descriptor to the offset to form what is called a linear address. Ali Akbar Mohammadi 15

  12. Conversion of a (Selector, Offset) Pair to a Conversion of a (Selector, Offset) Pair to a Linear Address Linear Address Ali Akbar Mohammadi 16

  13. Page Directory Page Directory Each running program has a page directory consisting of 1024 32-bit entries. It is located at an address pointed to by a global register. Each entry in this directory points to a page table also containing 1024 32-bit entries. The page table entries point to page frames. Ali Akbar Mohammadi 17

  14. Mapping of a Linear Address Onto a Physical Mapping of a Linear Address Onto a Physical Address Address Ali Akbar Mohammadi 18

Related