0% found this document useful (0 votes)
49 views10 pages

8.1 Operating System Overview

This document discusses operating system support including scheduling, memory management, and partitioning. [1] Scheduling involves organizing processes in long-term and short-term queues and admitting them to the processor in sequence. Memory management in multiprogramming systems uses swapping to move processes between main memory and disk storage, allowing more processes to reside in memory than physical memory allows. [2] Partitioning divides main memory into fixed-sized partitions allocated to processes. Variable partitioning allows partitions of varying sizes. Swapping and input/output queuing are used to move processes between memory and disk to improve processor and memory utilization.

Uploaded by

SixaxiS
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views10 pages

8.1 Operating System Overview

This document discusses operating system support including scheduling, memory management, and partitioning. [1] Scheduling involves organizing processes in long-term and short-term queues and admitting them to the processor in sequence. Memory management in multiprogramming systems uses swapping to move processes between main memory and disk storage, allowing more processes to reside in memory than physical memory allows. [2] Partitioning divides main memory into fixed-sized partitions allocated to processes. Variable partitioning allows partitions of varying sizes. Swapping and input/output queuing are used to move processes between memory and disk to improve processor and memory utilization.

Uploaded by

SixaxiS
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1

 8
Operating System Support

8.1 Operating System Overview

8.2 Scheduling
Long-term Short-term
Queue Queue
Admit Processor End

I/O 1 Occurs
I/O 1 Queue
I/O 2 Occurs
I/O 2 Queue

I/O n Occurs
I/O n Queue
 8.11 Queuing Diagram Representation of Processor Scheduling

8.3 Memory Management


