Table of contents
2. Chapter 2 - [Process Scheduling]
(1) Five states and seven states (ready pending, blocking pending)
(2) Three-tier scheduling (advanced, intermediate, and low-level)
(1) Scheduling - switching timing
(3) Switching & Scheduling [Difference]
4. Evaluation index of scheduling algorithm
Turnaround time – average turnaround time
Turnaround time plus - weighted turnaround time
5. Scheduling algorithm (queuing, short job, high response)
(2) Short jobs are given priority
(3) High response ratio priority
6. Scheduling algorithm (time slice rotation, priority, multi-level feedback)
(2) Priority scheduling algorithm
(2.1) Priority Scheduling Algorithm - Setting Priority (Dynamic)
(4) Multi-level feedback queue scheduling algorithm
2. Chapter 2 - [Process Scheduling]
1. The concept of scheduling
(1) Five states and seven states (ready pending, blocking pending)
(2) Three-tier scheduling (advanced, intermediate, and low-level)
job - memory - process
(3) Summary
2. Scheduling switching
(1) Scheduling - switching timing
If the process is accessing [critical section] and [critical resource], it cannot be scheduled and interrupted!
After all, he is taking resources. If he is scheduled, then the problem will be big!
(2) Scheduling - method
(3) Switching & Scheduling [Difference]
(4) Summary
3. Scheduler & idle process
What is a scheduler - to make the state of a process switch reasonably (don't jump around repeatedly~)
Preemptive scheduler - scheduling tasks (polling mode)
Non-preemptive scheduler (take it easy)
Scheduler ( Scheduler ) is an important component in the operating system responsible for deciding which process or thread to run at a specific point in time. According to the predetermined scheduling algorithm and strategy, it selects a suitable process from the processes in the ready state, allocates processor resources to the process, and controls the state switching of the process.
The preemptive scheduler ( Preemptive Scheduler ) is a scheduling method that allows the operating system to forcibly deprive the process of CPU execution rights when a process is executing, and allocate CPU resources to other processes with higher priority. The preemptive scheduler has the ability to quickly respond to urgent tasks or high-priority tasks, improving the responsiveness of the system.
Non-preemptive scheduler ( Non-preemptive Scheduler ) , also known as cooperative scheduler, is another scheduling method. In a non-preemptive scheduler, once a process obtains CPU execution rights, it will run until it voluntarily gives up or waits for an event to occur, and then the operating system will allocate CPU resources to other processes. In this scheduling mode, processes need to consciously release CPU resources, so for a cooperative scheduler, process cooperation is particularly important.
To sum it up:
- Scheduler ( Scheduler ) is the component responsible for selecting processes or threads to execute in the operating system.
- Preemptive scheduling - can actively deprive the CPU resources of the executing process ,
- Non-preemptive scheduling - requires the process to voluntarily release CPU resources.
These two scheduling methods have different applicability, advantages and disadvantages in different scenarios.
Loitering process (spare tire) - execute [zero address] command - (shaking leg command)
4. Evaluation index of scheduling algorithm
Tsinghua textbook content:
CPU utilization
system throughput
Turnaround time – average turnaround time
Turnaround Time = Actual Run Time + Wait Time
Turnaround time plus - weighted turnaround time
waiting time
Summarize
5. Scheduling algorithm (queuing, short job, high response)
(1) First come, first served
Whoever comes first will be served first (although it is absolutely fair and will not be hungry , but...)
Queue for milk tea - when the person in front buys 20 cups, but you only buy 1 cup, you have to wait in line
(2) Short jobs are given priority
Non-preemptive - in the task queue, whoever has a short task time will execute it first (unfair)
Preemptive - creates hunger! ! !
(3) High response ratio priority
This algorithm - will not lead to starvation (combines the advantages of first come first serve, short jobs)
(4) Summary
6. Scheduling algorithm (time slice rotation, priority, multi-level feedback)
(1) Time slice rotation
Time slice settings - not too big, not too small! (The overhead of switching processes - the proportion does not exceed 1% of the total process)
Does not cause starvation - processes will be executed in turn
(2) Priority scheduling algorithm
Priority - similar to interrupt priority
Then there will be hunger~
improve proposals:
- Don't make priority static! (that is, dead, will not be modified)
- It is a dynamic priority (it will analyze the situation regularly and assign the corresponding priority to the process)
- Still hungry~
- After all, you have been generating [processes with higher priority], then [processes with lower priority] will still be hungry~
(2.1) Priority Scheduling Algorithm - Setting Priority (Dynamic)
Applicable to - real-time operating system
(3) Summary
(4) Multi-level feedback queue scheduling algorithm
By setting multiple queues~ (classic plus one layer~)
Each queue corresponds to different requests (for different queues, set different scheduling algorithms)
Between queues, you can use - time slice division, fixed priority...
Within the queue, you can use - Queue, Short Job, High Response, Priority...
(5) Summary
Suitable for interactive systems - can provide better feedback, fairness, and balance
Unix operating system - interactive system