Main Memory 2.0
Main Memory 2.0
Course 8: Review
A set of blocked processes each holding a resource and waiting to acquire a
Example
P1 and P2 each hold one disk drive and each needs another one.
Example
P1
wait(B) //P(B)
wait(A) //P(A)
8.2
Course 8: Review
Deadlock can arise if four conditions hold simultaneously
8.3
Course 8: Review
8.4
Swapping
Paging
Segmentation
8.5
Objectives
To provide a detailed description of various ways of
8.6
Background
8.7
Background
Program must be brought (from disk) into memory and placed
directly
Register access in one CPU clock (or less)
8.8
8.9
8.10
Multistep Processing
of a User Program
8.11
8.12
8.13
8.14
Dynamic Loading
Routine is not loaded until it is called
8.15
Dynamic Linking
Linking postponed until execution time
memory address
Dynamic linking is particularly useful for libraries
System also known as shared libraries
8.16
8.17
Swapping
Major part of swap time is transfer time; total transfer time is directly
proportional to the amount of memory swapped
8.18
8.19
Contiguous Allocation
Main memory usually into two partitions:
8.20
8.21
OS
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.22
process 2
8.23
Fragmentation
External Fragmentation total memory space exists to satisfy a
I/O problem
8.24
Paging
Logical address space of a process can be noncontiguous;
8.25
page number
page offset
m-n
8.26
Paging Hardware
8.27
8.28
Paging Example
32-byte memory and
4-byte pages
8.29
Free Frames
After allocation
Before allocation
Operating System Concepts 8th Edition
8.30
page 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
8.33
EAT = (1 + ) + (2 + )(1 )
=2+
8.34
Memory Protection
Memory protection implemented by associating protection bit
8.35
8.36
Shared Pages
Shared code
The pages for the private code and data can appear
anywhere in the logical address space
8.37
8.38
8.39
8.40
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:
page number
pi
12
page offset
p2
10
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.41
Address-Translation Scheme
8.42
8.43
Segmentation
Memory-management scheme that supports user view of memory
such as:
main program,
procedure,
function,
method,
object,
local variables, global variables,
common block,
stack,
symbol table, arrays
8.44
8.45
1
2
user space
8.46
Segmentation Architecture
Logical address consists of a two tuple:
<segment-number, offset>,
Segment table maps two-dimensional physical addresses;
8.47
read/write/execute privileges
8.48
Segmentation Hardware
8.49
Example of Segmentation
8.50
Intel Pentium
8.51
8.52
8.53
8.54
8.55
8.56
8.57
End of Course 9