Operating System Concepts Learning note three CPU scheduling algorithm

Source: Internet
Author: User
Tags terminates

A basic concept
1 the records in the queue are usually the process control blocks of the process.
2 CPU scheduling decisions can occur in the following four environments a when a process switches from a running state to a waiting state such as an I/O request or call wait to wait for a child process to terminate party B a process switches from the running state to the required state for example, when an interrupt occurs when a process switches from a wait state to a required state for example, I/O completion d when a process terminates
When the dispatch can only occur in the first and fourth situations, the scheduling scheme is non-preemptive, otherwise the scheduling scheme can be preempted.
With non-preemptive scheduling, once the CPU is assigned to a process, the process will always use the CPU until the process terminates or switches to the waiting state to release the CPU
3 Dispatcher functions include: Toggle context Switch to user mode jump to the appropriate location in the user program to restart the program
Two scheduling criteria CPU utilization: 40% to 90%
Throughput: The number of processes completed within a single time unit.
Turnaround time: The interval from the time the process is submitted to the completion of the process is called the turnaround time. Turnaround time is the sum of all time periods, including waiting to enter memory, waiting in the ready queue
, execution on the CPU and I/O execution
Wait time: The CPU scheduling algorithm does not affect the amount of time that the process runs and performs I/O. It only affects the amount of time that the process spends waiting in the queue.
Response time: The time from the submission request to the first response. Is the time required to start the response, not the time it takes to output the response.
Maximizes CPU usage and throughput, minimizing turnaround time, latency, and time
Three-CPU scheduling algorithm
1 First-come-first service dispatch FCFS (first-come,first-served) When a process enters a queue, its PCB is linked to the tail of the queue, and when the CPU is idle, the CPU is assigned to the process that is located in the queue header. Next, the running process from the team
The column is deleted.
The average wait time for the FCFS strategy is quite long
The FCFS scheduling algorithm is non-preemptive.
2 Shortest job Priority scheduling SJF (Shortest-job-first) SJF algorithm is really difficult when how to know the length of the next CPU request. SJF scheduling is often used for long-term scheduling.
3 Priority scheduling each process has a priority associated with it, and the process with the highest priority is assigned to the CPU. Processes with the same priority are dispatched in FCFS order.
Priority can be defined in either an internal or an external way.
Priority scheduling can be either preemptive or non-preemptive.
One of the main problems of priority scheduling algorithm is infinite blocking. The solution is aging, aging is a technology that gradually increases the priority of the process waiting for a long time in the system
Right.
The 4 rotation method (RR) scheduling algorithm is specially designed for time-sharing system. Defines the one-hour unit, called the amount of time or time slice. The time slices are usually 10ms to 100ms. Ready Team
column is processed as a circular queue. The CPU scheduler loops on the queue, assigning each process a CPU that does not exceed a single time slice interval.
If the context switch time is approximately 10% of the time slice, then about 10% of the CPU time is wasted on context switching.

5 Multi-level queue scheduling (multilevel queue-scheduling algorithm) different queues are available for foreground and background processes, the foreground queue may be dispatched using the RR algorithm, and the latter queue may be dispatched using the FCFS algorithm.
6 Multilevel Feedback queue scheduling algorithm for multi-level queue scheduling, usually when a process enters the system, it is permanently assigned to a queue, and the process does not move between queues.
Four multi-processor scheduling
Heap Multi-processor asymmetric multi-processor

Five real-time scheduling real-time computing is divided into two types: hard real-time, soft realtime real-time: The system needs to complete the key tasks within the guaranteed time. Typically, when a process is committed, there is also a statement that tells the system how long it takes to complete or perform I/O
。 Soft real-time: requires that critical processes have higher priority than other weaker processes. Realization of soft real-time requirements of self-study design dispatcher and operating system: first, the system must have priority scheduling, and the real-time process must have the highest priority. The priority of real-time processes does not decrease over time, although the priority of non-real-time processes can be
To. Second, the allocation delay must be small
Dispatcher stops a process and starts another process execution takes time to become the dispatch delay
The six Linuxlinux provides two independent process scheduling algorithms. One is a time-sharing algorithm for fair and preemptive scheduling between multiple processes. One is designed for a live task, and Linux only allows processes that run in user mode to be preempted
The first scheduling type is used for time-sharing processes, and Linux uses a priority, credit-based algorithm for traditional timeshare processes. Each process has a certain number of
Degree of credit, the party to select a new task to run, the process with the most credit will be selected. Each time a timer interrupt occurs, the current running process loses a credit,
The party's credit is 0 o'clock, it will be paused and another process will be selected.
Linux uses two types of real-time scheduling: first-to-first processing and rotation.
Time slice rotation (RR) scheduling is more suitable for CTSS. The FCFS algorithm is non-preemptive, and the RR algorithm is preemptive. SJF and priority algorithms can make preemption or non-preemption possible.
The multi-level queuing algorithm allows multiple different algorithms to be used for various types of processes, the most common being the foreground interaction queue (RR) and the background batch queue (FCFS). Multi-level feedback team
Columns allow processes to migrate between queues.
Both Solaris 2 and Windows2000 employ preemptive, priority-based scheduling algorithms, including support for real-time threading, to schedule thread Linux process schedulers to use priority-based algorithms, and to provide real-time support.

Operating System Concepts Learning note three CPU scheduling algorithm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.