Presentation is loading. Please wait.

Presentation is loading. Please wait.

Case Study: Virtual Memory in UNIX Reference – Maurice J.Bach, The Design of the UNIX Operating System Terminology - Physical Memory (Main Memory) Secondary.

Similar presentations


Presentation on theme: "Case Study: Virtual Memory in UNIX Reference – Maurice J.Bach, The Design of the UNIX Operating System Terminology - Physical Memory (Main Memory) Secondary."— Presentation transcript:

1 Case Study: Virtual Memory in UNIX Reference – Maurice J.Bach, The Design of the UNIX Operating System Terminology - Physical Memory (Main Memory) Secondary Memory (H.Disk) Virtual Memory Swap File

2 Region Virtual space of a process Stack, Data, Text – are regions of every process

3 Per Process Region Table - pregion For every region – Starting virtual address Number of pages in this region Access mode Pointer to the Page Table (page table for every region)

4 Page Table

5 Page Table Entry Demand paging fields Valid Reference Modify Copy on Write (COW) Age Modify, Reference -handle by the hardware

6 More tables Page frame data table (pfdata) One table Mapping all physical frames to disk Tells how many process are using this frame List of free frames Hash from disk address to frame Swap-use For every swap device Tells how many frames points to the same disk address

7 Using the Copy on Write in fork()

8

9 Kernel process for Virtual Memory Pager Every time the OS needs to swap a virtual page to the physical memory Get the first frame from the list of free pages, if the Modify bit is set write it’s data to the disk. Load the page to this frame Set the valid bit Resume the waiting process Page Stealer (page daemon) Every period of time Enter old frames to the list of free pages Update the age of every valid frame if the reference bit is 0 Put 0 in the the reference bit => LRU with second chance

10 Page Fault Some of the possibilities : 1. The page is in the swap file 2. The page is in the list of free pages FrameDisk Block Count 10363870 164816181 186112060 Virt AddrPhysState Block 0K 1K1648invFile3 4KNoneinvFile5 64K1917invdisk1206 65K 66K1036invdisk847 67K Virt AddrPhysState Block 66K1776valdisk847 PageDisk Block Count 17768471 After Swapping Page into Memory Page Table Entries Disk Block Page Frames

11 Event - Page Daemon done Event – Proc A reads from Pg2 Event – Proc A call to fork()

12 Event – Proc A reads from Pg1 Event – Proc B write to Pg6 Event – Page Daemon done

13 Event – Proc B reads from Pg2 & Pg5 Event – Page Daemon done Event – Proc A ends


Download ppt "Case Study: Virtual Memory in UNIX Reference – Maurice J.Bach, The Design of the UNIX Operating System Terminology - Physical Memory (Main Memory) Secondary."

Similar presentations


Ads by Google