- understanding 1: suspension is an active action, so recovery should also be completed proactively, while blocking is a passive action, which is the performance of tasks while waiting for events or resources, you don't know when it will be blocked (pend), so you cannot know exactly when it will be restored. In addition, a suspended queue can be viewed as one in the operating system, while a blocked queue has its own queue for different events or resources (such as semaphores.
- understanding 2: blocking (pend) means that the task releases the CPU and other tasks can run. It usually appears when waiting for a certain resource or semaphore. Suspend does not release the CPU. If the task has a high priority, it will never be able to run other tasks. Generally, it is suspended for conditional interruptions in Program debugging, when a condition occurs, it is suspended and then debugged in a single step.
- understanding 3: pend is an event or message that a task takes the initiative to wait. suspend directly hangs a task. In the future, this task has nothing to do with you. Communication or synchronization between any tasks has nothing to do with this susorted task, unless you resume task;
- understanding 4: task scheduling is implemented by the operating system. During task scheduling, tasks in the suspended state are directly ignored, but those in the Pend State are considered, after the resources waiting for the task in the Pend are ready, the task can be converted to ready. Ready only needs to wait for the CPU time. Of course, task scheduling also occupies the overhead, but it is not large and can be ignored. As you can understand, the operating system does not manage this task as long as the task is suspended.
- understanding 5: suspension is active. Generally, you need to use the suspension function to perform operations. If no resume action is available, this task will never be ready. However, the resource is in sleep state because it is preemptible by other tasks. Both are expressed in a "clear" way from the readiness state, that is, the corresponding flag is cleared, but the implementation method is different.
Differences between sleep, congestion, and suspension in the operating system: first, these terms are for threads. Controlling the thread is like controlling an employee to work for you. Your control over employees is achieved through programming. Hanging a thread means you say to the employee: "Go to bed, use your time to call you, and then work ". The thread sleep means you take the initiative to say to the employee: "Go to bed, report at a certain moment, and then work ". The thread blocking means that you suddenly find that your employee does not know when you did not allow the employee to go to bed, but you cannot blame the employee. You must have not paid attention to this employer, you let the employee sweep the floor, and the broom was stolen or borrowed by the neighbor's house. You didn't let the employee continue to do other work, so he had to go to bed. When the broom comes back, will the employee know whether or not to continue working? You don't have to worry. Once the employee finds that the broom is back, he will work on his own. The employee is well trained. This training institution is the operating system.