Professional Documents
Culture Documents
ch08 PDF
ch08 PDF
Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then
insert it again.
8.2!
Background!
Program must be brought into memory and placed within a process
for it to be run"
"
Input queue or job queue collection of processes on the disk
8.3!
8.4!
8.5!
8.6!
"
In MMU scheme, the value in the relocation register is added to
8.7!
8.8!
Swapping!
A process can be swapped temporarily out of memory to a backing
store, and then brought back into memory for continued execution
"
Backing store fast disk large enough to accommodate copies of
all memory images for all users; must provide direct access to
these memory images
"
Roll out, roll in swapping variant used for priority-based
scheduling algorithms; lower-priority process is swapped out so
higher-priority process can be loaded and executed
"
Major part of swap time is transfer time; total transfer time is
directly proportional to the amount of memory swapped
"
Modified versions of swapping are found on many systems (i.e.,
UNIX, Linux, and Windows)"
8.9!
8.10!
Demand Paging!
Bring a page into memory only when it is needed"
Faster response"
More users
"
"
8.11!
8.12!
Valid-Invalid Bit!
With each page table entry a validinvalid bit is associated
(1 in-memory, 0 not-in-memory)"
Initially validinvalid but is set to 0 on all entries"
Example of a page table snapshot:
Frame #"
valid-invalid bit"
1"
1"
1"
1"
0"
!"
0"
0"
page table"
"
During address translation, if validinvalid bit in page table entry is 0
page fault"
Operating System Concepts!
8.13!
8.14!
8.15!
algorithm"
8.16!
Memory Allocations!
8.17!
Contiguous Allocation!
Main memory usually into two partitions:"
8.18!
8.19!
8.20!
OS"
OS"
OS"
process 5"
process 5"
process 5"
process 5"
process 9"
process 9"
process 8"
process 2"
process 10"
process 2"
process 2"
8.21!
process 2"
8.22!
Example!
Given free memory partitions of
8.23!
Fragmentation!
External Fragmentation Gaps between allocated contiguous
I/O problem"
! Latch
! Do
8.24!
Paging!
Logical address space of a process can be noncontiguous;
load program"
Set up a page table to translate logical to physical addresses"
Internal fragmentation"
8.25!
"
8.26!
V"
V"
I"
8.27!
Paging Example !
8.28!
Paging Example!
8.29!
Free Frames!
Before allocation"
After allocation"
8.30!
table"
In this scheme every data/instruction access requires two
memory accesses. One for the page table and one for the
data/instruction."
The two memory access problem can be solved by the use
8.31!
Associative Memory!
Associative memory parallel search "
Page #"
Frame #"
8.32!
Associate Memory"
8.33!
"
"
"
"= 2 + "
"
8.34!
Memory Protection!
Memory protection implemented by associating protection bit
8.35!
8.36!
Swapping!
8.37!
Virtual Memory!
Elusion to expand memory view onto
8.38!
Demand Paging!
Bring a page into memory only when it is needed"
Faster response"
More users
"
"
8.39!
8.40!
Valid-Invalid Bit!
With each page table entry a validinvalid bit is associated
(1 in-memory, 0 not-in-memory)"
Initially validinvalid but is set to 0 on all entries"
Example of a page table snapshot:
Frame #"
valid-invalid bit"
1"
1"
1"
1"
0"
!"
0"
0"
page table"
"
During address translation, if validinvalid bit in page table entry is 0
page fault"
Operating System Concepts!
8.41!
8.42!
8.43!
algorithm"
8.44!
8.45!
8.46!
page number"
page offset"
p 2"
p i"
d"
10"
12"
10"
where pi is an index into the outer page table, and p2 is the displacement
within the page of the outer page table"
8.47!
8.48!
Address-Translation Scheme!
Address-translation scheme for a two-level 32-bit paging
architecture"
8.49!
Stop here!
8.50!
8.51!
8.52!
8.53!
8.54!
Shared Pages!
Shared code!
The pages for the private code and data can appear
anywhere in the logical address space"
8.55!
8.56!
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"
8.57!
8.58!
1"
2"
3"
2"
4"
3"
8.59!
Stop here!
8.60!
Segmentation Architecture!
Logical address consists of a two tuple:"
"
"<segment-number, offset>,"
8.61!
dynamic"
by segment table
"
Sharing."
shared segments"
Allocation."
external fragmentation"
8.62!
read/write/execute privileges"
8.63!
8.64!
Example of Segmentation!
8.65!
Sharing of Segments!
8.66!
8.67!
8.68!
8.69!
8.70!
8.71!
The image cannot be displayed. Your computer may not have enough memory to open the image, or the image may have been corrupted. Restart your computer, and then open the file again. If the red x still appears, you may have to delete the image and then
insert it again.
End of Chapter 8!