$%&'(') Uniprogramming +(,+ &+-./0.12%&3(ก5-677ก89:+ 2 $-.+<(6+, $-.+&+=6$%&'( OS >=6?@761
?37<8.3 53)7ก$-.+$%&'(A9'5ก'1ก%3(6BCก9')1.3D37/C-E+FG)+(,+ $%&'(') Multiprogramming +(,+ $-.+F76
&+-./0.12%5-6I.@$%&'(DC@EJ@6+2)BCก5-6/-7/8K7'76'( Process ?-6 L <(6+(,+&+@E+ก'5-68+K,7&+-./0.12%
2=6ก')%A</ OS 53)8กM<F=,+5I<+1Mก >=68'/ก.- ก'2(<ก'&+-./0.12% (Memory Management)
ก'2(<ก'&+-./0.12%19')$MPM89:+$M6$%0(Q1กE+') Multiprogramming <(6+(,+ B@ Process E+
&+-./0.12%12%+.+I1-1ก+(ก 53)8.3A</$-.+E&Q-F76 Process (,6&1<BCกEJ@E+ก''7 I/O กT2)%E&@A9'8>$8>7'UกT
?@767/C-E+$B+) Idle <(6+(,+2=62%89:+?@761ก'2(<$''&+-./0.12%7/-619')$MPM8K7E&@ Process E+&+-./0.12%
12%+.+1ก$V<8-2)89:+I9I<@
• Swapping
2ก 8.11 >=69')ก7<@./ Queue 3 9')8<(6+, Long-Term Queue $%&'( Process E&1-, Short-Term
Queue $%&'( Process '@712)8F@EJ@6+A9'8>$8>7'U 53) I/O Queue ?-6 L $%&'( Process /(6I1-'@712)EJ@6+
A9'8>$8>7'U 8&?VD3F76ก'2(<ก'%6+.MP+,0K7 ก'% I/O +(,+1(ก2)[email protected]1กก.-ก'0%+.G <(6+(,+ A9'8>$8>7'UE+
') Uniprogramming 2=61(ก2) Idle 89:+$-.+E&Q-

 8  Operating System Support


2

5?-ก'2(<ก'E+ 8.11 +(,+ กTI1-$1'B5ก@9^Q&+,I<@(,6&1< E+ก'G+, &+-./0.12%1 Process ?-6 L 89:+


2%+.+1ก 53)A9'8>$8>7'U$1'B/@/I9% Process 7K+ L I<@ 81K7 Process +(,+ก%3(6'7ก'8F@EJ@6+ I/O 5?-
A9'8>$8>7'UกT/(606%6+I<@8'T.ก.- I/O <(6+(,+2=6ก3/89:+8'K769ก?M Process (,6&1<>=67/C-E+&+-./0.12%2)'7ก'EJ@
6+ I/O <(6+(,+51@ก')(6E+ Multiprogramming A9'8>$8>7'UกT/(6061$B+) Idle 89:+$-.+E&Q-
Disk Storage
Main Memory Main Memory
Disk Storage
Operating Operating
Intermediate
System System
Completed Jobs Queue Completed Jobs
Long-Term
Queue and User Sessions Long-Term Queue and User Sessions

a) Simple Job Scheduling b) Swapping


 8.12 The use of Swapping

<(6+(,+ $M6?@76%กT0K7 ?@76F//&+-./0.12%&3(ก 8K7E&@$1'B'76'( Process I<@1กF=,+ 5?-.MP+,กT1F@7<@7/


7/C- 2 F@7 0K7 &+-./0.12%&3(ก1'056 53)A9'5ก'1E&1- L กT?@76ก'EJ@6+8+K,7&+-./0.12%8M1F=,+ <(6+(,+
&+-./0.12%1F+<A?F=,+กT2)$-6D3E&@1 Process 1F+<A?F=,+ 5?-I1-I<@12%+.+ Process 8M1F=,+
677ก7K+ L 0K7 Swapping <(65$<6E+ 8.12 >=61 Long-Term Queue $%&'( Process '@76F7ก'8F@
EJ@6+A9'8>$8>7'U >=6A</(.I92)2(<8กT7/C-E+<M$กU 53) Process 8&3-+,2)BCก+%8F@1E+&+-./0.12%กT?-781K718+K,7
$1'BEJ@6+I<@8-+(,+ 53)8/60'(,63) 1 Process 8-+(,+ 81K7 Process ?-6 L %6+8$'T2$M,+ กT2)/@/Process 8&3-+,
77ก2ก&+-./0.12%&3(ก <(6+(,+$M68กM<F=,+กT0K7 I1-1 Process E<83/E+&+-./0.12%7/C-E+$B+) Ready ( 8J-+
Process (,6&1<ก%3(6'7ก'% I/O) 5?-5+A9'8>$8>7'U2)7/C-E+$B+) Idle A9'8>$8>7'UกT2) Swap Process E< L E&@
I97/C-E+ Intermediate Queue E+<M$กU >=689:+ Queue $%&'( Process BCก/@/77ก2ก&+-./0.12%J(. 0'. 2ก+(+, OS
2)83K7ก Process E< L 2ก Intermediate Queue &'K783K7ก Process E&1- L 2ก Long-Term Queue <(6+(,+ก'
9')1.3D3กT2)<%8+M+?-7I9ก( Process +%8F@1
7/-6I'กT?1ก'% Swapping กT0K7ก'% I/O +(+876 <(6+(,+2=6722)%E&@9^Q&+,83.'@/1กF=,+ 5+2)<F+=,
5?-8+K762ก A</(.I953@.ก'% Disk I/O 89:+ก'% I/O 8'T.$V<E+') 81K78/ก(ก'% I/O E+89&'K780'K76M1U
<(6+(,+ก'% Swapping 2=6J-./8M1$1''BI<@ 53)B@EJ@&3(กก' Virtual Memory >=6>(>@7+1กF=,+ กT2)J-./8M1
$1''BE+ก'% Swapping 5+,I<@1ก/M6F=,+
• Partitioning
&3(กก'6-/$V<$%&'(ก'% Partitioning 8+K,7E+&+-./0.12%$1'BEJ@6+I<@ กT0K7 ก'EJ@6+ Fixed-
Sized Partitions <(65$<6E+ 8.13 [email protected]ก'% Partition 2)?@765-6E&@1F+<5+-+7+ 5?-กTI1-2%89:+?@761F+<
8-ก(+ <(6+(,+81K7+% Process 8F@1E+&+-./0.12% กT2)?@76.6 Process +(,+36E+ Partition 83Tก$V<$1'B.6I<@
[email protected]2)EJ@6+ก'% Partition 1F+<I1-8-ก(+ 5?-กT/(6061ก'$CQ8$/8+K,7&+-./0.12% A</$-.+E&Q-
Process 1(ก2)I1-F7EJ@6+8+K,7E+&+-./0.12%1F+<7<ก(2(<8?'/1I.@ 8J-+ Process ?@76ก'8+K,7&+-./0.12%

 8  Operating System Support


3

3 Mbytes 722)BCก.636E+ Partition F+< 4 MB <(65$<6E+ 8.13b <(6+(,+2=6$CQ8$/8+K,7722)EJ@6+A</


Process 7K+ L I9 1 MB
Operating System Operating System
8M 8M
2M
8M 4M
6M
8M
8M
8M
8M
8M
12M
8M

8M 16M

8M
(a) Equal-Size Partitions (b) Unequal-Size Partitions
 8.13 Example of Fixed Partitioning of 64-Mbyte Memory

.MP19')$MPM1ก/M6F=,+0K7 ก'EJ@6+ Variable-Sized Partitions 81K7+% Process 8F@1E+&+-./0.12% กT


2)1ก'2(<$''&+-./0.12%E&@7<ก(F+<?@76ก' 8J-+ B@1&+-./0.12%F+< 64 MB <(65$<6E+ 8.14 c]t
8'M1?@+<@./&+-./0.12%.-6893- 53)18/6 OS (a) 8-+(,+ 2ก+(,+A&3< 3 Process 5'ก36E+&+-./0.12% A</8'M1 ?@+
2ก2V<$M,+$V<F76 OS 53)EJ@6+8+K,78/67$%&'(5?-3) Process (b, c, d) >=62)%E&@8กM< Hole E+$-.+@/F76
&+-./0.12% >=61F+<83Tก8กM+I9$%&'( Process  4 E+J-.6FG)&+=6 L I1-1 Process E<83/E+&+-./0.12% '@712)
9')1.3D3 <(6+(,+ OS 2=6%ก' Swap Process 2 (e) 77กI9 >=6%E&@8กM<&@76.-68/67$%&'(ก'A&3< Process E&1-
8F@I9 >=6กT0K7 Process 4 (f) 8+K762ก Process 4 1F+<83Tกก.- Process 2 <(6+(,+2=6%E&@8กM< Hole F+<83TกF=,+ E+8.3
?-71 กTB=62V<I1-1 Process E<83/E+&+-./0.12%'@712)9')1.3D3 5?- Process 2 >=67/C-E+$B+) Ready-
Suspend '@712)%6+ 5?-8+K762กI1-1&@76.-6E+&+-./0.12%E&Q-8/67$%&'( Process 2 <(6+(,+ OS 2=6?@76
Swap Process 1 (g) 77กI9 53) Swap Process 2 (h) ก3(8F@1 $%&'(?(.7/-6+, .MP+,8'M1?@+0-7+F@6< 5?-E+$V<กT%
E&@8กM<$B+ก'GU%E&@1 Hole F+<83Tก L 2%+.+1กE+&+-./0.12% 81K78.3D-+I9 &+-./0.12%กT1 Hole 83Tก L
8M11กF=,+ 53)ก'EJ@6+&+-./0.12%กT5/-36 80+M0&+=6$%&'(5ก@9^Q&+,0K7 Compaction 81K7D-+I9')/)8.3&+=6
OS 2)?@7683K7+ Process ?-6 L E+&+-./0.12%E&@17/C-E+&+-./0.12%.-6 L (,6&1<8K7'.1ก(+89:+3T7ก8</. >=689:+
ก').+ก'[email protected]0-7+F@6++53)89:+ก'$CQ8$/8.3F76A9'8>$8>7'U

 8  Operating System Support


4

Operating System 8M Operating System 8M Operating System 8M Operating System 8M


Process 1 Process 1 Process 1
20M 20M 20M

Process 2 Process 2 14M


56M 14M
36M Process 3
22M 18M

4M
(a) (b) (c) (d)
Operating System 8M Operating System 8M Operating System 8M Operating System 8M
Process 1 Process 1 Process 2 14M
20M 20M 20M
6M
Process 4 8M Process 4 8M Process 4 8M
14M
6M 6M 6M
Process 3 Process 3 Process 3 Process 3
18M 18M 18M 18M

4M 4M 4M 4M
(e) (f) (g) (h)
 8.14 The Effect of Dynamic Partitioning

ก-7+2)M2'G.MP5ก@IF9^Q&F76 Partition +(,+ 2)?@76%0.18F@E2E+$M6?-7I9+, B@M2'G 8.14 กT2)


.- I1-2%89:+?@76A&3< Process 36E+8<M1E+&+-./0.12%E+5?-3)0'(,6 Swap 8F@1 +7ก2ก+(,+ B@1ก'EJ@6+
Compaction 53@.+(,+ Process 722)BCก83K7+?%5&+-6E+FG)7/C-E+&+-./0.12% >=6 Process 7/C-E+&+-./0.12%2)
9')ก7<@./ 0%$(653)F@71C3 53)E+0%$(6กT2)157<8<'$F76?%5&+-6E+&+-./0.12% 2 9')8 <(6+,
 57<8<'$F76'/ก'F@71C3?-6 L

 57<8<'$F760%$(6?-6 L EJ@6+$%&'(0%$(6E+ก' Branch

5?-57<8<'$8&3-+,2)10-I1-5+-+7+ 53)722)893/+5936I<@E+5?-3)0'(,6 Process BCก Swap 8F@1 <(6+(,+


8K75ก@9^Q&+, 2=6?@76$'@60.15?ก?-6')&.-6 Logical Address 53) Physical Address A</ Logical Address ')V
B=6?%5&+-6$(1(+PUก(2V<8'M1?@+F76A9'5ก'1 0%$(6?-6 L E+A9'5ก'12)18/6 Logical Address 8-+(,+ $-.+ Physical
Address 2)89:+?%5&+-617/C-2'M6E+&+-./0.12%&3(ก 81K7A9'8>$8>7'U9')1.3D3 Process A9'8>$8>7'Uก2T )%ก'5936
2ก Logical 89:+ Physical Address A</7(?A+1(?M A</ก'.ก?%5&+-68'M1?@+E+FG)+(,+F76 Process 8'/ก.- Base
Address 8F@ก(5?-3) Logical Address >=689:+?(.7/-6&+=6F760VG3(กnG)F76o'U<5.'UA9'8>$8>7'U77ก518K7E&@
?'6ก(0.1?@76ก'F76 OS >=60VG3(กnG)F76o'U<5.'U2)F=,+7/C-ก(ก3/VPUE+ก'2(<ก'&+-./0.12%EJ@6+
• Paging
ก'% Partition (,65 Unequal Fixed-Size 53) Variable-Size +(,+I1-19')$MPM$%&'(ก'EJ@6+
&+-./0.12% 7/-6I'กT?1 B@$11?ME&@&+-./0.12%BCก5-677ก89:+ก@7+ L 1F+<8-ก(+5?-10-7+F@683Tก 53)5?-3)

 8  Operating System Support


5

Process BCก5-677ก89:+ก@7+83Tก L 1F+<8-ก(+ <(6+(,+ก@7+F76A9'5ก'1>=68'/ก.- Pages กT2)BCกก%&+<E&@ก(ก@7+


$1'BEJ@6+I<@E+&+-./0.12% >=68'/ก.- Frames &'K7 Page Frames <(6+(,+8+K,7I1-I<@BCกEJ@6+E+&+-./0.12%A</
Process E< L กT2)89:+$-.+7/C-E+ Page $V<@/89:+$-.+E&Q-
Free Frame List Free Frame List
13 13 20 Process A
13 Page 0
of A
Process A 14 14 Process A Page Table 14 Page 1
13 of A
Page 0 Page 0
15 15 15 Page
of A
2
Page 1 Page 1 14
18 16 In Use
15
16 In Use
Page 2 Page 2
Page 3
20 17 In Use
Page 3 18
17 In Use
18 18 Page
of A
3
19 In Use 19 In Use
20 20

a) Before b) After
 8.15 Allocation of Free Frames

 8.15 5$<6?(.7/-6ก'EJ@6+ Pages 53) Frames A</E+8.3E< L 2)16 Frame E+&+-./0.12%
ก%3(6BCกEJ@6+ 53)16 Frame .-6 <(6+(,+'/ก'F76 Frame .-6 กT2)BCก2(<ก'A</ OS B@ก%&+<E&@ Process A 
2(<8กTE+<M$กU9')ก7<@./ 4 Pages <(6+(,+81K7B=68.3A&3< Process A 53@.+(,+ OS กT2)& Frame .-6 L 2%+.+ 4 Frame
53)A&3< 4 Pages F76 Process A 36E+ 4 Frame +,
E+?(.7/-6+, $11?ME&@ Frame ?-78+K76ก(+53)I1-BCกEJ@6+12%+.+I1-8/67$%&'( Process A 5?-9^Q&+ก, IT 1-
%E&@ OS &/V<ก'A&3< Process A I<@ 8+K762ก1ก'EJ@6+ Logical Address 8/65?-I1-I<@EJ@6+ Base Address 8-+(+,
A</ OS 2)<C532(<ก' Page Table $%&'(5?-3) Process A</ Page Table 2)5$<6?%5&+-6F76 Frame $%&'(5?-3)
Page F76 Process +(,+ <(6+(,+E+A9'5ก'1 5?-3) Logical Address 2)9')ก7<@./ Page Number 53) Relative Address
$(1(+PUก( Page 5?-E+ก'GF76ก'% Partition +(,+ Logical Address 2)89:+?%5&+-6F76 Word $(1(+PUก(2V<8'M1?@+
F76A9'5ก'1 2ก+(,+A9'8>$8>7'UกT2)5936 Logical Address E&@89:+ Physical Address 5?-$%&'( Paging +(,+ ก'5936
Logical Address 89:+ Physical Address +(,+2)ก')%A</o'U<5.'UF76A9'8>$8>7'U A</A9'8>$8>7'U?@76'[email protected]8F@B=6 Page
Table F76 Process +(,+ L <(6+(,+81K7EJ@6+ Logical Address >=69')ก7<@./ Page Number 53) Relative Address
A9'8>$8>7'UกT?@76EJ@6+ Page Table $%&'($'@6 Physical Address (Frame Number 53) Relative Address) ?(.7/-6+,
5$<6E+ 8.16
.MP+,5ก@9^Q&8กM<F=,+E+ก-7+&+@+,I<@ &+-./0.12%&3(กBCก5-677ก89:+ Frame 1F+<83Tก8- L ก(+ 5?-3)
Process BCก5-677ก89:+ Page 1F+<8-ก(F+<F76 Frame <(6+(,+ Process F+<83TกกT2)1 Page 2%+.++@7/ 5?-
Process F+<E&Q-กT2)1 Page 2%+.+1ก <(6+(,+81K7+% Process 8F@1 Page ?-6 L F76 Process +(,+กT2)BCกA&3<36E+
Frame $1'BEJ@6+I<@ 2ก+(,+2=6$'@6 Page Table F=,+1

 8  Operating System Support


6
Main Memory

Page Relative Address Frame Relative Address Page 0


13
Number Within Page Number Within Frame of A
Page 1
Logical Physical 14
1 30 14 30 of A
Address Address Page 2
15
of A
13
16
14
15
17
18
Process A Page 3
18
Page Table of A

 8.16 Logical and Physical Addresses

• Virtual Memory
o Demand Paging
81K71ก'EJ@6+ Paging กT2)%E&@') Multiprogramming 19')$MPMก3/89:+2'M6I<@ 53).MP5-6
Process 77ก89:+ Page ?-6 L กT+%I9$C-ก'(w+5+.0M<$%0(Q +(+กT0K7 Virtual Memory
8K7E&@8F@E28ก/.ก( Virtual Memory 2=6?@767PM/8M18?M18ก/.ก(&3(กก'F76 Paging >=6$M68M1F=,+1กT0K7
Demand Paging >=6&1/0.1.- 5?-3) Page F76 Process 2)BCก+%8F@1กT?-781K789:+ Page ?@76ก'8-+(,+
M2'G Process F+<E&Q- >=69')ก7<@./A9'5ก'10-7+F@6/.53)7'U8'/U2%+.+1กF76F@71C3 E+J-.6
8.3$(,+ L ก'9')1.3D3722)2%ก(<7/C-E+$-.+83Tก L F76A9'5ก'18-+(,+ 8J-+ Subroutine 53)60'(,6722)17'U8'/U
F76F@71C38/61 x2 7'U8'/U8-+(,+BCกEJ@6+ >=689:+I9?1&3(กก'F76 Locality <(6+(,+2=689:+ก'$CQ8$/$%&'(ก'A&3<
Page F76 Process +(,+89:+2%+.+1ก 5?-18/6I1-ก Page 8-+(,+BCกEJ@6+ ก-7+A9'5ก'12)&/V<%6+J(. 0'. <(6+(+,
ก'EJ@6+&+-./0.12%2)<F=,+B@A&3<8/6I1-ก Page 8-+(,+ 5?-B@A9'5ก'1 Branch I9/(60%$(67/C-E+ Page I1-7/C-E+
&+-./0.12%&3(ก &'K7B@A9'5ก'17@6B=6F@71C3E+ Page I1-7/C-E+&+-./0.12%&3(ก กT2)%E&@8กM< Page Fault I<@ >=6
89:+ก'7กE&@ OS +% Page ?@76ก'8F@1
<(6+(,+ G 8.3E< L กT2)18/6I1-ก Page F76 Process E< L 8-+(,+7/C-E+&+-./0.12% <(6+(,+2=6%E&@1
Process 2%+.+1กF=,+$1'B7/C-E+&+-./0.12%I<@ +7ก2ก+(,+ /(689:+ก'9')&/(<8.3 8+K762ก Page I1-BCกEJ@
6+2)I1-BCก Swap 8F@53)77ก2ก&+-./0.12% 5?-7/-6I'กT?1 OS กT?@76y3<8/672)'[email protected]2(<ก'&3(กก'+, 81K7
OS +% Page &+=6 L 8F@1 OS กT?@76M,6 Page 7K+ L 77กI9 <(6+(,+B@ OS M,6 Page ?@76EJ@6+E+8.3?-71 OS กT?@76
+% Page +(,+ก3(8F@17กA</(+(+E< >=6B@8กM<8&?Vก'GU5+,-7/0'(,6 กT2)%E&@8กM<$.)8'/ก.- Thrashing
8+K762กA9'8>$8>7'[email protected]A</$-.+E&Q-E+ก' Swap Page 5+2)9')1.3D30%$(6?-6 L 53)ก'&3ก83/6
Thrashing 89:+&(.F@7ก'.M2(/E+J-.6z.''n 1970 53)+%I9$C-7(3ก7'M=1?-6 L 10.1>(>@7+5?-19')$MPM <(6+(,+$M6
$%0(QกT0K7 OS ?@76//18<A</1K,+{+12ก$M68กM<F=,+.- Page E<0.'2)BCกEJ@E+8.3?-71+@7/$V<
81K7EJ@6+ Demand Paging กTI1-2%89:+?@76A&3< Process (,6&1<36E+&+-./0.12%&3(ก >=6F@78T22'M6+, % E&@1
$M68กM<F=,+?11กT0K7 10.189:+I9I<@ Process 2)1F+<A?ก.-8+K,7E+&+-./0.12%&3(ก <(6+(,+F@72%ก(<E+ก'8F/+

 8  Operating System Support


7

A9'5ก'12=6BCก?(<M,6I9I<@ 5?-B@I1-1 Demand Paging A9'5ก'1817'UกT?@76').(68ก/.ก(F+<F76&+-./0.12%$1'B


EJ@6+I<@ B@A9'5ก'18F/+1F+<E&Q-8กM+I9 A9'5ก'1817'UกT?@760M<.MPE+ก'9'(A0'6$'@6A9'5ก'1E&@ก3/89:+$-.+
83Tก L $1'BA&3<I<@E+5?-3)0'(,6 5?-B@1 Demand Paging 6++,กT2)ก3/89:+&+@F76 OS 53)o'U<5.'U $M6
A9'5ก'1817'U?@768ก/.F@76กT0K7 ก'%6+ก(&+-./0.12%F+<E&Q- 53)F+<$(1(+PUก(8+K,7E+<M$กU
8+K762ก Process 2)BCก9')1.3D3E+&+-./0.12%&3(ก8-+(,+ <(6+(,+2=68'/ก&+-./0.12%.- Real Memory
5?-A9'5ก'1817'U&'K7DC@EJ@6+2)'('[email protected]1&+-./0.12%F+<E&Q-1กF=,+ กTBCก2(<$''7/C-+<M$กU <(6+(,+2=68'/ก<M$กU.-
Virtual Memory <(6+(,+81K71 Virtual Memory กT2)%E&@ Multiprogramming 19')$MPM1กF=,+ 53)%E&@F@72%ก(<
8ก/.F@76ก(&+-./0.12%&3(ก3<36I<@
o Page Table Structure
ก3IกK,+{+F76ก'7-+ Word 2ก&+-./0.12%8ก/.F@76ก(ก'5936 Virtual &'K7 Logical Address 
9')ก7<@./ Page Number 53) Offset E&@ก3/89:+ Physical Address 9')ก7<@./ Frame Number 53) Offset A</
ก'EJ@6+ Page Table 8+K762ก Page Table 10.1/.I1-5+-+7+ F=,+7/C-ก(F+<F76 Process <(6+(,+2=6I1-$1'B8กT
Page Table I.@E+ Register I<@ 5?-?@767/C-E+&+-./0.12%&3(ก8K7E&@8F@B=6I<@  8.16 5$<6.MP(w+o'U<5.'U$%&'(
&3(กก'+, 81K71 Process E< L ก%3(6%6+ กT?@761 Register >=68กT57<8<'$8'M1?@+F76 Page Table $%&'( Process
+(,+ 53) Page Number E+ Virtual Address กT2)BCกEJ@E+ก'J,I9/(6 Table +(,+ 53)0@+& Frame Number $7<03@76ก(+
2ก+(,+'.10-+,8F@ก($-.+F76 Offset E+ Virtual Address 8K7$'@6 Real Address ?@76ก'
E+')$-.+E&Q- 2)1 1 Page Table ?-7 1 Process 53)E+5?-3) Process $1'BEJ@6+ Virtual Memory
F+<E&Q-1ก L I<@ 8J-+ E+$B9^?/ก''180'K76 VAX 5?-3) Process $1'B1 Virtual Memory I<@$C6B=6 231 = 2 Gbyte
A</5?-3) Page 1F+< 29 = 512 Byte >=6&1/0.1.- E+ Page Table 2)12%+.+I<@1กB=6 222 '/ก'$%&'(5?-3)
Process <(6+(,+ 2%+.+&+-./0.12% Page Table EJ@6+8/67/-68</.กT1ก1/53@. 8K75ก@9^Q&+, &3(กก' Virtual
Memory $-.+E&Q-2=62(<8กT Page Table I.@E+ Virtual Memory 5+2)8กTI.@E+ Real Memory +(+&1/0.1.- Page
Table กT2)?@76BCก% Paging 8&1K7+ก( Page 7K+ L 81K7 Process ก%3(6%6+ กT?@761 Page Table $-.+&+=6?@767/C-E+
&+-./0.12%&3(ก 53)?@761'/ก'E+ Page Table F76 Page ก%3(69')1.3D37/C-E+FG)+(,+ A9'8>$8>7'U6?(.EJ@6+
&3(กก' 2 ')<(E+ก'2(<ก' Page Table F+<E&Q- E+&3(กก'+, 2)?@761 Page Directory >=65?-3)'/ก'2)J,I9/(6
Page Table <(6+(,+B@0.1/.F76 Page Directory 8-ก( X 53)B@0.1/.$C6$V<F76 Page Table 8-ก( Y 53@.
Process +,2)9')ก7<@./ Page >=612%+.+$C6B=6 X * Y 5?-A</(.I90.1/.$C6$V<F76 Page Table 2)BCก2%ก(<E&@
8-ก( 1 Page
Virtual Address
Page # Offset Page Table
Page # Entry Chain

(Hash)
Frame #

Frame # Offset
Hash Table Inverted Page Table
Real Address
 8.17 Inverted Page Table Structure

 8  Operating System Support


8

.MP7K+ L E+ก'EJ@6+ Page Table 5 1 ')<(&'K7 2 ')<(0K7 ก'EJ@6+A0'6$'@65 Inverted Page Table
<(65$<6E+ 8.17 .MP+,EJ@6++80'K76 IBM AS/400 53)071M.8?7'U RISC F76 IBM (,6&1<>=6'.1(,6 PowerPC
E+.MP+, $-.+F76 Page Number F76 Virtual Address 2)BCกก%&+<36E+ Hash Table A</EJ@6+ Hashing
Function 53) Hash Table 2)17/+U8?7'UJ,I9/(6 Inverted Page Table >=61'/ก'?-6 L F76 Page Table 81K7EJ@6+
A0'6$'@6+, กT2)18/6&+=6'/ก'E+ Hash Table 53) Inverted Page Table $%&'(5?-3) Real Memory Page 5+2)
89:+ 1 '/ก'?-7 Virtual Page <(6+(,+$(<$-.+5+-+7+F76 Real Memory 2)?@76BCกEJ@6+E+?'6?-6 L A</I1-F=,+7/C-ก(
2%+.+F76 Process &'K7 Virtual Page 8+K762ก1 Virtual Address 1กก.- 1 Address $1'Bก%&+<I9/(6'/ก'
8</.ก(+E+ Hash Table <(6+(,+2=6EJ@6+80+M0ก' Chaining E+ก'2(<ก' Overflow +, 80+M0ก' Hashing 2)%E&@
Chain 1F+<$(,+ A</(.I92)1 1 x 2 '/ก'
• Translation Lookaside Buffer
Start
Return to faulted instruction
CPU Checks for the TLB

Page Table Yes


Entry in
TLB?
No
Access Page Table
Page Fault
Handling Routine Page
No In Main
OS Instructs CPU to Read
the Page from Disk Memory?
Yes
CPU Activates I/O Hardware
Update TLB
Page Transferred from
Disk to Main Memory CPU Generates
Physical Address
Memory Yes
Full?
Perform Page Updated
No
Page Tables Updated

 8.18 Operation on Paging and Translation Lookaside Buffer (TLB)

?1&3(กก'53@.+(,+ ก'7@6B=6 Virtual Memory 2)%E&@8กM<ก'8F@B=6 Physical Memory 2 0'(,6 A</0'(,65'ก0K7


ก'<=6'/ก' Page Table 8&1)$1 53)0'(,6$760K7 ก'<=6F@71C3?@76ก' <(6+(,+&3(กก' Virtual Memory 5
?'6I9?'61%E&@?@768F@B=6&+-./0.12%B=6 2 0'(,6 8K75ก@9^Q&+, &3(กก' Virtual Memory A</$-.+E&Q-2=6EJ@6+

 8  Operating System Support


9

Cache $%&'(8กT'/ก' Page Table A</(.I92)8'/ก.- Translation Lookaside Buffer (TLB) A</ Cache 2)%
&+@8&1K7+ก( Memory Cache 53)1'/ก' Page Table EJ@6+81K7I1-++1+,  8.18 89:+ Flowchart >=65$<6
ก'EJ@6+ TLB 2ก&3(กก'F76 Locality ก'7@6B=6 Virtual Memory A</$-.+E&Q-2)89:+?%5&+-6?-6 L 7/C-E+ Page 
8M6EJ@6+81K7I1-++1+, <(6+(,+ ก'7@6B=6$-.+E&Q-2)8ก/.F@76ก('/ก' Page Table ?-6 L E+ Cache 2กก'z=กnE+
80'K76 VAX >=6EJ@6+ TLB .- &3(กก'+,$1'B9'(9'V6$1''BI<@7/-68&T+I<@J(<
$(68ก?I<@.- ก3Iกก'% Virtual Memory 2)?@76%6+ก(') Cache (I1-EJ- TLB Cache 5?-89:+ Main
Memory Cache) >=65$<6E+ 8.19 A</(.I9 Virtual Address 2)7/C-E+'C9F76 Page Number 53) Offset E+F(,+5'ก
')&+-./0.12%2)0@+&F@71C3E+ TLB 8K7?'.2$7.-'/ก' Page Table ?'6ก(?@76ก'17/C-&'K7I1- B@1 กT2)
$'@6 Real &'K7 Physical Address A</ก''.1 Frame Number 8F@ก( Offset 5?-B@I1-1 กT2)8F@B=6 Page Number +(,+
A</ก'EJ@6+ Page Table 81K71ก'$'@6 Real Address >=67/C-E+'C9F76 Tag 53) Remainder <(65$<6E+ 4.17 +(,+
กT2)?@760@+&E+ Cache 8K7?'.2$7.-13T7ก1 Word +(,+7/C-&'K7I1- B@1 กT2)$-6I9E&@A9'8>$8>7'U 5?-B@I1-1 กT2)<=6
Word 12ก&+-./0.12%&3(ก
TLB Operation
Virtual Address
Page # Offset
TLB
TLB Miss
TLB Hit
Cache Operation
Real Address
+ Tag Remainder Hit
Cache
Miss Value
Page Table

Value

Main Memory
 8.19 Translation Lookaside Buffer and Cache Operation

ก'5936 Virtual Address E&@89:+ Real Address 2)8ก/.F@76ก(ก'7@6B=6 Page Table >=6722)7/C-E+ TLB, E+
&+-./0.12%&3(ก &'K7E+<M$กU 53) Word 7@6B=6722)7/C-E+ Cache, E+&+-./0.12%&3(ก &'K7E+<M$กU E+ก'GF76
Word +(,+ Page 1 Word +(,+2)?@76BCกA&3<36E+&+-./0.12%&3(ก53)3T7กF76 Word 2)BCกA&3<36E+ Cache 53)
'/ก' Page Table $%&'( Page +(,+กT2)?@76BCก9'(9'V65ก@IF<@./
• Segmentation
.MP7K+ L E+ก'5-6&+-./0.12%$1'B7@6B=6I<@0K7 Segmentation 8+K762ก Paging 2)I1-$1'BEJ@6+A</
A9'5ก'1817'UI<@ 53) Paging BCก77ก5$%&'(2V<9')$60UF76ก'8?'/18+K,757<8<'$F+<E&Q-E&@ก(A9'5ก'1817'U
5?-ก'% Segmentation +(,+2)$1'BEJ@6+I<@A</A9'5ก'1817'U 53)2(<8?'/10.1$)<.ก$/E+ก'2(<ก'A9'5ก'1
53)F@71C3 53)89:+.MPก%&+<$MPMM8zn53)9ƒ76ก(+0%$(653)F@71C3

 8  Operating System Support


10

Segmentation %E&@A9'5ก'1817'U'('[email protected]&+-./0.12%9')ก7<@./8+K,757<8<'$ &'K7 Segment ?-6 L


1ก1/ 53) Segment ?-6 L 2)1F+<I1-5+-+7+ 53)89:+5I<+1Mก A</(.I953@.+(,+ A9'5ก'1817'U&'K7 OS 2)
ก%&+<A9'5ก'1&'K7F@71C3E&@7/C-E+ Segment ?-6 L ก(+ A</722)1 Program Segment $%&'(A9'5ก'19')8?-6 L>=6
8&1K7+ก( Data Segment ?-6 L 5?-3) Segment 722)BCกก%&+<ก'8F@B=6&'K7ก'8F@EJ@6+ ก'7@6B=6&+-./0.12%
9')ก7<@./'C95F7657<8<'$ 0K7 Segment Number 53) Offset
ก'2(<ก'A0'6$'@6+, 1F@7<$%&'(A9'5ก'1817'U <(6+,
1. %E&@ก''(1K7ก(A0'6$'@6F@71C3A?F=,+%I<@6-/ B@A9'5ก'1817'UI1-'3-.6&+@.-A0'6$'@6F@71C32)1
F+<E&Q-8-E< กTI1-2%89:+2)?@768< A0'6$'@6F@71C3722)BCกก%&+<E&@7/C-/E+ Segment E< L 53)
OS 2)F//&'K7&< Segment +(,+I<@?1?@76ก'
2. %E&@A9'5ก'1$1'BBCก893/+5936&'K7071I3UI<@E&1- A</I1-F=,+ก($-.+7K+ L 53)I1-2%89:+?@76 Relink
&'K7 Reload JV<F76A9'5ก'1(,6&1< >=68กM<2กก'EJ@6+ Segment ?-6 L
3. %E&@$1'BEJ@6+ Segment ?-6 L ')&.-6 Process ?-6 L '-.1ก(+I<@ A9'5ก'1817'U$1'B.6A9'5ก'1
7''B9')A/J+U&'K7?'6F@71C3E+ Segment $1'B8'/กEJ@6+A</ Process 7K+ L
4. %E&@ Segment ?-6 L 1ก'9ƒ76ก(+ 8+K762ก Segment 1JV<F76A9'5ก'1&'K7F@71C3 <(6+(,+A9'5ก'1817'U
&'K7DC@<C53')$1'Bก%&+<$MPMก'8F@B=6E+'C95?-6 L I<@
F@7<8&3-+,I1-17/C-E+ Paging >=6A9'5ก'1817'UI1-$1'BEJ@6+I<@A</?'6 5?-E+6?'6ก(+F@1 2).- Paging
I<@2(<8?'/1'C95F76ก'2(<ก'&+-./0.12%19')$MPM 8K7'.1F@7<F76(,6$76.MP8F@<@./ก(+ กT2)16')EJ@
6+(,6o'U<5.'U53) OS 8K7%6+(,6$767/-6+,

8.4 Pentium II and PowerPC Memory Management


o Paging
 8.21 5$<6ก''.1ก(+')&.-6 Segmentation 53) Paging Mechanism A</I1-I<@5$<6 Translation
Lookaside Buffer 53) Memory Cache Mechanisms
Logical Address
Segment Offset Linear Address
+ Dir Page Offset
Physical
+ Address

Segment Page Page


Table Directory Table

Segmentation Paging Main Memory


 8.21 Pentium II Memory Address Translation Mechanisms

 8  Operating System Support

You might also like