What are process states draw a figure that illustrates the relationship of process states

Draw and explain five state process model.

written 6.4 years ago by teamques10 ★ 36k •   modified 9 months ago

1 Answer

The states in the five state process models are:

1] New: The process has not yet been loaded into main memory.

2] Ready: the process is now prepared to execute when given the opportunity.

3] Running: the process is currently being executed.

4] Blocked: Process that is waiting for some event to occur.

5] Exit: Process is released from main memory because it has halted or aborted.

Please log in to add an answer.


Home » Operating Systems

In this article, we will study about the Process State diagram which defines the various states in which a process can be while it remains in the main memory. We will first take a look at the diagram and then define each of its components briefly.
Submitted by Monika Sharma, on June 27, 2019

The Process State diagram illustrates the States in which a process can be in, and it also defines the flow in which a particular state can be achieved by the Process. Let us first take a look at the Process State diagram, which is as follows:

  • When a new process is initiated, it is said to be in the new state, which means that the process is under creation.
  • When the process is ready for execution, the long term scheduler transfers it from the new state into the ready state. The process has now entered into the main memory of the system.
  • In the ready state, the processes are scheduled by the short term schedulers, and a queue is maintained in which the processes are serially sent to the processor.
  • After maintaining the queue, the dispatcher then transfers the processes to the running state one by one as per the queue sequence.
  • While being in the running state, the process utilizes the processor. But if there is a requirement of any input or output devices in between the processing, then the process is shifted to the waiting state.
  • When the process is done with the input-output services, then instead of directly going back to the running state, it is again sent to the ready state and is then is scheduled again for going into the running state.
  • This process keeps continuing and when the process completes its execution, it goes into the termination state, which means it exits from the main memory of the system.
  • The black arrow in the diagram, which goes from the running to waiting for state exists only if the operating system follows preemption of processes, i.e. a current running process can be interrupted in between and can be replaced by some other process with high priority. If the OS does not allow preemption, then this switch is not allowed.

In a multitasking computer system, processes may occupy a variety of states. These distinct states may not be recognized as such by the operating system kernel. However, they are a useful abstraction for the understanding of processes.

The various process states, displayed in a state diagram, with arrows indicating possible transitions between states - as can be seen some processes are stored in main memory [yellow], and some are stored in secondary memory [green].

Primary process states[edit]

The following typical process states are possible on computer systems of all kinds. In most of these states, processes are "stored" on main memory.

Created[edit]

When a process is first created, it occupies the "created" or "new" state. In this state, the process awaits admission to the "ready" state. Admission will be approved or delayed by a long-term, or admission, scheduler. Typically in most desktop computer systems, this admission will be approved automatically. However, for real-time operating systems this admission may be delayed. In a realtime system, admitting too many processes to the "ready" state may lead to oversaturation and overcontention of the system's resources, leading to an inability to meet process deadlines.

Ready[edit]

A "ready" or "waiting" process has been loaded into main memory and is awaiting execution on a CPU [to be context switched onto the CPU by the dispatcher, or short-term scheduler]. There may be many "ready" processes at any one point of the system's execution—for example, in a one-processor system, only one process can be executing at any one time, and all other "concurrently executing" processes will be waiting for execution.

A ready queue or run queue is used in computer scheduling. Modern computers are capable of running many different programs or processes at the same time. However, the CPU is only capable of handling one process at a time. Processes that are ready for the CPU are kept in a queue for "ready" processes. Other processes that are waiting for an event to occur, such as loading information from a hard drive or waiting on an internet connection, are not in the ready queue.

Running[edit]

A process moves into the running state when it is chosen for execution. The process's instructions are executed by one of the CPUs [or cores] of the system. There is at most one running process per CPU or core. A process can run in either of the two modes, namely kernel mode or user mode.[1][2]

Kernel mode[edit]

  • Processes in kernel mode can access both: kernel and user addresses.
  • Kernel mode allows unrestricted access to hardware including execution of privileged instructions.
  • Various instructions [such as I/O instructions and halt instructions] are privileged and can be executed only in kernel mode.
  • A system call from a user program leads to a switch to kernel mode.

User mode[edit]

  • Processes in user mode can access their own instructions and data but not kernel instructions and data [or those of other processes].
  • When the computer system is executing on behalf of a user application, the system is in user mode. However, when a user application requests a service from the operating system [via a system call], the system must transition from user to kernel mode to fulfill the request.
  • User mode avoids various catastrophic failures:
    • There is an isolated virtual address space for each process in user mode.
    • User mode ensures isolated execution of each process so that it does not affect other processes as such.
    • No direct access to any hardware device is allowed.

Blocked[edit]

A process transitions to a blocked state when it cannot carry on without an external change in state or event occurring. For example, a process may block on a call to an I/O device such as a printer, if the printer is not available. Processes also commonly block when they require user input, or require access to a critical section which must be executed atomically. Such critical sections are protected using a synchronization object such as a semaphore or mutex.

Terminated[edit]

A process may be terminated, either from the "running" state by completing its execution or by explicitly being killed. In either of these cases, the process moves to the "terminated" state. The underlying program is no longer executing, but the process remains in the process table as a zombie process until its parent process calls the wait system call to read its exit status, at which point the process is removed from the process table, finally ending the process's lifetime. If the parent fails to call wait, this continues to consume the process table entry [concretely the process identifier or PID], and causes a resource leak.

Additional process states[edit]

Two additional states are available for processes in systems that support virtual memory. In both of these states, processes are "stored" on secondary memory [typically a hard disk].

Swapped out and waiting[edit]

[Also called suspended and waiting.] In systems that support virtual memory, a process may be swapped out, that is, removed from main memory and placed on external storage by the scheduler. From here the process may be swapped back into the waiting state.

Swapped out and blocked[edit]

[Also called suspended and blocked.] Processes that are blocked may also be swapped out. In this event the process is both swapped out and blocked, and may be swapped back in again under the same circumstances as a swapped out and waiting process [although in this case, the process will move to the blocked state, and may still be waiting for a resource to become available].

See also[edit]

  • ps [Unix]

References[edit]

  1. ^ Abraham Silberschatz; Peter Baer Galvin; Greg Gagne [2008-07-29]. Operating System Concepts. ISBN 978-0470128725.
  2. ^ Maurice J. Bach [1986]. The design of the UNIX operating system. Prentice-Hall, Inc. Upper Saddle River, NJ, USA ©1986. ISBN 0-13-201799-7.

  • Stallings, William [2005]. Operating Systems: internals and design principles [5th ed.]. Prentice Hall. ISBN 0-13-127837-1.
Particularly chapter 3, section 3.2, "process states", including figure 3.9 "process state transition with suspend states"

What is a process draw the states of process?

The state of a process is defined by the current activity of the process. New − The process is being created. Running − In this state the instructions are being executed. Waiting − The process is in waiting state until an event occurs like I/O operation completion or receiving a signal.

What is process state explain it?

A process moves into the running state when it is chosen for execution. The process's instructions are executed by one of the CPUs [or cores] of the system. There is at most one running process per CPU or core. A process can run in either of the two modes, namely kernel mode or user mode.

What is process state with example?

Process state: Each and every process has some states associated with it at a particular instant of time. This is denoted by process state. It can be ready, waiting, running, etc. CPU scheduling information: Each process is executed by using some process scheduling algorithms like FCSF, Round-Robin, SJF, etc.

What is process Process state transition diagram?

An active process is normally in one of the five states in the diagram. The arrows show how the process changes states. A process is running if the process is assigned to a CPU. A process is removed from the running state by the scheduler if a process with a higher priority becomes runnable.

Chủ Đề