1. The processor scheduling hierarchy and the goals of the scheduling algorithm
The scheduling hierarchy includes three levels of scheduling.
(1) Advanced scheduling. Also called job scheduling or long-range scheduling. The object of scheduling is a job, which is mainly used in a multi-channel batch processing system.
(Why don't real-time systems and time-sharing systems need le , because the response time is relatively high. [It is because the multi-channel batch system has no interactive ability, so the time-sharing system appeared later])
(2) Low-level scheduling. Also called process scheduling or short-range scheduling. Scheduled objects are processes or kernel-level threads . For batch systems, time-sharing systems, real-time systems. (All must be configured :-O)
(3) Intermediate scheduling. Also known as memory scheduling. The object of scheduling is the process. Commonly used in time-sharing systems and systems with virtual memory.
Probably the picture below~
Goal of a Processor Scheduling Algorithm
1. Common goals of processor scheduling algorithms
(1) High system throughput
(2) High resource utilization rate
(3) Balanced utilization of various resources
(4) Priority criteria
(5) Fairness
(6) Policy enforcement
2. The goal of batch processing system
(1) Average turnaround time★ (2) Short system throughput (3) High processor utilization
Next are a few very simple little concepts
Turnaround Time = Job Completion Time - Job Submission Time
Average turnaround time = sum of turnaround time for each job / number of jobs
Weighted turnaround time = turnaround time / service time = (waiting time + service time) / service time = 1 + waiting time / service time
Average weighted turnaround time = weighted turnaround time / number of jobs
do a little exercise
There are 4 jobs arriving at the same time, each job takes 2 hours to execute, and they are executed in a single pass on one processor, then the average turnaround time is ( )
A 1 hour, B 5 hours
C 2.5 hours D 8 hours
Answer B
(Average Job Turnaround Time = (2+(2+2)+(2+2+2))+(2+2+2+2))/4=5 hours
Suppose 4 jobs arrive at the same time, and the execution time of each job is 2 hours. They are executed in a single pass on one processor. The average weighted turnaround time is ( )
A 1 hour, B 5 hours
C 2.5 hours D 8 hours
Answer C
Average weighted turnaround time = (2/2+(2+2)/2+(2+2+2)/2+(2+2+2+2)/2)/4=2.5 hours
Weighted turnaround time = (waiting time + service time) / service time = 1 + waiting time / service time3. The goal of the time- sharing system
(1) Fast response time. [Response time refers to the time from when the user submits a request through the keyboard until the first response is generated in the system] (2) Balance
4. Objectives of real-time systems
(1) Deadline guarantee
Deadline is the latest time a task must start or the latest time it must complete
Deadlines are an important metric in real-time systems
(2) Predictability
Next are several key scheduling algorithms, which are very important, knock on the blackboard!
1. First come first serve (FCFS) scheduling algorithm
Scheduling is performed according to the order in which jobs/processes enter the system, and those who enter the system first are scheduled first.
It can be used for job scheduling and process scheduling.
Pros: Simple.
Disadvantages: good for long jobs, not good for short jobs. lead to short job starvation