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:

Heidmoor Lambang kebesaranLetak Heidmoor di Segeberg NegaraJermanNegara bagianSchleswig-HolsteinKreisSegeberg Municipal assoc.Bad Bramstedt-LandPemerintahan • MayorKarl MenkenLuas • Total18,25 km2 (705 sq mi)Ketinggian23 m (75 ft)Populasi (2013-12-31)[1] • Total325 • Kepadatan0,18/km2 (0,46/sq mi)Zona waktuWET/WMPET (UTC+1/+2)Kode pos24632Kode area telepon04192Pelat kendaraanSESitus webwww.amt-bad-brams...

 

Pour les articles homonymes, voir Atelier (homonymie). Atelier 212 (en serbe Атеље 212 et Atelje 212), est un théâtre de Belgrade, la capitale de la Serbie. Il a été créé en 1956. On y représente essentiellement des pièces d'avant-garde. L'Atelier 212. Histoire Atelier 212 ouvrit ses portes le 12 novembre 1956. Le nombre « 212 » correspondait au nombre de places disponibles dans la salle du théâtre. Lors de la première représentation on joua Faust de Goethe dans ...

 

Staatsliga A 1955-1956 Competizione Fußball-Bundesliga Sport Calcio Edizione 45ª Organizzatore ÖFB Date dal 27 agosto 1955al 6 ottobre 1956 Luogo  Austria Partecipanti 14 Cronologia della competizione 1954-55 1956-57 Manuale L'edizione 1955-56 della Staatsliga (A) vide la vittoria finale del SK Rapid Wien. Capocannoniere del torneo fu Johann Buzek del First Vienna con 33 reti. Classifica finale Classifica G V N P GF GS Pt 1 SK Rapid Wien 26 20 3 3 93 37 43 2 Admira Vienna 26 ...

Sporting event delegationTanzania at the2020 Summer ParalympicsIPC codeTANNPCTanzania Paralympic Committeeexternal linkin TokyoCompetitors2 in 1 sportsMedals Gold 0 Silver 0 Bronze 0 Total 0 Summer Paralympics appearances (overview)19921996–2000200420082012201620202024 Tanzania competed at the 2020 Summer Paralympics in Tokyo, Japan, from 23 July to 8 August 2021. This was the country's sixth appearance in the Summer Paralympics since debuting at the 1992 Summer Paralympics. Disability clas...

 

First Lady of the United States (1857-1861) For ships named Harriet Lane, see USCGC Harriet Lane. For the British writer, see Harriet Lane (author). Harriet LaneLane c. 1860Acting First Lady of the United StatesIn roleMarch 4, 1857 – March 4, 1861PresidentJames BuchananPreceded byJane PierceSucceeded byMary Todd Lincoln Personal detailsBornHarriet Rebecca Lane(1830-05-09)May 9, 1830Franklin County, Pennsylvania, U.S.DiedJuly 3, 1903(1903-07-03) (aged 73)Narragansett, Rhode Isl...

 

追晉陸軍二級上將趙家驤將軍个人资料出生1910年 大清河南省衛輝府汲縣逝世1958年8月23日(1958歲—08—23)(47—48歲) † 中華民國福建省金門縣国籍 中華民國政党 中國國民黨获奖 青天白日勳章(追贈)军事背景效忠 中華民國服役 國民革命軍 中華民國陸軍服役时间1924年-1958年军衔 二級上將 (追晉)部队四十七師指挥東北剿匪總司令部參謀長陸軍�...

PT Virama Karya (Persero)SebelumnyaPN Virama Karya {1961 - 1972)JenisBadan usaha milik negaraIndustriKonsultansiPendahuluNV Architecten-Ingenieursbureau Fermont-CuypersDidirikan29 Maret 1961; 63 tahun lalu (1961-03-29)KantorpusatJakarta, IndonesiaWilayah operasiIndonesiaTokohkunciJusarwanto[1](Direktur Utama)Hari Suprayogi[1](Komisaris Utama)JasaKonsultansi teknik dan manajemenPenyusunan studi pendahuluan, studi kelayakan, dan rencana induk proyekPengawasan dan evaluasi p...

 

Fictional comics superhero Comics character StarmanStarman as depicted in Rann-Thanagar War #4 (October 2005). Art by Ivan Reis and Joe Prado (pencillers), Marc Campos (inker), and John Kalisz (colorist).Publication informationPublisherDC ComicsFirst appearanceAdventure Comics #467 (January 1980)Created byPaul LevitzSteve DitkoIn-story informationAlter egoPrince GavynSpeciesMetahumanPlace of originThroneworldTeam affiliationsJustice LeagueAbilities Flight Energy manipulation Immunity to heat ...

 

Сельское поселение России (МО 2-го уровня)Новотитаровское сельское поселение Флаг[d] Герб 45°14′09″ с. ш. 38°58′16″ в. д.HGЯO Страна  Россия Субъект РФ Краснодарский край Район Динской Включает 4 населённых пункта Адм. центр Новотитаровская Глава сельского пос�...

