Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Process (computing)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{short description|Particular execution of a computer program}} [[File:Concepts- Program vs. Process vs. Thread.jpg|thumb|[[Computer program|Program]] vs. Process vs. [[Thread (computing)|Thread]] <br/>[[Scheduling (computing)|Scheduling]], [[Preemption (computing)|Preemption]], [[Context switch|Context Switching]]|400x400px]] In [[computing]], a '''process''' is the [[Instance (computer science)|instance]] of a [[computer program]] that is being executed by one or many [[thread (computing)|threads]]. There are many different process models, some of which are light weight, but almost all processes (even entire [[virtual machine]]s) are rooted in an [[operating system]] (OS) process which comprises the program code, assigned system resources, physical and logical access permissions, and data structures to initiate, control and coordinate execution activity. Depending on the OS, a process may be made up of multiple threads of execution that execute instructions [[Concurrency (computer science)|concurrently]].<ref name="OSC Chap4">{{cite book |last1=Silberschatz |first1=Abraham |author-link=Abraham Silberschatz |last2=Cagne |first2=Greg |last3=Galvin |first3=Peter Baer |date=2004 |title=Operating system concepts with Java |edition=Sixth |chapter=Chapter 4. Processes |publisher=[[John Wiley & Sons]] |isbn=0-471-48905-0}}</ref><ref name="Vah96">{{cite book |last=Vahalia |first=Uresh |date=1996 |title=UNIX Internals: The New Frontiers |chapter=Chapter 2. The Process and the Kernel |publisher=Prentice-Hall Inc. |isbn=0-13-101908-2 |url-access=registration |url=https://archive.org/details/unixinternalsnew00vaha }}</ref> While a computer program is a passive collection of [[Instruction set|instructions]] typically stored in a file on disk, a process is the execution of those instructions after being loaded from the disk into memory. Several processes may be associated with the same program; for example, opening up several instances of the same program often results in more than one process being executed. [[Computer multitasking|Multitasking]] is a method to allow multiple processes to share [[Central processing unit|processors]] (CPUs) and other system resources. Each CPU (core) executes a single process at a time. However, multitasking allows each processor to [[context switch|switch]] between tasks that are being executed without having to wait for each task to finish ([[Preemption (computing)|preemption]]). Depending on the operating system implementation, switches could be performed when tasks initiate and wait for completion of [[input/output]] operations, when a task voluntarily yields the CPU, on hardware [[interrupt]]s, and when the operating system scheduler decides that a process has expired its fair share of CPU time (e.g, by the [[Completely Fair Scheduler]] of the [[Linux kernel]]). A common form of multitasking is provided by CPU's [[time-sharing]] that is a method for interleaving the execution of users' processes and threads, and even of independent kernel tasks β although the latter feature is feasible only in preemptive [[Kernel (operating system)|kernels]] such as [[Linux kernel|Linux]]. Preemption has an important side effect for interactive processes that are given higher priority with respect to CPU bound processes, therefore users are immediately assigned computing resources at the simple pressing of a key or when moving a mouse. Furthermore, applications like video and music reproduction are given some kind of real-time priority, preempting any other lower priority process. In time-sharing systems, [[context switch]]es are performed rapidly, which makes it seem like multiple processes are being executed simultaneously on the same processor. This seemingly-simultaneous execution of multiple processes is called [[Concurrency (computer science)|concurrency]]. For security and reliability, most modern [[operating system]]s prevent direct [[inter-process communication|communication]] between independent processes, providing strictly mediated and controlled inter-process communication. ==Representation== [[File:Htop_3.0.1_screenshot.png|thumb|right|400px|A list of processes as displayed by [[htop]]]] [[File:KSysGuard 5.22.0 process table screenshot.png|alt=A process table as displayed by KDE System Guard|thumb|401x401px|A process table as displayed by [[KDE System Guard]]]] In general, a computer system process consists of (or is said to ''own'') the following resources: * An ''image'' of the executable [[machine code]] associated with a program. * Memory (typically some region of [[virtual memory]]); which includes the executable code, process-specific data (input and output), a [[call stack]] (to keep track of active [[subroutine]]s and/or other events), and a [[Heap memory|heap]] to hold intermediate computation data generated during run time. * Operating system descriptors of resources that are allocated to the process, such as [[file descriptor]]s ([[Unix]] terminology) or [[Handle (computing)|handles]] ([[Microsoft Windows|Windows]]), and data sources and sinks. * [[Computer security|Security]] attributes, such as the process owner and the process' set of permissions (allowable operations). * [[Central processing unit|Processor]] state ([[context (computing)|context]]), such as the content of [[processor register|registers]] and physical memory addressing. The ''state'' is typically stored in computer registers when the process is executing, and in memory otherwise.<ref name="OSC Chap4"/> The operating system holds most of this information about active processes in data structures called [[process control block]]s. Any subset of the resources, typically at least the processor state, may be associated with each of the process' [[Thread (computer science)|threads]] in operating systems that support threads or ''child'' processes. The operating system keeps its processes separate and allocates the resources they need, so that they are less likely to interfere with each other and cause system failures (e.g., [[deadlock (computer science)|deadlock]] or [[thrashing (computer science)|thrashing]]). The operating system may also provide mechanisms for [[inter-process communication]] to enable processes to interact in safe and predictable ways. ==Multitasking and process management== {{Main|Process management (computing)}} A [[Computer multitasking|multitasking]] [[operating system]] may just switch between processes to give the appearance of many processes [[Execution (computing)|executing]] simultaneously (that is, in [[Parallel computing|parallel]]), though in fact only one process can be executing at any one time on a single [[Central processing unit|CPU]] (unless the CPU has multiple cores, then [[Multithreading (computer architecture)|multithreading]] or other similar technologies can be used).{{Efn|Some modern CPUs combine two or more independent processors in a [[Multi-core processor|multi-core]] configuration and can execute several processes simultaneously. Another technique called [[simultaneous multithreading]] (used in [[Intel]]'s [[Hyper-threading]] technology) can simulate simultaneous execution of multiple processes or threads.}} It is usual to associate a single process with a main program, and child processes with any spin-off, parallel processes, which behave like [[Asynchrony (computer programming)|asynchronous]] subroutines. A process is said to ''own'' resources, of which an ''image'' of its program (in memory) is one such resource. However, in multiprocessing systems ''many'' processes may run off of, or share, the same [[Reentrancy (computing)|reentrant]] program at the same location in memory, but each process is said to own its own ''image'' of the program. Processes are often called "tasks" in [[embedded system|embedded]] operating systems. The sense of "process" (or task) is "something that takes up time", as opposed to "memory", which is "something that takes up space".{{Efn|Tasks and processes refer essentially to the same entity. And, although they have somewhat different terminological histories, they have come to be used as synonyms. Today, the term process is generally preferred over task, except when referring to "multitasking", since the alternative term, "multiprocessing", is too easy to confuse with multiprocessor (which is a computer with two or more CPUs).}} The above description applies to both processes managed by an operating system, and processes as defined by [[process calculus|process calculi]]. If a process requests something for which it must wait, it will be blocked. When the process is in the [[Process state|blocked state]], it is eligible for swapping to disk, but this is transparent in a [[virtual memory]] system, where regions of a process's memory may be really on disk and not in [[Computer data storage#Primary storage|main memory]] at any time. Even portions of active processes/tasks (executing programs) are eligible for swapping to disk, if the portions have not been used recently. Not all parts of an executing program and its data have to be in physical memory for the associated process to be active. ===Process states=== {{Main|Process state}} [[File:Process states.svg|right|300px|thumb|The various process states, displayed in a [[state diagram]], with arrows indicating possible transitions between states]] An operating system [[kernel (operating system)|kernel]] that allows multitasking needs processes to have [[process states|certain states]]. Names for these states are not standardised, but they have similar functionality.<ref name="OSC Chap4"/> * First, the process is "created" by being loaded from a [[Auxiliary memory|secondary storage]] device ([[hard disk drive]], [[CD-ROM]], etc.) into [[main memory]]. After that the [[Scheduling (computing)|process scheduler]] assigns it the "waiting" state. * While the process is "waiting", it waits for the [[scheduling (computing)|scheduler]] to do a so-called [[context switch]]. The context switch loads the process into the processor and changes the state to "running" while the previously "running" process is stored in a "waiting" state. * If a process in the "running" state needs to wait for a resource (wait for user input or file to open, for example), it is assigned the "blocked" state. The process state is changed back to "waiting" when the process no longer needs to wait (in a blocked state). * Once the process finishes execution, or is terminated by the operating system, it is no longer needed. The process is removed instantly or is moved to the "terminated" state. When removed, it just waits to be removed from main memory.<ref name="OSC Chap4" /><ref name="Stallings">{{cite book |last=Stallings |first=William |date=2005 |title=Operating Systems: internals and design principles |edition=5th |publisher=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")</ref> ==Inter-process communication== {{Main|Inter-process communication}} When processes need to communicate with each other they must share parts of their [[address space]]s or use other forms of inter-process communication (IPC). For instance in a [[Shell (computing)|shell]] [[Pipeline (computing)|pipeline]], the output of the first process needs to pass to the second one, and so on. Another example is a task that has been decomposed into cooperating but partially independent processes which can run simultaneously (i.e., using concurrency, or true parallelism β the latter model is a particular case of concurrent execution and is feasible whenever multiple CPU cores are available for the processes that are ready to run). It is even possible for two or more processes to be running on different machines that may run different operating system (OS), therefore some mechanisms for communication and synchronization (called [[communications protocol]]s for distributed computing) are needed (e.g., the [[Message Passing Interface]] {MPI}). ==History== {{See also|History of operating systems}} By the early 1960s, computer control software had evolved from [[monitor control software]], for example [[IBM 7090/94 IBSYS|IBSYS]], to [[executive control software]]. Over time, computers got faster while [[Time-sharing|computer time]] was still neither cheap nor fully utilized; such an environment made [[Computer multitasking#Multiprogramming|multiprogramming]] possible and necessary. Multiprogramming means that several programs run [[Concurrency (computer science)|concurrently]]. At first, more than one program ran on a single processor, as a result of underlying [[uniprocessor system|uniprocessor]] computer architecture, and they shared scarce and limited hardware resources; consequently, the concurrency was of a ''serial'' nature. On later systems with [[Multiprocessing|multiple processors]], multiple programs may run concurrently in ''[[Parallel computing|parallel]]''. Programs consist of sequences of instructions for processors. A single processor can run only one instruction at a time: it is impossible to run more programs at the same time. A program might need some [[System resource|resource]], such as an input device, which has a large delay, or a program might start some slow operation, such as sending output to a printer. This would lead to processor being "idle" (unused). To keep the processor busy at all times, the execution of such a program is halted and the operating system switches the processor to run another program. To the user, it will appear that the programs run at the same time (hence the term "parallel"). Shortly thereafter, the notion of a "program" was expanded to the notion of an "executing program and its context". The concept of a process was born, which also became necessary with the invention of [[Reentrancy (computing)|re-entrant code]]. [[Thread (computer science)|Threads]] came somewhat later. However, with the advent of concepts such as [[time-sharing]], [[computer network]]s, and multiple-CPU [[shared memory]] computers, the old "multiprogramming" gave way to true [[Computer multitasking|multitasking]], [[multiprocessing]] and, later, [[Multithreading_(computer_architecture)|multithreading]]. ==See also== {{div col|colwidth=22em}} * [[Background process]] * [[Code cave]] * [[Child process]] * [[Exit (system call)|Exit]] * [[Fork (system call)|Fork]] * [[Light-weight process]] * [[Orphan process]] * [[Parent process]] * [[Process group]] * [[wait (system call)|Wait]] * [[Working directory]] * [[Zombie process]] {{div col end}} ==Notes== {{notelist|30em}} ==References== {{reflist|30em}} ==Further reading== * Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau (2014). "[https://web.archive.org/web/20200916133128/https://pages.cs.wisc.edu/~remzi/OSTEP/ Operating Systems: Three Easy Pieces]". Arpaci-Dusseau Books. Relevant chapters: [https://web.archive.org/web/20200916133128/https://pages.cs.wisc.edu/~remzi/OSTEP/cpu-intro.pdf Abstraction: The Process] [https://web.archive.org/web/20200916133128/https://pages.cs.wisc.edu/~remzi/OSTEP/cpu-api.pdf The Process API] * Gary D. Knott (1974) ''[http://doi.acm.org/10.1145/775280.775282 A proposal for certain process management and intercommunication primitives]'' ACM SIGOPS Operating Systems Review. Volume 8, Issue 4 (October 1974). pp. 7 β 44 ==External links== {{Wikiversity|at=Operating Systems/Process and Thread|Processes and Threads}} *{{Commonscatinline}} *[http://www.processlibrary.com/ Online Resources For Process Information] *[http://www.file.net/ Computer Process Information Database and Forum] *[https://osnote.space/process-models-with-process-creation-termination-methods.html Process Models with Process Creation & Termination Methods] {{Webarchive|url=https://web.archive.org/web/20210206000025/https://osnote.space/process-models-with-process-creation-termination-methods.html |date=2021-02-06 }} {{Parallel Computing}} {{Operating System}} {{Authority control}} {{DEFAULTSORT:Process (computing)}} [[Category:Process (computing)| ]] [[Category:Concurrent computing]] [[Category:Operating system technology]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Commonscatinline
(
edit
)
Template:Div col
(
edit
)
Template:Div col end
(
edit
)
Template:Efn
(
edit
)
Template:Main
(
edit
)
Template:Notelist
(
edit
)
Template:Operating System
(
edit
)
Template:Parallel Computing
(
edit
)
Template:Reflist
(
edit
)
Template:See also
(
edit
)
Template:Short description
(
edit
)
Template:Webarchive
(
edit
)
Template:Wikiversity
(
edit
)