Please enable JavaScript.
Coggle requires JavaScript to display documents.
:minidisc: VIRTUAL MEMORY, A technique that allows the execution of…
:minidisc:
VIRTUAL MEMORY
Advantage
Program can be larger than physical memory
Virtual memory abstracts main memory into an extremely large, uniform array of storage
Separating logical memory as viewed by the programmer from physical memory
Allow process to share files and libraries
Provide efficient mechanism for process creation
Virtual memory
involves the separation of logical memory as perceived by developers from physical memory
Virtual address
of a process refers to the logical (or virtual) view of how a process is stored in memory
Virtual Address Space
: The large hole between stack and heap is part of the virtual address space, but will require actual physical pages only if the heap or stack grows
PAGE SHARING BENEFITS
System libraries such as the standard C library can be shared
Process can share mmory
Pages can be shared during process creation with the fork() system call
DEMAND PAGING
Load pages only as they are needed
Commonly used in virtual memory
Pages are loaded only when they are demanded during program execution
Never accessed are thus never loaded into physical memory
Similar to aging system with swapping
Some pages will be in memory, and some is in secondary storage
How to avoid this?
Use valid-invalid bit scheme
Access to a page marked invalid causes a
page fault
PAGE REPLACEMENT
Page replacement algorithms are the techniques using which an OS decides which memory pages to swap out, write to disk when a page of memory needs to be allocated
If we increase our degree of multiprogramming, we are over-allocating memory
i - invalid
(Page fault occur)
Page replacement is basic to demand paging
It completes the separation between logical memory and physical memory
Ways to solve major problems to implement demand paging
Frame-allocation algorithm
Page-replacement algorithm
How do we select a particular replacement algorithm?
Evaluate an algorithm by running it on a particular string of memory reference (reference string)
Computing the number of page faults
FIFO Algorithm
Optimal Algorithm
Least Recently Used (LRU) Algorithm
ALLOCATION OF FRAMES
Minimum number of frames per process is defined by the architecture
Maximum number is defined by the amount of variable physical memory
If the number of frames allocated to each process decreases
The page fault rate increase
Resulting in slow execution
TRASHING
If a process does not have "enough" pages, the page fault rate is very high
Trashing results in severe performance problems
A process is trashing it if is spending more time paging than executing
Trashing leads to
Low CPU utilization
Operating system thinking that it needs to increase the degree of multiprogramming
Another process added to the system
A technique that allows the execution of processes that are not completely in memory