Professional Documents
Culture Documents
Operating System Concepts: Canseco@mail - Dyu.edu - TW
Operating System Concepts: Canseco@mail - Dyu.edu - TW
Concepts
Ku-Yaw Chang
canseco@mail.dyu.edu.tw
Assistant Professor, Department of
Computer Science and Information Engineering
Da-Yeh University
Ku-Yaw Chang
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
9.1 Background
Program must be brought (loaded) into memory and
placed within a process for it to be run.
Address binding
A mapping from one address space to another
A typical instruction-execution cycle
Ku-Yaw Chang
Ku-Yaw Chang
Ku-Yaw Chang
Relocatable code
can be generated
Not known at
compile time where
the process will
reside in memory
Final binding is
delayed until load
time
Ku-Yaw Chang
Special hardware
must be available
Ku-Yaw Chang
Physical address
Execution time
Logical and physical address spaces differ
Physical-address space
Ku-Yaw Chang
A hardware device
Run-time mapping from virtual to physical addresses
Logical addresses
0 to max
Physical addresses
R + 0 to R + max
Ku-Yaw Chang
10
Dynamic Relocation
Using a Relocation Register
Ku-Yaw Chang
11
Dynamic Loading
Advantage
Ku-Yaw Chang
12
Ku-Yaw Chang
13
9.1.5 Overlays
Keep in memory only those instructions and data
that are needed at any given time
Needed when process is larger than amount of
memory allocated to it
Features
Implemented by user
No special support needed from operating system
Programming design is complex
Ku-Yaw Chang
14
9.1.5 Overlays
Ku-Yaw Chang
15
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
16
Swapping
A process can be
Ku-Yaw Chang
17
Ku-Yaw Chang
18
Swapping
Context-switch time is fairly high
An average latency: 8 ms
Total swap time
208 + 208 = 416 ms
Ku-Yaw Chang
19
Swapping
Major part of the swap time is transfer time
Factors
Ku-Yaw Chang
20
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
21
Ku-Yaw Chang
22
Memory Protection
A relocation register with a limit register
Ku-Yaw Chang
23
Memory Allocation
Fixed-sized partitions
Simplest
Each partition contain exactly one process
Degree of multiprogramming is bounded
Strategies
First fit
Best fit
Worst fit
Problem
External fragmentation
Internal fragmentation
50-percent rule
Ku-Yaw Chang
24
Memory Allocation
Possible solutions to the external fragmentation
Compaction
Permit the logical address space of a process to be
noncontiguous
OS
OS
OS
OS
process 5
process 5
process 5
process 5
process 9
process 9
process 8
process 2
Ku-Yaw Chang
process 10
process 2
process 2
process 2
25
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
26
Paging
A memory-management scheme that permits
the physical-address space of a process to be
noncontiguous
Ku-Yaw Chang
page number
page offset
m-n
27
Paging hardware
Ku-Yaw Chang
28
Paging Model
Ku-Yaw Chang
29
Paging Example
Ku-Yaw Chang
30
Free Frames
Before Allocation
Ku-Yaw Chang
After Allocation
31
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
32
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
33
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
34
Ku-Yaw Chang
5. Segmentation
6. Segmentation with
Paging
7. Summary
8. Exercises
35