Chapter 15The Internal Operating System – Part 1 15.1-4 Network Services File management Device management / Resource allocation Memory management / Scheduling Monitor IOCS I/O control
Trang 1Chapter 15 – Part 1
The Internal Operating System
The Architecture of Computer Hardware
and Systems Software:
An Information Technology Approach
3rd Edition, Irv Englander John Wiley and Sons 2003
Trang 3Target Model
Trang 4Chapter 15
The Internal Operating System – Part 1 15.1-4
Network Services File management
Device management / Resource allocation
Memory management / Scheduling
Monitor
IOCS (I/O control system)
Translates logical file
requests
Load programs into MM
Allocates execution time
Provides overall system
control
Loading and Executing a Program
Trang 5Multi-Tasking System
memory, I/O) to multiple processes
Different scheduling routines are used for different objectives
Trang 6Chapter 15
The Internal Operating System – Part 1 15.1-6
Processes
Process: basic unit of work in the OS
A program together with all the resources that are associated with it as it is executed
Program: a file or listing
Process: a program being executed
Independent vs cooperating processes
PID (process ID): a unique identifier for each process
Process creation: user vs system
Forking, spawning, cloning a new process
Parent and child processes
Trang 7Process Control Block
A block of data for
each process in the
system
Contains all relevant
information about the
process
Typical process
control block on the
right
Trang 8Chapter 15
The Internal Operating System – Part 1 15.1-8
Two Processes Sharing a
Single Program
Trang 9 Dispatching - Move from ready state to running state
Wake-up - Move from blocked state to ready state
Time-out - Move from running state to ready state
Process completion
Additional states – suspend, swap
Resumption – Move from suspended state to ready state
Trang 10Chapter 15
The Internal Operating System – Part 1 15.1-10
Process State Diagram
Trang 11 Advantage of process/thread families over
multiple independent processes:
Reduced OS overhead for resource allocation and process management
Substantially less information than a normal PCB
Trang 12(dispatcher)
Deciding which process shall be executed next by the processor Mid-level scheduling Swapping processes
I/O scheduling Deciding which process’s pending
I/O request shall be handled by an available I/O device
Trang 13Dispatching Objectives
response time
Prevent starvation
Trang 14Chapter 15
The Internal Operating System – Part 1 15.1-14
Nonpreemptive Dispatching
First in, first out (FIFO)
Unfair to short processes and I/O based
processes
Shortest Job First (SJF)
Longer jobs can be starved
Priority Scheduling
Dispatcher selects among jobs with the
same priorities
Trang 16Chapter 15
The Internal Operating System – Part 1 15.1-16
Preemptive Dispatching
Multilevel feedback queues
Favors short jobs, I/O bound jobs
Each level assigns more CPU time
Trang 18Chapter 15
The Internal Operating System – Part 1 15.1-18
Memory Overlays
Trang 19Virtual Memory
Virtual memory increases the apparent
amount of memory by using far less
expensive hard disk space
Provides for process separation
Trang 20Chapter 15
The Internal Operating System – Part 1 15.1-20
Frames and Pages
Amount # of bits in instruction word Installed memory
Trang 21Frames and Pages
Binary Paging
Trang 22Chapter 15
The Internal Operating System – Part 1 15.1-22
Dynamic Address Translation
Trang 23Disk
Page Frame
Pages not in main memory:
page fault when accessed
10 1 2 7
Page Table
Trang 26Chapter 15
The Internal Operating System – Part 1 15.1-26
Page Replacement Algorithms
Page fault - page is not in memory and must
be loaded from disk
Algorithms to manage swapping
First-In, First-Out FIFO – Belady’s Anomaly
Least Recently Used LRU
Least Frequently Used LFU
Not Used Recently NUR
Second Chance Replacement algorithms
Thrashing
too many page faults affect system performance
Trang 27Virtual Memory Tradeoffs
Disadvantages
SWAP file takes up space on disk
Paging takes up resources of the CPU
Advantages
Programs share memory space
More programs run at the same time
Programs run even if they cannot fit into
memory all at once
Process separation
Trang 28Chapter 15
The Internal Operating System – Part 1 15.1-28
Virtual Memory vs Caching
Trang 29Secondary Storage Scheduling
First-Come, First-Served
Shortest Distance First
Indefinite postponement problem
Scan
Middle of disk gets serviced twice
N-Step C-Scan
Disk seek in only one direction
Return after last request in queue served
Two queues
Trang 30Chapter 15
The Internal Operating System – Part 1 15.1-30
Other OS Issues
Two processes have one another’s
resources that the other needs in order to proceed
Prevention
Avoidance
Detection and recovery
Trang 31Java Virtual Machine