Professional Documents
Culture Documents
Website :: www.dhindsa.info
http://groups.google.com/group/os-2007
E-Mail :: sys.operating@gmail.com
1
O.S. by Er. K.S.Dhindsa © 2007
Logical Vs Physical address space
LOGICAL ADDRESS –
An address generated by CPU
PHYSICAL ADDRESS –
An address as seen by the memory
unit (Loaded into MAR of the memory)
3
O.S. by Er. K.S.Dhindsa © 2007
Schematic View of Swapping
4
O.S. by Er. K.S.Dhindsa © 2007
Contiguous Allocation
• Main memory usually divided into two partitions:
– Resident operating system, usually held in low memory
with interrupt vector
– User processes then held in high memory
5
O.S. by Er. K.S.Dhindsa © 2007
I. SINGLE-PARTITION ALLOCATION
process 8 process 10
6
O.S. by Er. K.S.Dhindsa © 2007
Dynamic Storage-Allocation Problem
How to satisfy a request of size n from a list of free holes ??
• First-fit: Allocate the first free block of memory that is big enough
• Best-fit: Allocate the smallest free block of memory that is big
enough; must search entire list, unless ordered by size
– Produces the smallest leftover hole
• Worst-fit: Allocate the largest free block of memory ; must also
search entire list
– Produces the largest leftover hole
Firstfit and bestfit better than worstfit in terms of
speed and storage utilization
7
O.S. by Er. K.S.Dhindsa © 2007
PAGING
8
O.S. by Er. K.S.Dhindsa © 2007
Paging Model of Logical and Physical Memory
9
O.S. by Er. K.S.Dhindsa © 2007
Address Translation Scheme
10
O.S. by Er. K.S.Dhindsa © 2007
Paging Hardware
11
O.S. by Er. K.S.Dhindsa © 2007
Paging Model of Logical and Physical Memory
12
O.S. by Er. K.S.Dhindsa © 2007
Implementation (Structure) of Page Table
13
O.S. by Er. K.S.Dhindsa © 2007
Paging Hardware With TLB
14
O.S. by Er. K.S.Dhindsa © 2007
HIT RATIO
15
O.S. by Er. K.S.Dhindsa © 2007
Memory Protection
16
O.S. by Er. K.S.Dhindsa © 2007
Valid (v) or Invalid (i) Bit In A Page Table
17
O.S. by Er. K.S.Dhindsa © 2007
Thrashing
• Leading to:
– low CPU utilization
– operating system thinks that it needs to increase
the degree of multiprogramming
– another process added to the system
18
O.S. by Er. K.S.Dhindsa © 2007
Thrashing (Cont.)
19
O.S. by Er. K.S.Dhindsa © 2007
Working-Set Model
• Works on the assumption of locality
∀ ∆ ≡ working-set window ≡ a fixed number of page
references
Example: 10,000 instruction
• WSSi (working set of Process Pi) =
total number of pages referenced in the most recent ∆
(varies in time)
– if ∆ too small will not encompass entire locality
– if ∆ too large will encompass several localities
– if ∆ = ∞ ⇒ will encompass entire program
• D = Σ WSSi ≡ total demand frames
21
O.S. by Er. K.S.Dhindsa © 2007
Segmentation
• Memory-management scheme that supports user view
of memory
• A program is a collection of segments. A segment
is a logical unit such as:
main program,
procedure,
function,
method,
object,
local variables, global variables,
common block,
stack,
symbol table, arrays
22
O.S. by Er. K.S.Dhindsa © 2007
User’s View of a Program
23
O.S. by Er. K.S.Dhindsa © 2007
Logical View of Segmentation
4
1
3 2
4
user space physical memory space
24
O.S. by Er. K.S.Dhindsa © 2007
Segmentation Architecture
• Logical address consists of a two tuple:
<segment-number, offset>
• Segment table – maps two-dimensional physical
addresses; each table entry has:
– base – contains the starting physical address where
the segments reside in memory
– limit – specifies the length of the segment
• Segment-table base register (STBR) points to the
segment table’s location in memory
• Segment-table length register (STLR) indicates
number of segments used by a program;
25
O.S. by Er. K.S.Dhindsa © 2007
Segmentation Hardware
26
O.S. by Er. K.S.Dhindsa © 2007
Example of Segmentation
27
O.S. by Er. K.S.Dhindsa © 2007
MEMORY MANAGEMENT & VIRTUAL MEMORY
Website :: www.dhindsa.info
http://groups.google.com/group/os-2007
E-Mail :: sys.operating@gmail.com
28
O.S. by Er. K.S.Dhindsa © 2007