Involve swapping block of data from secondmemory Memory needs to be allocated to ensure a reasonablesupply of ready processes to consume availableprocessor time Memory management requirements: Relocation Protection Sharing Logical organisation Physical organisationMemory management
Paging is a partition memory into small equal fixed-size chunks and divide each process into the samesize chunks Pages-The chunks of a process Frame or pages frame-The chunks of a memory Page table: Contains the frame location for each page in theprocess Memory address consist of a page number and offsetwithin the pagePAGING
Process Pages tofree frames Some of the frames in memory are use and some are free. A list of frames is maintained by the OS. Process A stored on disk and it consist of four pages. OS will find the four free frames and loads thefour pages of process A into four frames.
… Process B consisting of three pages and Process C consisting of fourpages are subsequently loaded. Process B is suspended and swapped out to main memory. All the process in main memory will blocked OS need to bring a new process, which is process D that contain fivepages.
The five pages of process D are loaded into frames5,6,11, and 12.
A pages tables contain one entry for each pages of the process. The table easily indexed by the pages number (starting at 0) Each pages table entry contains the number of the frame inmain memory that hold the corresponding page. A free frame list, available for pages, is maintained Thus we will se the simple paging is similar to fixed partioning.
manages the main memory by dividing the memory intoregions/fixed/variable size is called partitioning Two types of partitions1. Static PartitionWhole memory is divided into fixed sized frame2. Dynamic PartitionMemory is divided into variable sized frame according topage sizePartitioning
Partitioning example :P1P2P4P3P3P1P4P3P2StaticPartitionDynamicPartition01032251504249342010516670 7028ProcessSpaceP1 10P2 10P3 14P4 15Total space forthose of partition
pAGINGCPUp d f dPhysicalmemoryfpLogicaladdressPhysicaladdressPage table Visual address of a process divided into1. page number (p) – index to page table2. page offset (d) – offset into page/frame
Paging hardware Address space 2m Page offset 2n Page number 2m-np dPagenumberPageoffsetm-n nNote :Not losing anyspace !Step : address translation1. Extract the page number as the n nits of the logical address2. Use the page number as an index into process page table tofind the frame number, k3. The starting physical address of the frame is k * 2m , thephysical address of the referenced bytes is that number plusoffset.Physicalmemory2m bytes
SegmentationStep : Address translation from virtual to physicaladdress1. Extract the segment number as the n bits of thelogical address2. Use the segment number as an index into theprocess segment table to find the starting physicaladdress of the segment3. Compare the offset, expressed in the m bits, to thelength of the segment. If offset is “>=“ to thelength, the address is invalid.4. The desired physical address is the sum of thestarting physical address of the segment plusoffset.
SegmentationCPU s d< +limit basesPhysical memorySegmenttableyesTrap, addressing errorPhysicaladdressnoLogicaladdressmainstack