Process scheduling (I/O consumption process and processor consumption process)

Source: Internet
Author: User

Multi-tasking operating system

The operating system provides a mechanism for the virtual processor, which gives the process an illusion that the process feels like it is monopolizing the CPU. The operating system kernel must pass reasonable process scheduling to ensure this illusion, so that the operating system resources to get the maximum utilization.

It is this virtual processor mechanism that allows the operating system to perform multiple tasks at the same time, so now the operating system is a multitasking operating system.

Multitasking operating system is divided into non-preemptive multi-task operating system and preemptive multi-task operating system, modern operating system are preemptive multi-task operating system.

In addition to the virtual processor mechanism, the Process Control block (PCB) is also the key to make the operating system concurrency. Because the process control block is able to save the context of the current processor while the process is switching, the next time the process is dispatched, it can continue to run from where it was last stopped.

I/O consuming processes and processor-consuming processes

I/O consumption process : Most of the time the program is running is committed or waiting for I/O requests, so such processes are often running, but usually a short while, so the processor tends to prioritize I/O consumption processes. This class of processes has a high priority and a long time slice.

It may be doubtful that the process waits for I/O, is not blocked, and then interrupts the CPU wake when the user finishes the I/O process? So why prioritize this kind of process? The question is because we look at the wrong angle, the I/O consumption process also consumes the processor, but consumes not a lot of it, and the priority of scheduling the process is to let the class process is to consume as much of the processor resources as necessary, so that the process is blocked, so long as the user completes the i/ O operation, the process will be woken up to handle I/O operations immediately, so in the user's opinion, the process responds very quickly and shows good user-friendliness.

processor Consumption Process : This class of processes sends the time to execute code, that is, during the execution of the process, the use of the processor resources. So unless they are preempted, they are usually kept running, so the scheduler should not keep them running from time to time, given the system's responsiveness. This class of process has a low priority and short time margins.

It may be that the process consumes the processor resources, why the priority is low, the time slice is short, why not often dispatch them, this way they will be executed as soon as possible. We analyze from the following two angles.

1) If the processor consumes a process with high priority and a long time slice, then it is real deal to consume its time slice and the system will serve other low-priority processes

2) and if the I/O consuming process has a high priority and a long time slice, it is very rare for the processor to be processed because of frequent IO operations, so that the system will automatically allocate its waiting time slices to other service-requiring processes

Obviously 2 is more reasonable, not only for the I/O consuming process to respond faster, but also to let other processes do not have to wait too long to be dispatched again.

The article is in the address of my personal blog: http://www.alphaway.org/post-416.html

Reference:

Contradiction between I/O consumption type and processor consumption type in Linux

Does the processor take precedence over scheduling I/O-consuming processes?

Process scheduling (I/O consumption process and processor consumption process)

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.