Process

Process (computing)

A list of processes as displayed by htop
In computing, a process is an instance of acomputer program that is being executed. It contains the program code and its current activity. Depending on the operating system(OS), a process may be made up of multiplethreads of execution that execute instructionsconcurrently.[1][2]
A computer program is a passive collection ofinstructions, while a process is the actual execution of those instructions. Several processes may be associated with the same program; for example, opening up several instances of the same program often means more than one process is being executed.
Multitasking is a method to allow multiple processes to share processors (CPUs) and other system resources. Each CPU (core) executes a single task at a time. However, multitasking allows each processor to switchbetween tasks that are being executed without having to wait for each task to finish. Depending on the operating system implementation, switches could be performed when tasks perform input/output operations, when a task indicates that it can be switched, or on hardware interrupts.
A common form of multitasking is time-sharing. Time-sharing is a method to allow fast response for interactive user applications. 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 seeming execution of multiple processes simultaneously is calledconcurrency.
For security and reliability, most modernoperating systems prevent directcommunication between independent processes, providing strictly mediated and controlled inter-process communication functionality.

RepresentationEdit

In general, a computer system process consists of (or is said to own) the following resources:
  • An image of the executable machine codeassociated 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 activesubroutines and/or other events), and aheap to hold intermediate computation data generated during run time.
  • Operating system descriptors of resources that are allocated to the process, such asfile descriptors (Unix terminology) orhandles (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 (daughter) 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 forinter-process communication to enable processes to interact in safe and predictable ways.

Multitasking and process managementEdit

multitasking operating system may just switch between processes to give the appearance of many processes executingsimultaneously (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 likeasynchronous 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 manyprocesses may run off of, or share, the samereentrant 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" inembedded 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 avirtual memory system, where regions of a process's memory may be really on disk and not in main memory at any time. Note that even unused portions of active processes/tasks (executing programs) are eligible for swapping to disk. All parts of an executing program and its data do not have to be in physical memory for the associated process to be active.

Process statesEdit

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 driveCD-ROM, etc.) into main memory. After that the process schedulerassigns it the "waiting" state.
  • While the process is "waiting", it waits for the scheduler to do a so-called context switch and load the process into the processor. The process state then becomes "running", and the processor executes the process instructions.
  • If a process 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 communicationEdit

When processes communicate with each other it is called "Inter-process communication" (IPC). Processes frequently need to communicate, for instance in a shell pipeline, the output of the first process need to pass to the second one, and so on to the other process. It is preferred in a well-structured way not using interrupts.
It is even possible for the two processes to be running on different machines. The operating system (OS) may differ from one process to the other, therefore some mediator(s) (calledprotocols) are needed.

HistoryEdit

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 mademultiprogramming 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 someresource, 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 codeThreads came somewhat later. However, with the advent of concepts such astime-sharingcomputer networks, and multiple-CPU shared memory computers, the old "multiprogramming" gave way to truemultitasking, multiprocessing and, later,multithreading.

See alsoEdit



Child process

child process in computing is a processcreated by another process (the parent process). This technique pertains tomultitasking operating systems, and is sometimes called a subprocess or traditionally a subtask.
There are two major procedures for creating a child process: the fork system call (preferred in Unix-like systems and the POSIX standard) and the spawn (preferred in the modern (NT) kernel of Microsoft Windows, as well as in some historical operating systems).

HistoryEdit

Child processes date to the late 1960s, with an early form in later revisions of theMultiprogramming with a Fixed number of Tasks Version II (MFT-II) form of the IBMOS/360 operating system, which introducedsub-tasking (see task). The current form in Unix draws on Multics (1969), while the Windows NT form draws on VAX/VMS, fromRSX-11 (1972).

Children created by forkEdit

A child process inherits most of its attributes, such as file descriptors, from its parent. InUnix, a child process is typically created as a copy of the parent, using the fork system call. The child process can then overlay itself with a different program (using exec) as required.
Each process may create many child processes but will have at most one parent process; if a process does not have a parent this usually indicates that it was created directly by the kernel. In some systems, including Linux-based systems, the very first process (called init) is started by the kernel atbooting time and never terminates (see Linux startup process); other parentless processes may be launched to carry out various daemontasks in userspace. Another way for a process to end up without a parent is if its parent dies, leaving an orphan process; but in this case it will shortly be adopted by init.
The SIGCHLD signal is sent to the parent of a child process when it exits, is interrupted, or resumes after being interrupted. By default the signal is simply ignored.[1]

Comments

Popular posts from this blog

Truecaller

Capacitors

Microwaves