Computer Science CCIS 301
Virtual memory management approaches
Time-sharing –this approach allows many users to share the resources of the virtual memory simultaneously with small amount of time known as slice or quantum allocated to them.
Paging -Here the virtual memory spaces of given processes are divided into fixed-sized pages, the virtual memory addresses are made up of page offsets and page numbers.
continued
Segmentation - A virtual technique memory used in virtual memory to create variable-sized memory address spaces in a computer storage for related data, segmentation speeds us retrieval.
Static-relocation - This is the process of assigning load address for position-dependent code and data of a program and adjusting the code and data to reflect the assigned address.
Base and bound - Refers to a simple form of virtual memory where access to a computer is controlled by one or a small number of set of processor register referred to as base and bound registers.
Each access is assigned to a single contiguous segment of main memory
Least Recently used pseudo-code
Pseudo-code for Least Recently Used
LRU (Page pg)
If pg is present in buffer then LAST (pg)=Current time;
Else
i)Min=current time+1;
ii) for all pages in Queue(Qu) in the buffer do
If(LAST(Qu)<Min)
Victim=Qu;
Min =LAST(Qu)
iii) if victim is dirtly then flush back to the disk.
iv)take or fetch Pg to the buffer frame held by the victim.
v)LAST(Pg)=current time .
First in first out pseudo-code
first in first out paging pseudo-code
Data : pages Pg, number of pages M, Capacity Y
Results: Number of pages fault Fp
Function find faultPage(Pg, M, Y)
S=set();
QueuePage=Queue();
Fp=0;
For d =0 to length(M) do
If Pg[d] not in S then S.add(Pg[d]);
Fp=Fp+1;
QueuePage.get();
S.remove(Val);
QueuePage.Put(Pg[d]);
Fp=Fp+1;
End
End
End
Return Fp