The difference between a process's blocking and suspending

Source: Internet
Author: User
Tags semaphore

    • Understand one: Hang is an active behavior, so the recovery should also be active, and blocking is a passive behavior, is waiting for events or resources when the performance of the task, you do not know when he was blocked (pend), you do not know exactly when he was blocked. And the suspend queue can be seen as one in the operating system, while the blocking queue is a different event or resource (such as Semaphore) that has its own queue.
    • Understanding two: Blocking (pend) is the task of releasing the CPU, other tasks can be run, generally waiting for some kind of resource or semaphore when it appears. Suspend (suspend) does not release the CPU, if the task priority is never turn to other tasks run, generally suspended for program debugging in the condition of the interruption, when a condition occurs, hang, and then step into the debugging.
    • Understanding Three: Pend is a task that proactively waits for an event, or a message. Suspend is a direct hanging task, and after this task has nothing to do with you, the communication or synchronization of any task is not related to this suspended task, unless you resume task ;
    • Understanding four: Task scheduling is implemented by the operating system, task scheduling, directly ignore the suspended state of the task, but will take into account the task under the Pend, when the Pend under the task of waiting for the resources ready, it can be changed to prepare. Ready only needs to wait for CPU time, and of course, task scheduling also takes up overhead, but is small and can be ignored. It can be understood that the operating system is not managing this task as long as it is suspended.
    • Understanding five: Hang is active, generally need to use the hang function to operate, if there is no resume action, this task has not been ready. Blocking is a dormant state because the resource is preempted by another task. The expression of both is "clear" from the ready state, that is, the corresponding flag is cleared, but the implementation of the way is not the same.
The difference between sleep, blocking, and hangs in the operating System image interpretation:
First of all, these terms are for threads. Control of the thread is like you control a hired hand to work for you.     Your control of a hired hand is done by programming.     Suspending a thread means that you say to your hired hand, "go to sleep, use your time, I will call you, and then go to work".     To make a thread sleep means that you take the initiative to say to the employee: "You go to sleep, at some moment come to report, and then work." Thread blocking means that you suddenly find that your employees do not know when you are not allowed to sleep on their own, but you can not blame the hired hand, it is sure that your employer did not pay attention to, you let the employee sweep, the results of the broom was stolen or by the neighbors borrowed, you did not let the employee continue to do other work, he had to sleep As for the broom back, workers will not know, will not continue to work, you do not have to worry about, once the employee found the broom back, he will go to work on his own. Because the employee is well trained. This training institution is the operating system.

The difference between a process's blocking and suspending

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.