Wait (operating system)

Wait (operating system)

In modern computer operating systems, a process (or task) may wait on another process to complete its execution. In most systems, a parent process can create an independently executing child process. The parent process may then issue a "wait" system call, which suspends the execution of the parent process while the child executes. When the child process terminates, it returns an exit status to the operating system, which is then returned to the waiting parent process. The parent process then resumes execution.

Modern operating systems also provide system calls that allow process threads to create other threads and wait for them to terminate ("join" them) in a similar fashion.

An operating system may provide variations of the "wait" call that allow a process to wait for any of its children processes to exit, or to wait for a single specific child process (identified by its process-ID) to exit.

Some operating systems issue a signal (SIGCHLD) to the parent process when a child process terminates, notifying the parent process and allowing it to then retrieve the child process's exit status.

The exit status returned by a child process typically indicates whether the process terminated normally or abnormally. For normal termination, this status also includes the exit code (usually a small integer value) that the process returned to the system.

A child process that terminates but is never waited on by its parent becomes a zombie process. Such a process continues to exist as an entry in the system process table even though it is no longer an actively executing program. Such situations are typically handled with a special "reaper" process that locates zombies and retrieves their exit status, allowing the operating system to then deallocate their resources.

Similarly, a child process whose parent process terminates before it does becomes an orphan process. Such situations are typically handled with a special "root" (or "init") process, which is assigned as the new parent of a process when its parent process exits. This special process detects when an orphan process terminates and then retrieves its exit status, allowing the system to deallocate the terminated child process.

See also

* Exit
* Fork
* Sleep
* Spawn
* Wait command
* Wait state


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Sleep (operating system) — A computer program (process or task) may sleep, which places it into an inactive state for a period of time. Eventually the expiration of an interval timer, or the receipt of a signal or interrupt causes the program to resume execution.A typical… …   Wikipedia

  • Exit (operating system) — A computer process terminates its execution by making an exit system call. More generally, an exit in a multithreading environment means that a thread of execution has stopped running. The operating system reclaims resources (memory, files, etc.) …   Wikipedia

  • Distributed operating system — A distributed operating system is the logical aggregation of operating system software over a collection of independent, networked, communicating, and spatially disseminated computational nodes.[1] Individual system nodes each hold a discrete… …   Wikipedia

  • Fork (operating system) — In computing, when a process forks, it creates a copy of itself, which is called a child process. The original process is then called the parent process . More generally, a fork in a multithreading environment means that a thread of execution is… …   Wikipedia

  • Real-time operating system — A real time operating system (RTOS; generally pronounced as are toss ) is a multitasking operating system intended for real time applications. Such applications include embedded systems (programmable thermostats, household appliance controllers,… …   Wikipedia

  • Wait — or WAIT may refer to: * The act of waiting, see waiting (time) * wait (command), a computer shell command * wait (operating system), an operating system system call * Wait (musician), British town pipers * Wait (song), a song by The Beatles *… …   Wikipedia

  • Convergent Technologies Operating System — A Burroughs B25 computer running CTOS The Convergent Technologies Operating System, also known variously as CTOS, BTOS and STARSYS, was a modular, message passing, multiprocess based operating system. Contents 1 …   Wikipedia

  • Wait (command) — In computing, wait is a command which pauses until execution of a background process has ended.Usage wait [n] where n is the pid or job ID of a currently executing background process (job). If n is not given, the command waits until all jobs… …   Wikipedia

  • System Restore — Infobox Software name = System Restore caption = System Restore in Windows Vista SP1 collapsible = author = developer = Microsoft released = latest release version = 6.0.6001 latest release date = February 4, 2008 latest preview version = latest… …   Wikipedia

  • Wait-for graph — A Wait For Graph in computer science is a directed graph used for deadlock detection in operating systems and relational database systems. In Computer Science, a system that allows concurrent operation of multiple processes and locking of… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”