Presentation is loading. Please wait.

Presentation is loading. Please wait.

Virtual Memory Management

Similar presentations


Presentation on theme: "Virtual Memory Management"— Presentation transcript:

1 Virtual Memory Management
Group members- Sadiya Naaz Vishakha Singh Mridula Choudhary Ritika Jain

2 Separation of logical memory as perceived by users from physical
Virtual Memory Separation of logical memory as perceived by users from physical memory.

3 Principles of Virtual Memory
Address mapping mechanisms: The address mapping mechanisms, address_map, translate logical addresses, generated by the processor, to physical addresses, presented to the actual memory. Placement Strategies:To access any portion of the virtual memory space, it must reside in main memory.

4 Replacement Strategies: Swapping out one of the current processes.
Load Control:Load different portions of virtual memory dynamically, i.e., at the time they are actually needed. Sharing:There are important reasons for allowing two or more processes to share the same portion (code or data) of main memory.

5 Components that use VM Network Stack Standard C Library
Virtual File System

6 Implementation of VM -Second chance replacement Algorithm -Implementation in Solaris -Implementation in Windows XP

7 Second chance page replacement
Inspection of reference bit. Pages with reference bit 0 are replaced. Pages with reference bit 1 are cleared to 0. Arrival time is set to current time.

8 Second chance replacement algorithm
Also known as CLOCK ALGORITHM. Based on the FIFO replacement algorithm. Circular queue used. A pointer (that is, a hand on the clock) indicates which page is to be replaced next. When a frame is needed, the pointer advances until it finds a page with a 0 reference bit. As it advances, it clears the reference bits . Once a victim page is found, the page is replaced, and the new page is inserted in the circular queue in that position.

9

10 In the worst case, when all bits are set, the pointer cycles through the whole queue, giving each page a second chance. It clears all the reference bits before selecting the next page for replacement. Second-chance replacement degenerates to FIFO replacement if all bits are set.

11 Implementation in Solaris
When a thread incurs a page fault, the kernel assigns a page to the faulting thread from the list of free frames it maintains. Kernel keep a sufficient amount of free memory available. Lotsfree—represents a threshold to begin paging. (1/64 the size of the physical memory).

12 Four times per second, the kernel checks whether the amount of free memory is less than lotsfree.
If the number of free frames falls below lotsfree, a process known as the pageout starts up. The pageout process is similar to the CLOCK algorithm. But it uses two pointers while scanning pages- FRONTHAND and BACKHAND.

13 The front hand of the clock scans all pages in memory, setting the reference bit to 0.
Later, the back hand of the clock examines the reference bit for the pages in memory. Pages whose bit is still set to 0 are added to the cache list and if modified,contents are written to disk.

14 Free list contains the list of frames
- unallocated. - acquired by the process which has been terminated. Cache list consists of a queue in FIFO manner -The LRU is at the head. -Then as we move down pages are added in increasing order of their time of access in main memory. -The most recently used page is at the tail. Pages can be reclaimed from the cache list if they are accessed.

15 Parameters : 1. Scanrate (pages per second) - Free memory falls below lotsfree -scanning occurs at slowscan and progresses to fastscan. Slowscan -100 pages per second. Fastscan - (total physical pages)/2 pages per second. (Typically 8192 pages per second) 2.Handspread (in pages) - Distance between the hands of the clock.

16 If free memory falls below desfree , pageout will run 100 times per second.
If the pageout process is unable to keep the amount of free memory at desfree for a 30-second average, the kernel begins swapping processes, thereby freeing all pages allocated to swapped processes. If free memory falls below minfree, the pageout process is called for every request for a new page.

17 Implementation in Windows XP
Uses demand paging with clustering. Each process is assigned a working set minimum and maximum on its creation. Virtual memory manager maintains a list of free page frames associated with a threshold value to indicate availability of free memory.

18 Strategies S. No. Memory State Process State Action 1. Available
Working set Minimum Allocate from free list Working set Maximum Replace page 2. Not Available ie. under threshold ------ Automatic working set trimming

19 Algorithms used Depends on the type of processor
On single processor 80x86 systems -Clock Algorithm Clearing the reference bit may require invalidating the entry in the translation look- aside buffer on other processors that incurrs overhead On Alpha and Multiprocessor x86 systems -FIFO Algorithm


Download ppt "Virtual Memory Management"

Similar presentations


Ads by Google