Professional Documents
Culture Documents
Fifth Edition
Chapter 4
Processor Management
Learning Objectives
Overview
Program (job)
Inactive unit
Not a process
Overview (continued)
Process (task)
Thread
Active entity
Requires resources, such as processor and special
registers, to perform its function
A single instance of a program in execution
Portion of a process
Runs independently
Processor
Overview (continued)
Multiprogramming environment
Interrupt
Context Switch
Single processor
Processor (core)
Located on chip
Dual-core, quad-core
Multi-core engineering
Processor Manager
Goal
Sequence jobs
Efficient system resource utilization
Balance I/O interaction and computation
Keep most system components busy most of time
Process Scheduler
Chapter focus
Process Scheduler functions
I/O-bound job
Many brief CPU cycles and long I/O cycles (printing
documents)
CPU-bound job
Many long CPU cycles and shorter I/O cycles (math
calculation)
Understanding Operating Systems, Fifth Edition
10
11
Handles overloading
Removes active jobs from memory
Reduces degree of multiprogramming
Results in faster job completion
Single-user environment
12
HOLD
READY
WAITING
RUNNING
FINISHED
13
14
Job accepted
15
HOLD to READY
READY to RUNNING
RUNNING to WAITING
16
WAITING to READY
RUNNING to FINISHED
17
Data structure
Contains basic job information
What it is
Where it is going
How much processing completed
Where stored
How much time spent using resources
18
Process identification
Unique
Process status
Job state (HOLD, READY, RUNNING, WAITING)
Process state
Process status word, register contents, main memory
info, resources, process priority
Accounting
Billing and performance measurements
CPU time, total time, memory occupancy, I/O
operations, number of input records read, etc.
19
20
Job PCB
21
22
Multiprogramming environment
23
Maximize throughput
24
25
Problem
Job claims CPU for very long time before I/O request issued
Builds up READY queue and empties I/O queues
Creates unacceptable system imbalance
Corrective measure
Interrupt
Used by Process Scheduler upon predetermined
expiration of time slice
Current job activity suspended
Reschedules job into READY queue
26
Preemptive
Nonpreemptive
27
28
First-Come, First-Served
Nonpreemptive
Job handled based on arrival time
Disadvantages
29
First-Come, First-Served
(continued, p121)
30
Nonpreemptive
Also known as shortest job first (SJF)
Job handled based on length of CPU cycle time
Easy implementation in batch environment
CPU time requirement known in advance
Does not work well in interactive systems
Optimal algorithm
All jobs are available at same time
CPU estimates available and accurate
31
32
Priority Scheduling
Nonpreemptive
Preferential treatment for important jobs
Highest priority programs processed first
No interrupts until CPU cycles completed or
natural wait occurs
READY queue may contain two or more jobs with
equal priority
Uses FCFS policy for same priority jobs
System administrator or Processor Manager use
different methods of assigning priorities
33
Memory requirements
34
35
36
37
Round Robin
Preemptive
Used extensively in interactive systems
Based on predetermined slice of time
Each job assigned time quantum
Time quantum size
Crucial to system performance
Varies from 100 ms to 2 seconds
CPU equally shared among all active processes
Not monopolized by one job
38
39
40
41
Efficiency
42
43
Depends on system
44
Multiple-Level Queues
45
Simple
Rewards high-priority jobs
Good environment
46
47
48
Case 4: Aging
49
Interrupt Types
Page interrupt (memory manager)
Accommodate job requests
Time quantum expiration interrupt
I/O interrupt
Result from READ or WRITE command issuance
Internal interrupt
Synchronous
Result from arithmetic operation or job instruction
Illegal arithmetic operation interrupt
Dividing by zero; bad floating-point operation
50
Interrupt handler
Control program
51
52
Summary
53
Summary (continued)
54
Chapter 4 Homework
Due: 10/5/2009
Pages: 136-138
Research Topics: A
Exercises: 1, 2, 4, 5, 7, 13.