Process (computing)

Program vs. Process vs. Thread
Scheduling, Preemption, Context Switching

In computing, a process is the instance of a computer program that is being executed by one or many threads. There are many different process models, some of which are light weight, but almost all processes (even entire virtual machines) 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 concurrently.[1][2]

While a computer program is a passive collection of 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.

Multitasking is a method to allow multiple processes to share processors (CPUs) and other system resources. Each CPU (core) executes a single process at a time. However, multitasking allows each processor to switch between tasks that are being executed without having to wait for each task to finish (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 interrupts, 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 kernels such as 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 switches 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.

For security and reliability, most modern operating systems prevent direct communication between independent processes, providing strictly mediated and controlled inter-process communication.

Representation

A list of processes as displayed by htop
A process table as displayed by KDE System Guard
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 subroutines and/or other events), and a heap to hold intermediate computation data generated during run time.
  • Operating system descriptors of resources that are allocated to the process, such as file descriptors (Unix terminology) or handles (Windows), and data sources and sinks.
  • Security attributes, such as the process owner and the process' set of permissions (allowable operations).
  • Processor state (context), such as the content of registers and physical memory addressing. The state is typically stored in computer registers when the process is executing, and in memory otherwise.[1]

The operating system holds most of this information about active processes in data structures called process control blocks. Any subset of the resources, typically at least the processor state, may be associated with each of the process' 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 or 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

A multitasking operating system may just switch between processes to give the appearance of many processes executing simultaneously (that is, in parallel), though in fact only one process can be executing at any one time on a single CPU (unless the CPU has multiple cores, then multithreading or other similar technologies can be used).[a]

It is usual to associate a single process with a main program, and child processes with any spin-off, parallel processes, which behave like 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 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 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".[b]

The above description applies to both processes managed by an operating system, and processes as defined by process calculi.

If a process requests something for which it must wait, it will be blocked. When the process is in the 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 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

The various process states, displayed in a state diagram, with arrows indicating possible transitions between states.

An operating system kernel that allows multitasking needs processes to have certain states. Names for these states are not standardised, but they have similar functionality.[1]

  • First, the process is "created" by being loaded from a secondary storage device (hard disk drive, CD-ROM, etc.) into main memory. After that the process scheduler assigns it the "waiting" state.
  • While the process is "waiting", it waits for the 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.[1][3]

Inter-process communication

When processes need to communicate with each other they must share parts of their address spaces or use other forms of inter-process communication (IPC). For instance in a shell 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 protocols for distributed computing) are needed (e.g., the Message Passing Interface {MPI}).

History

By the early 1960s, computer control software had evolved from monitor control software, for example IBSYS, to executive control software. Over time, computers got faster while computer time was still neither cheap nor fully utilized; such an environment made multiprogramming possible and necessary. Multiprogramming means that several programs run concurrently. At first, more than one program ran on a single processor, as a result of underlying uniprocessor computer architecture, and they shared scarce and limited hardware resources; consequently, the concurrency was of a serial nature. On later systems with multiple processors, multiple programs may run concurrently in 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 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 re-entrant code. Threads came somewhat later. However, with the advent of concepts such as time-sharing, computer networks, and multiple-CPU shared memory computers, the old "multiprogramming" gave way to true multitasking, multiprocessing and, later, multithreading.

See also

Notes

  1. ^ Some modern CPUs combine two or more independent processors in a 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.
  2. ^ 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).

References

  1. ^ a b c d Silberschatz, Abraham; Cagne, Greg; Galvin, Peter Baer (2004). "Chapter 4. Processes". Operating system concepts with Java (Sixth ed.). John Wiley & Sons. ISBN 0-471-48905-0.
  2. ^ Vahalia, Uresh (1996). "Chapter 2. The Process and the Kernel". UNIX Internals: The New Frontiers. Prentice-Hall Inc. ISBN 0-13-101908-2.
  3. ^ 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")

Further reading

Read other articles:

Teori independen menolak anggapan bahwa setiap penginjil secara independen mengambil catatan saksi mata dan mungkin tradisi lisan Hipotesis independen adalah sebuah cetusan solusi terhadap masalah sinoptik. Hipotesis tersebut menyatakan bahwa Injil Matius, Injil Markus dan Injil Lukas adalah komposisi asli yang dibuat secara indenpenden satu sama lain, dengan tanpa kaitan dokumen. Referensi Richard Bauckham, Jesus and the Eyewitnesses: The Gospels as Eyewitness Testimony (2006). Werner Kelber, T…

Style of hiking A hiker who has just completed the Appalachian TrailThru-hiking, or through-hiking, is the act of hiking an established long-distance trail end-to-end continuously. The term is most frequently used regarding trails in the United States, such as the Pacific Crest Trail (PCT), the Appalachian Trail (AT), and the Continental Divide Trail (CDT). Globally, some examples of thru-hikes include Te Araroa in New Zealand, the Camino de Santiago in Spain and France, the Via Francigena in Fr…

