Process state transitions

Source: Internet
Author: User

State transition diagram for ————————————————————————————————————————— process ————————————————————————————————————————— 1. Ready –> execution 2. Execute –> Ready 3. Execute –> wait 4. Wait for –> ready one, three basic state processes of the process are constantly changing their running state during operation. Typically, a running process must have the following three basic states. Ready state when a process is assigned to all the necessary resources except the CPU, the process state is called ready when the processor is available for immediate execution. Execution (Running) state when a process has been acquired by a processor and its program is executing on a processing machine, the status of the process is called the execution state. A process that is executing in a blocking (Blocked) state that, because it cannot be executed while waiting for an event to occur, discards the processor and is in a blocking state. There can be a number of events that cause a process to block, such as waiting for I/O to complete, requesting a buffer not satisfying, waiting for a letter (signal), etc. ————————————————————————————————————————— Ii. Conversion between three states of a process during the run, the transition from one state to another is constant, it can be in the ready state and execution state more than once, or it can be blocked multiple times. (1) Ready → Executes the process in the ready state, and when the process dispatcher assigns it a processor, the process is transformed from the ready state to the execution state. (2) execution → Ready in the execution of the process during its execution, because a time slice allocated to it has been exhausted and had to give up the processor, so the process from the execution state into a ready state. (3) execution → blocking the executing process from execution state to blocking state as it waits for an event to occur and cannot continue execution. (4) blocking → ready to block the process, if its waiting for the event has occurred, then the process from the blocking state into a ready state. ————————————————————————————————————————— process during its life cycle, due to the interaction between the processes in the system and the changes in the operating environment of the system, So that the state of the process is constantly changing (a process undergoes several different states). Typically there are five states of the process, the first three being the basic state of the process. 1) Running status: The process is running on the processing machine. In a single processor environment, at most one process at a time is in the running state. 2) Ready state: The process is already in the ready state, that is, the process obtains all the required resources except the processor, which can be run once the processing machine is available. 3) Blocking state, also known as wait State: process isPauses to run while waiting for an event, such as waiting for a resource to be available (not including a processor) or waiting for input/output to complete. Even if the processor is idle, the process cannot run. 4) Creation Status: The process is being created and has not yet been transferred to the ready state. Creating a process typically requires multiple steps: First apply for a blank PCB and fill in some information about the control and management process to the PCB, and then the system allocates the resources necessary for the process to run, and finally transfers the process to a ready state. 5) End Status: The process is disappearing from the system, which may be the process is terminated gracefully or other reasons interrupt the exit run. When the process needs to end the run, the system must first set the process to an end state, and then further process the resource release and recycling work. (There is a small error in the diagram, the running state to the blocking state of the arrow is reversed) Note the difference between the ready state and the wait state: The readiness State is the process is only missing processors, as long as the processor resources to execute immediately, while the wait state refers to the process requires other resources (except the processor) or wait for an event. The reason for dividing the processor and other resources is because in the time-slice rotation mechanism of the timeshare system, the time slices divided by each process are several milliseconds. In other words, the process gets the processor time is very short and very frequent, the process in the process is actually frequently converted to the ready state, while other resources (such as peripherals) use and allocation or the occurrence of an event (such as the completion of I/O operations) corresponds to a relatively long time, The number of transitions to the wait state is also relatively small. In this view, the readiness and wait states are two completely different states in the process life cycle, which clearly needs to be differentiated. ————————————————————————————————————————— ready state: When a process in the ready state is dispatched, the processor resource (dispatch processor Time slice) is obtained, and the process transitions from ready state to run state. Run status-ready state: The running process will have to give up the processor after the time slice is exhausted, thus converting the process from the running state to the ready state. Also, in a stripped-down operating system, when a higher-priority process is a thread, the scheduling level translates the process being executed into a ready state for higher-priority processes to execute. Blocking state: When a process requests the use and allocation of a resource (such as a peripheral) or waits for an event to occur (such as the completion of an I/O operation), it transitions from the running state to the blocking state. The process requests the operating system to provide services in the form of a system call, which is a special form of invoking the operating system kernel procedure by the running user-state program. Blocking status-ready state: When a process waits for an event to arrive, such as the end of an I/O operation or the end of an interrupt, the interrupt handler must convert the state of the corresponding process from a blocking state to a ready state. ————————————————————————————————————————— 1) Ready-execute: The process of the ready state, when the process Scheduler selects a ready process from a selected policy, and assigns the processor to it, the process is changed from the ready state to the execution state; 2) execution-- Blocking: The executing process cannot execute due to a wait event, that is, execution is blocked, the process is changed from execution state to wait state, as the process makes an input/output request and becomes waiting for the external device to transmit information, the process request resource (main memory space or external device) is not satisfied when it becomes the waiting resource state. The process is running in a failure (program error or main memory read-write error, etc.) into the waiting state of intervention and so on; 3) blocking-ready: The waiting state of the process, waiting for the event has occurred, such as input/output completed, the resources are satisfied or error processing, the waiting process is not immediately into the execution state , but first into the ready state, and then by the system process Scheduler at the appropriate time the process to the execution state, 4) execution-ready: The process is executing, because the time slice is run out of execution, or in a system with preemptive priority scheduling algorithm, When a higher-priority process is forced to yield a processor, the process transitions from the execution state to the ready state. —————————————————————————————————————————

Process state Transitions

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.