If you can't read please download the document
Upload
federal-urdu-university
View
3.432
Download
2
Embed Size (px)
Citation preview
Class : BsCS 4th -B
Subject : Operating System
Muhammad Shakeeb ( IS/17122-Aut -FO7 M )Syed Zeeshan Nasir ( IS/17133-Aut F 07 M )Faisal Muhammad ( IS/17122-Aut F07 M)Group Members :
Unix Memory Management
1
Handling Memory
2
Process A's virtual address space Physical memory Process B's virtual address space
3
Memory ManagementThe initial memory management schemes were constrained in size by the relatively small memory resources of UNIX was developed on the PDP machines Pre 3BSD system use swapping exclusively to handle memory contention among processes If there is too much contention, processes are swapped out until enough memory is availableAllocation of both main memory and swap space is done first-fit
4
Paging Berkeley UNIX systems depend primarily on paging for memory-contention management, and depend only secondarily on swapping Demand paging When a process needs a page and the page is not there, a page fault tot he kernel occurs, a frame of main memory is allocated, and the proper disk page is read into the frame A page daemon process uses a modified second-chance page-replacement algorithm to keep enough free frames to support the executing processes If the scheduler decides that the paging system is overloaded, processes will be swapped out whole until the overload is relieved
5
PagingPage table entry
Disk block descriptors
Page frame data table
Swap use table
6
Page Table Entry and Disk Block Descriptor
Disk Block DescriptorPage Table Entry
RegionPage Table EntryPage Table Disk Block DescriptorSwap Device Block NumberType
Page AddressAgeCp/WrtModRefValProt
Contains the physical address of page and the following bits:Valid: whether the page content legalReference: whether the page is referenced recentlyModify: whether the page content is modifiedcopy on write: kernel must create a new copy when a process modifies its content (required for fork)Age: Age of the pageProtection: Read/ write permissionPage Table Entry
Disk Block DescriptorSwap Device number as there may be several swap devicesBlock number that contains pageSwap Device Block NumberType
Page Frame Data Table EntryPage StateReference countLogical DeviceBlock NumberPfdata Pointer
Reference CountPage/Storage Unit Number
Swap use Table entry
10
11 Page Frame Data Table EntryPage State : Indicate whether this frame is available or has an associated age. In the latter case, the status of the page is specified on swap device, in executable fill, or DMA in progress.Reference count: Number of process that referncesthe page.Block Number: Bock location of the page copy on the logical devices. Logical Devices: Logical devices that contains a copy of the page.
Swap use table EntryReferences count: Number of page table entries that point to page on the swap device.Page/storage unit number: Page identifier on storage unit.
Replacement policy
12