Overview of the events of 1851 in science List of years in science (table) … 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 … Art Archaeology Architecture Literature Music Philosophy Science +... 1851 in science 18501852 Fields Archaeology Technology Sustainable energy research Transportation technology Social sciences Psychology Governance and policy studies Paleontology Dinosaurs' extinction Extraterrestrial environment Terrestri...

 

Эволюция Черепашек-ниндзяангл. Rise of the Teenage Mutant Ninja Turtles Постер сериала Жанры МультфильмЭкшнКомедияФэнтези Техника анимации рисованная Создатели Энди СурианоАнт Уорд На основе Черепашки-Ниндзя Роли озвучивали Эрик Бауза[вд], Джош Бренер, Бен Шварц, Омар Бенсо�...

 

برنامج التحول الوطني NTP تفاصيل الوكالة الحكومية البلد  السعودية تأسست يونيو 2016 صلاحياتها تتبع رؤية السعودية 2030 الإدارة الوزير محمد التويجري، رئيس لجنة برنامج التحول الوطني الوزراء المسؤولون عبدالرحمن الفضلي، نائب رئيس لجنة برنامج التحول الوطني وليد الصمعاني، عضو لجن...

BarkingBarking Town (1882–1931)Barking Town Hall (built 1958)Barking within Essex in 1961Area • 19113,805 acres (15.4 km2) • 19313,809 acres (15.4 km2) • 19613,877 acres (15.7 km2) • Coordinates51°32′09″N 0°04′43″E / 51.5358°N 0.0785°E / 51.5358; 0.0785 Population • 191131,294 • 193151,270 • 196172,293 Density • 19118.2/acre • 193113...

 

Jonathan Jakubowicz Jonathan Jakubowicz en el Festival de Cannes de 2016.Información personalNacimiento 29 de enero de 1978 (46 años)Caracas (Venezuela) Nacionalidad VenezolanaReligión Judaísmo EducaciónEducado en Universidad Central de Venezuela Información profesionalOcupación Director de cine, guionista, productor y escritor [editar datos en Wikidata] Jonathan Jakubowicz (pronunciado /Yacúbovich/ en fonética española; Caracas, 1978) es un escritor, director, productor y...

 

English antiquarian Anthony WoodPortrait of Wood by Michael BurghersBorn(1632-12-17)17 December 1632Oxford, EnglandDied28 November 1695(1695-11-28) (aged 62)Oxford, EnglandResting placeMerton College, OxfordNationalityEnglishOther namesAnthony à WoodEducationNew College School, Oxford; Lord Williams's School, Thame; Merton College, OxfordOccupationAntiquaryEmployerUniversity of OxfordAwardsMA (Oxford, 1655) Anthony Wood (17 December 1632 – 28 November 1695), who styled himself An...

Chinese state-owned banking corporation This article reads like a press release or a news article and may be largely based on routine coverage. Please help improve this article and add independent sources. (April 2018) China CITIC BankChina CITIC Bank in HangzhouNative name中信银行Company typePublicTraded asSSE: 601998 (A share)SEHK: 998 (H share)SSE Composite ComponentIndustryBankingFoundedApril 1987HeadquartersBeijing, Hong Kong, ChinaArea servedPeople's Republic of ChinaKey people...

 

Coppa della Repubblica 1934Copa de la República 1934 Competizione Copa del Rey Sport Calcio Edizione 34ª Organizzatore RFEF Date 11 marzo 1934 - 6 maggio 1934 Luogo  Spagna Partecipanti 28 Formula Torneo a eliminazione diretta Risultati Vincitore  Madrid CF(6º titolo) Secondo  Valencia Statistiche Incontri disputati 57 Gol segnati 214 (3,75 per incontro) Cronologia della competizione 1933 1935 Manuale La Copa de la República 1934 fu la 34ª edizione della Coppa di Spa...

 

本條目存在以下問題,請協助改善本條目或在討論頁針對議題發表看法。 此條目需要补充更多来源。 (2012年2月22日)请协助補充多方面可靠来源以改善这篇条目,无法查证的内容可能會因為异议提出而被移除。致使用者:请搜索一下条目的标题(来源搜索:鳌拜 — 网页、新闻、书籍、学术、图像),以检查网络上是否存在该主题的更多可靠来源(判定指引)。 此條目需�...

主要地方道 埼玉県道1号 さいたま川口線 地図 ※本線区間のみを記している。 路線延長 14.179 km 起点 さいたま市見沼区大和田町一丁目【北緯35度55分14.52秒 東経139度39分3秒 / 北緯35.9207000度 東経139.65083度 / 35.9207000; 139.65083 (埼玉県道1号起点)】 終点 川口市大字道合【北緯35度50分56.8秒 東経139度42分45.07秒 / 北緯35.849111度 東経139.7125194度&#x...

 

Italian Roman Catholic cardinal Lanfranco Margotti (1558–1611) was a Roman Catholic cardinal in the consistory of November 24, 1608 was created cardinal by Pope Paul V. Biography He was born to a family of limited means in Parma, and gained the patronage of Cardinal Filippo Sega in Rome. He traveled as a secretary with the cardinal when he became legate to France. He then moved back to Rome to work under cardinal Cinzio Aldobrandini. Well praised for his skills, he rose in the papal bureauc...