Die PresseTipeDaily newspaperFormatBroadsheetPemilikStyria Media Group AGPenerbitDie Presse Verlags-Gesellschaft m.b.H. & Co KGRedaksiRainer NowakDidirikan1848; 175 tahun lalu (1848)Pandangan politikTengah-kanan, liberalisme klasikBahasaJermanPusatWina, AustriaSirkulasi surat kabar80.000 (2013)Situs webdiepresse.com Die Presse adalah koran harian berbahasa Jerman yang berbasis di Wina, Austria.[1] Koran ini pertama kali dicetak pada tanggal 3 Juli 1848[2] dan merupakan k…

坐标:43°11′38″N 71°34′21″W / 43.1938516°N 71.5723953°W / 43.1938516; -71.5723953 此條目需要补充更多来源。 (2017年5月21日)请协助補充多方面可靠来源以改善这篇条目,无法查证的内容可能會因為异议提出而被移除。致使用者:请搜索一下条目的标题(来源搜索:新罕布什尔州 — 网页、新闻、书籍、学术、图像),以检查网络上是否存在该主题的更多可靠来源(…

Public college in Batanes, Philippines Batanes State CollegeDalubhasaang Pampamahalaan ng Batanes (Filipino)Other namesBaSCo, BSCFormer namesBatanes Polytechnic CollegeBatanes School of Arts and Trades (1967–1994)TypePublic State collegeCo-educationalHigher education institutionEstablished2004PresidentDr. Djovi Regala DuranteLocationWashington Avenue,Brgy San Antonio, Basco, Batanes, Philippines20°27′04″N 121°58′07″E / 20.451148°N 121.968602°E / 20.4511…

2016年美國總統選舉 ← 2012 2016年11月8日 2020 → 538個選舉人團席位獲勝需270票民意調查投票率55.7%[1][2] ▲ 0.8 %   获提名人 唐納·川普 希拉莉·克林頓 政党 共和黨 民主党 家鄉州 紐約州 紐約州 竞选搭档 迈克·彭斯 蒂姆·凱恩 选举人票 304[3][4][註 1] 227[5] 胜出州/省 30 + 緬-2 20 + DC 民選得票 62,984,828[6] 65,853,514[6] 得…

La 25HP era un'autovettura di lusso prodotta dalla Casa automobilistica francese De Dion-Bouton. Profilo Si tratta di uno degli ultimi modelli di prestigio della Casa francese. Dopo la prima guerra mondiale, la De Dion-Bouton non si rese conto che c'era bisogno di modelli popolari ed economici, per cui inizialmente tornò a rispolverare modelli di prestigio, tra i quali vi fu anche la 25HP una delle ultime vetture della Casa a montare un V8, che in questo Caso era di circa 3695 cm³. La trazione…

الدَّوْلَةُ العُثمَانيَّة السلطنة العُثمانيَّة - دولة بني عُثمان ↓ 1299 – 1923 ↓ الدولة العثمانيةالبيرق (1844 - 1923) الدولة العثمانيةالنيشان (1882 - 1923) الشعار الوطني : دَوْلَت اَبَد مُدَّت النشيد : السلام السلطاني الدولة العثمانية في أقصى اتساع لها سنة 1683 سميت باسم عُثمان …

Anne HecheHeche pada tahun 2014LahirAnne Celeste Heche(1969-05-25)25 Mei 1969Aurora, Ohio, A.S.Meninggal11 Agustus 2022(2022-08-11) (umur 53)Los Angeles, California, A.S.PendidikanSekolah Francis W. ParkerPekerjaanAktrisTahun aktif1987–2022Suami/istriColeman Coley Laffoon ​ ​(m. 2001; c. 2009)​PasanganEllen DeGeneres (1997–2000)James Tupper (2007–2019)Anak2Orang tuaNancy Heche (ibu) Anne Celeste Heche (/heɪtʃ/ haytch;[1]&#…

145th New York Infantry RegimentActiveSeptember 11, 1862 (mustered in)–December 9, 1863 (disbanded and members transferred)DisbandedDecember 9, 1863CountryUnited StatesAllegianceUnionBranchInfantrySizeRegimentEngagementsAmerican Civil War Mud March Battle of Chancellorsville Battle of Gettysburg Battle of Williamsport Battle of Robertson's Ford Insignia1st Division, XII CorpsMilitary unit New York U.S. Volunteer Infantry Regiments 1861-1865 Previous Next 144th New York Infantry Regiment 146th …

Region of Italy For other uses, see Calabria (disambiguation). Region in ItalyCalabria Καλαβρία (Greek)Region FlagCoat of armsCoordinates: 39°00′N 16°30′E / 39.0°N 16.5°E / 39.0; 16.5CountryItalyCapitalCatanzaroGovernment • PresidentRoberto Occhiuto (FI)Area • Total15,222 km2 (5,877 sq mi)Population (1 January 2021) • Total1,877,527 • Density120/km2 (320/sq mi)Demonym(s)English: …

متلازمة إعادة التغذية معلومات عامة الاختصاص تغذية  من أنواع سوء التغذية  تعديل مصدري - تعديل   متلازمة إعادة التغذية هي متلازمة تتكون من اضطرابات التمثيل الغذائي التي تحدث نتيجة لإعادة التغذية إلى المرضى الذين يعانون من الجوع أو سوء التغذية الحاد أو الأيض بسبب مرض شد…

This film-related list is incomplete; you can help by adding missing items. (August 2008) Cinema ofJapan List of Japanese films Pre-1910 1910s 1920s 1930s 1940s 1950s 1950 1951 1952 1953 19541955 1956 1957 1958 1959 1960s 1960 1961 1962 1963 19641965 1966 1967 1968 1969 1970s 1970 1971 1972 1973 19741975 1976 1977 1978 1979 1980s 1980 1981 1982 1983 19841985 1986 1987 1988 1989 1990s 1990 1991 1992 1993 19941995 1996 1997 1998 1999 2000s 2000 2001 2002 2003 20042005 2006 2007 2008 2009 2010s 201…

Species of butterfly Scarlet flash Scientific classification Domain: Eukaryota Kingdom: Animalia Phylum: Arthropoda Class: Insecta Order: Lepidoptera Family: Lycaenidae Genus: Rapala Species: R. dieneces Binomial name Rapala dieneces(Hewitson, 1878) Rapala dieneces, the scarlet flash, is a species of lycaenid or blue butterfly first described by William Chapman Hewitson in 1878. It is found in Myanmar, northern India, Assam, Bengal, Malaya, Singapore, Sumatra, Borneo, Nias and the Philippin…

Executive organ of the United Nations. One of six principal organs of the UN For the building it is housed in, see United Nations Secretariat Building. United Nations SecretariatUnited Nations Headquarters in New York CityFormation1945TypePrimary OrganLegal statusActiveSecretary-GeneralAntónio GuterresDeputy Secretary-GeneralAmina J. MohammedWebsiteun.org/secretariat The United Nations Secretariat is one of the six principal organs of the United Nations (UN),[1][2] The secretari…

Promotional use of LGBT rights Not to be confused with Pinkwashing (breast cancer). This article may be unbalanced toward certain viewpoints. Please improve the article by adding information on neglected viewpoints, or discuss the issue on the talk page. (May 2024) Anarcho-queer collective Mashpritzot hold a die-in protest against Israeli pinkwashing and the perceived homo-normative priorities of the LGBT support centre in Tel Aviv Part of a series onLGBT topics     …

2015 single by BaronessShock MeThe vinyl cover.Single by Baronessfrom the album Purple ReleasedNovember 15, 2015Recorded2015StudioTarbox Road Studios, Cassadaga, New YorkGenre Progressive metal sludge metal Length4:17LabelAbraxan HymnsComposer(s) John Dyer Baizley Pete Adams Nick Jost Sebastian Thomson Lyricist(s)John Dyer BaizleyProducer(s) David Fridmann Baroness Baroness singles chronology Chlorine & Wine (2015) Shock Me (2015) Borderlines (2019) Alternative coverThe cover for the CD and …

20th-century New Zealand-born lexicographer, editor, and author (1894–1979) Partridge in 1971 Eric Honeywood Partridge (6 February 1894 – 1 June 1979) was a New Zealand–British lexicographer of the English language, particularly of its slang. His writing career was interrupted only by his service in the Army Education Corps and the RAF correspondence department during World War II. Early life Partridge was born in the Waimata Valley, near Gisborne, on the North Island of New Zealand[1&…

The 1957 Encyclopédie Larousse[1] defines a cell in music as a small rhythmic and melodic design that can be isolated, or can make up one part of a thematic context. The cell may be distinguished from the figure or motif: the 1958 Encyclopédie Fasquelle[1] defines a cell as the smallest indivisible unit, unlike the motif, which may be divisible into more than one cell. A cell can be developed, independent of its context, as a melodic fragment, it can be used as a developmental …

Russian Bolshevik revolutionary and politician In this name that follows Eastern Slavic naming customs, the patronymic is Ilyich and the family name is Podvoisky. Nikolai PodvoiskyНиколай ПодвойскийPeople's Commissar of Military and Naval Affairs of the Russian SFSRIn office8 November 1917 – 13 March 1918Preceded byPosition established (Aleksander Verkhovsky as minister of War and Navy)Succeeded byLeon TrotskyPeople's Commissar of Military Affairs of the Ukrainian…