Professional Documents
Culture Documents
V.A.
CSED,TU
Disclaimer
VA.
CSED,TU
Introduction
Program must be brought into memory and placed within a process for it
to be run
VA.
CSED,TU
Multi-step Processing of User Program
VA.
CSED,TU
Compilation Pipeline
VA.
CSED,TU
Address Binding
VA.
CSED,TU
Logical/Physical Address
Logical and Physical Addresses are the same in compile-time and load-
time address-binding schemes.
VA.
CSED,TU
Base & Limit Register
VA.
CSED,TU
MMU
VA.
CSED,TU
H/W Protection
VA.
CSED,TU
Dynamic Loading & Linking
VA.
CSED,TU
Swapping
VA.
CSED,TU
Swapping (Conti)
VA.
CSED,TU
Contiguous Allocation
Multiple-partition allocation
VA.
CSED,TU
Memory Allocation (Graphical Depiction)
VA.
CSED,TU
Memory Allocation Strategies
Best-fit: Allocate the smallest hole that is big enough; must search
entire list, unless ordered by size
Worst-fit: Allocate the largest hole; must also search entire list
VA.
CSED,TU
Fragmentation
To run a program of size n pages, need to find n free frames and load
program
Internal Fragmentation
VA.
CSED,TU
Address Translation Scheme
VA.
CSED,TU
Paging Hardware
VA.
CSED,TU
Page Modeling of Logical & Physical Memory
VA.
CSED,TU
Paging Example
VA.
CSED,TU
VA.
CSED,TU
Implementation of Page Table
Page table is kept in main memory
The two memory access problem can be solved by the use of a special
fast-lookup hardware cache called Associative Memory or Translation
Look-aside Buffers (TLBs)
VA.
CSED,TU
Associative Memory
VA.
CSED,TU
Paging Hardware with TLB
VA.
CSED,TU
Valid Invalid Bit for Protection
invalid indicates that the page is not in the process logical address
space
VA.
CSED,TU
Valid Invalid Bit in Page Table
VA.
CSED,TU
Structure of PAGE TABLE
Hierarchical Paging
VA.
CSED,TU
Two Level Page Table Scheme
VA.
CSED,TU
Two Level Paging Example
A logical address (on 32-bit machine with 1K page size) is divided into:
Since the PAGE TABLE IS PAGED, the page number is further divided
into:
VA.
CSED,TU
Two Level Paging Example (contd.)
VA.
CSED,TU
Address Translation Scheme
VA.
CSED,TU
Three Level Paging Scheme
VA.
CSED,TU
Hashed Page Table
VA.
CSED,TU
Inverted Page Table
VA.
CSED,TU
Segmentation
Main Program
Procedure
Function
Method
Object
Local Variables, Global Variables
Common Block
Stack
Symbol Table
Arrays
VA.
CSED,TU
Users View of Program
VA.
CSED,TU
Logical View of Segmentation
VA.
CSED,TU
Segmentation Architecture
VA.
CSED,TU
Segmentation Hardware
VA.
CSED,TU
Example of Segmentation
VA.
CSED,TU
Transfer of a Paged Memory to Contiguous
Disk Space
VA.
CSED,TU
Page Table when some pages are not in
Memory
VA.
CSED,TU
Steps in Handling Page Fault
VA.
CSED,TU
What happens if there is no free frame?
Page replacement find some page in memory, but not really in use,
swap it out
Algorithm
VA.
CSED,TU
Performance of Demand Paging
if p = 0 no page faults
if p = 1, every reference is a fault
VA.
CSED,TU
Page Replacement
VA.
CSED,TU
Basic Page Replacement
3. Read the desired page into the (newly) free frame. Update the page
and frame tables.
VA.
CSED,TU
Page Replacement
VA.
CSED,TU
Page Fault versus No. of Frames
VA.
CSED,TU
FIFO First In First Out
VA.
CSED,TU
FIFO Page Replacement
VA.
CSED,TU
Optimal Algorithm
VA.
CSED,TU
Optimal Page Replacement
VA.
CSED,TU
Thrashing
If a Process does not have enough pages, the Page-fault rate is very
high. This leads to:
VA.
CSED,TU
Thrashing (contd.)
VA.
CSED,TU
Least Recent Used Algorithm
Reference String: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5
Counter Implementation
-- Every page entry has a counter; every time page is referenced through this
entry, copy the clock into the counter
-- When a page needs to be changed, look at the counters to determine which
are to change
VA.
CSED,TU
LRU Page Replacement
VA.
CSED,TU
LRU Algorithm (contd.)
Page referenced:
VA.
CSED,TU
Use of Stack to record the most recent Page
Reference
VA.
CSED,TU
LRU Approximation Algorithms
Reference bit
Second chance
VA.
CSED,TU
Second Chance (Clock) Page Replacement
Algorithm
VA.
CSED,TU
Counting Algorithms
Keep a counter of the number of references that have been made to each
page.
MFU Algorithm: Based on the argument that the page with the
smallest count was probably just brought in and has yet to be used
VA.
CSED,TU
Reference List
www.os-book.com
www.cs.jhu.edu/~yairamir/cs418/os2/sld001.htm
http://gaia.ecs.csus.edu/~zhangd/oscal/pscheduling.html
http://www.edugrid.ac.in/iiitmk/os/os_module03.htm
http://williamstallings.com/OS/Animations.html
etc
VA.
CSED,TU
Thnx
VA.
CSED,TU