
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















No illusion of virtual memory
Provides the illusion of virtual memory
A virtual address is represented as
where the page is determined by dividing each process into fixed size pages, the offset is a number in the range 0 - (page_size-1).
Memory is divided into fixed size blocks (or page frames ) and accommodates a process’ pages. The physical address (PA) then is (block_number * page_size + offset).
In pure paging systems the entire VA space of a process must reside in physical memory during execution, but pages are not kept in contiguous blocks.
*+
Compiled Address PA
Address Translator: Determines VA Maps VA to PA (Hardware + OS)
Memory
Assume 256 bytes per page: page number offset
8 bits
*+
8 9
Job 1
Job 2
Job 3
PMT's
0 1 2 3 4 5 6
Page Block
Maps each block of main memory either to a process id and page number or to "free"
Memory Block Table (MBT)
1 MBT / System 1 Entry / Block
Process (Job) Control Block (PCB)
Contains information about all jobs in the system
Stores: Job Size Location of PMT
1 PCB / system 1 entry / job
:; ) 8 :
Main Memory
block #s
1 < 6="">
"
3 !5& ??@
#& *3? 5 0
& 21!3 6 # =""2= 1 3 6 #
") 1-A
C"
Advantages:
C"
Disadvantages:
1
Jobs are paged, but not all pages have to be in memory at the same time VIRTUAL MEMORY The operating system creates the illusion of more memory Job size can exceed main memory size
Pages are only brought in when referenced (on demand ) Often page 0 is loaded initially when a job is scheduled
D '=
0! E " 0 4 4 F ; .4 4 A FA ; . F-.4 4
. AG0 " A
1
0E & -E + C
0E & H0C /0 )"0 0
G0;
."1E
'.CG 0
C
1
1 1
1. What happens if job 3 references page 1?
Referenced Changed
Job 1
Job 2
Job 3
Page Block In_Mem Disk Yes^ Dsk Addr Dsk Addr Dsk Addr Dsk Addr Dsk Addr
Dsk Addr Dsk Addr Dsk Addr
Yes Yes Yes Yes
Yes No No
;8 9 "
Question: Does a program need all its pages in main memory at all times?
. ":
Sequential code, Array processing, Code within a loop
Loop indices, Single data elements
:
Does a linked list help or hurt locality?
DE . 3 '#J:J 5
A process’ working set is the number of pages currently
being referenced during ( t , t+∆ ) for some small ∆.
The working set size is an estimate of degree of locality
A job should not be scheduled unless there is room for its entire working set
) &
fault (^) OPT replaces 5
= )
Page Trace: 0 1 2
Block Number
Page Fault Rate =
) &
Replace the "oldest" page
A frequently used page may be swapped out
Belady's Anomaly:
For some page replacement algorithms, the page fault rate may increase as the number of blocks increase
'+'= )
Page Trace: 0 1 2
Block Number
0 1 2 3
Page Trace:
Block Number