IT4813 - Scott Macdonald

u03a1 - Process States

Research and analyze UNIX and Windows process states:

  1. Perform research on the Web about the UNIX and Windows process states.
  2. In a separate word processing document, explain the UNIX process states and the Windows process states.
  3. Respond to the following:
  4. Attach your document to this assignment.

Process states define the current status of processes (or threads of processes) that are in - or being switched among - the states of ready, running, or blocked by the operating system (OS). A dispatcher program is responsible for switching "the processor from one process to another" (Stallings, 2005). When a process is running, it is in the context of User-Level (basic elements of the user's program) execution, or System-Level (tasks carried out by the OS to manage the process) execution. When a process is not running, it is in the Register Context, which stores the process status information necessary to resume its execution.

Although UNIX is process-based and Windows is thread-based, they are both executing processes requested by the user or the system (Muthuswamy, S.; Varadarajan, K. (2005). Beyond that fundamental concept, UNIX, Linux, and Windows use various nomenclatures to describe minor/transition states in between the major states. This document will attempt to provide an accurate overview of the functional similarities and differences observed among each OS.

There are nine process states recognized by UNIX, are broken down into various states, from Created, Running, Ready to Run, Sleeping (Blocked), to Zombie (exit/termination).

When a new process in UNIX is Created, it becomes Ready to Run; either in memory, or swapped to disk. If it is initially swapped out (due to insufficient memory), it becomes swapped back into memory and Ready to Run, in Memory.

When a process is in memory, it has multiple paths it can take. Towards a Running path, it is either accepted by the kernel for running in the kernel and/or user space, or it is preempted (queued in memory) by a higher-priority process before it is executed by the processor. A user process runs programs and utilities in the user space, and in kernel mode in order to execute system-level code that uniquely belongs to the kernel (disk and file functions, hardware I/O functions, memory allocation, and process swapping).

UNIX Running states:

There are two equivalent Ready states that form a single queue for the UNIX dispatcher:

Various system calls and interrupts may occur to processes between the user mode and kernel mode. A process running in the user mode may also be preempted by another process of higher priority, but cannot if it is running in kernel mode - only as a process moves from the kernel to the user mode. According to William Stallings, mode switches from user space to kernel space make such an OS "unsuitable for real-time processing" demands.

Otherwise, a process transitions to Asleep, in Memory, where it can wakeup to become Ready to Run, in Memory, or change to Sleep, Swapped to disk. If it has been put to sleep with memory swapped out to disk, it can wakeup to a Ready to Run, Swapped state while it awaits to be swapped from disk back into memory.

The final state is called, Zombie. This is the exit, or termination state of a process, which lingers around for a while to provide a debugging trail.


The following are various state diagrams representing UNIX Process states:

unix proc state

(Bacon; Harris, 2003)


UNIX states - color

(Bustamante, 2005).


HP-UX states

(Keenan, 2004).


Linux Process/Thread Model

The Linux 5-state process execution model is slightly different than the standard UNIX process states. In Linux (as in UNIX), the basic execution unit is the process (Muthuswamy, Varadarajan, 2005). Processes and threads. In Port Windows IPC app's to Linux, Part 1. Retrieved April 24, 2008, from IBM Global Services Group. http://www.ibm.com/developerworks/linux/library/l-ipc2lin1.html). The Running state incorporates both the Ready and Executing states. Linux also has 4 types of non-running states that can be resumed by signals or events.

Two of those non-running states are Blocked states. Interruptable is a state of waiting on some event or condition. A Non-Interruptable state is one that will not handle any signals because it is waiting directly on a hardware condition. Processes that have been halted for debugging are in a Stopped state. Terminated processes are in a Zombie state.

Linux states

(Stalling, 2005)


Windows Thread-Based States:

Windows execution is an object-oriented, multithreaded, six state process, compared to the 8 or 9 associated with UNIX, or 5 or 6 with Linux. Since the thread is the basic level of execution on Windows, processing states are also displayed as thread-based. There are two executable states; Runnable and Not Runnable.

A thread in Windows goes into a Ready state, moves to Standby when Picked to Run, then is Switched to Running. From the Running state, a thread can be placed back into the Ready state if it is Preempted by a higher-priority thread, or consumes its allocated time slice. Otherwise, it can become Blocked/Suspended and moves to Waiting for some condition, or it has finished and is Terminated.

A Waiting state is either Unblocked/Resumed when the resource becomes available and the state changes to Ready, or Unblocked to the Transition state if the thread is ready to run but still waiting on a resource.

Windows states

(Stalling, 2005)

- - Scott


References

Newham, C. (2005, March). Learning the bash shell, 3rd edition.
      Retrieved April 15, 2008, from: O'Reilly Safari Books Online.

Robbins, A. (1999, September). UNIX in a nutshell, 3rd edition.
      Retrieved April 15, 2008, from: O'Reilly Safari Books Online.

Robbins, A. (2005, October). UNIX in a nutshell, 4th edition.
      Retrieved April 15, 2008, from: O'Reilly Safari Books Online.

Lasser, J. (2000, July 7). Think unix. Retrieved
      April 16, 2008, from: O'Reilly Safari Books Online.

Loukides, M.; O'Reilly, T.; Peek, J.; Powers, S. (2002). UNIX
      Power Tools, 3rd Edition. Retrieved April 16, 2008, from:
      O'Reilly Safari Books Online.

Microsoft (2008). Functional comparison of UNIX and windows. In
      Unix Custom Application Migration Guide. Retrieved April 24,
      2008 from Microsoft Technet Library.

Lauer, H. (2006). Unix and windows processes. A PowerPoint slide
      show from Worcester Polytechnic Institute.

Stallings, W. (2005). Operating systems: internals and design principles.
      5th Edition. Prentice Hall: Upper Saddle, NJ.

Appleton, R. (1999). Improving context switching performance
      for idle tasks in linux. Retrieved April 22, 2008 from
      http://math.nmu.edu/~randy/Research/Papers/Scheduler/

Hart, J. (2004, October). Windows system programming, 3rd edition.
      In Addison-Wesley Professional Computing Series. Boston, MA:
      Pearson  Education, Inc. Retrieved April 22, 2008 from
      http://www.informit.com

Muthuswamy, S.; Varadarajan, K. (2005, April 14). Processes and threads. 
      In Port Windows IPC apps to Linux, Part 1. Retrieved April 24, 2008, 
      from IBM Global Services Group.

Bustamante, F. (2005). UNIX Internal. State diagram in
      PowerPoint show. Retrieved April 26, 2008 from
      Northwestern University.

Keenan, C. 2004, Sept. 7). Process Life Cycle. In HP-UX CSE
      Official Study Guide and Desk Reference. Retrieved
      April 26, 2008, from safari.oreilly.com.

Bacon, J., Harris, T. (2003). Operating systems: concurrent and
     distributed software design.Retrieved April 26, 2008, from
     safari.oreilly.com, and
     http://www.cl.cam.ac.uk/teaching/2003/OpSys1/handout-1up.pdf

© 2008. Scott Macdonald