Background process

Last updated

A background process is a computer process that runs behind the scenes (i.e., in the background) and without user intervention. [1] Typical tasks for these processes include logging, system monitoring, scheduling, [2] and user notification. [3] The background process usually is a child process created by a control process for processing a computing task. After creation, the child process will run on its own, performing the task independent of the control process, freeing the control process of performing that task.[ citation needed ]

Contents

On a Windows system, a background process is either a computer program that does not create a user interface, or a Windows service. The former are started just as any other program is started, e.g., via Start menu. Windows services, on the other hand, are started by Service Control Manager. In Windows Vista and later, they are run in a separate session. There is no limit to how much a system service or background process can use system resources. Indeed, in the Windows Server family of Microsoft operating systems, background processes are expected to be the principal consumers of system resources.[ citation needed ]

On a Unix or Unix-like system, a background process or job can be further identified as one whose process group ID differs from its terminal group ID (TGID). (The TGID of a process is the process ID of the process group leader that opened the terminal, which is typically the login shell. The TGID identifies the control terminal of the process group.) This type of process is unable to receive keyboard signals from its parent terminal, and typically will not send output to that terminal. [4] This more technical definition does not distinguish between whether or not the process can receive user intervention. Although background processes are typically used for purposes needing few resources, any process can be run in the background, and such a process will behave like any other process, with the exceptions given above. [1]

Windows services

In Windows NT family of operating systems, a Windows service is a dedicated background process. [5] A Windows service must conform to the interface rules and protocols of the Service Control Manager, the component responsible for managing Windows services. [6]

Windows services can be configured to start when the operating system starts, and to run in the background as long as Windows runs. Alternatively, they can be started manually or by an event. Windows NT operating systems include numerous services which run in context of three user accounts: System, Network Service and Local Service. These Windows components are often associated with Host Process for Windows Services: svchost.exe. Since Windows services operate in the context of their own dedicated user accounts, they can operate when a user is not logged on.

Before Windows Vista, services installed as "interactive services" could interact with Windows desktop and show a graphical user interface. With Windows Vista, however, interactive services became deprecated and ceased operating properly, as a result of Windows Service Hardening. [7] [8]

The three principal means of managing Windows services are:

  1. Services snap-in for Microsoft Management Console
  2. sc.exe
  3. Windows PowerShell

Daemon

A daemon is a type of background process designed to run continually in the background, waiting for event(s) to occur or condition(s) to be met. [9] These processes typically use minimal system resources and perform tasks which require little to no input from the user. When launched with the daemon function, daemons are disassociated from their parent terminal. [10]

Launch and resumption on Unix

From a Unix command line, a background process can be launched using the "&" operator. The bg utility can resume a suspended job (sending SIGCONT), running it in the background. Using the fg utility will also reconnect standard input its parent terminal, bringing it into the foreground. The jobs utility will list all processes associated with the current terminal and can be used to bring background processes into the foreground. [4] [11]

When a login session ends, via explicit logout or network disconnection, all processes, including background processes, will by default be terminated, to prevent them from becoming orphan processes. Concretely, when the user exits the launching shell process, as part of shutdown it sends a hangup signal (SIGHUP) to all its jobs, to terminate all the processes in the corresponding process group. To have processes continue to run, one can either not end the session, or end the session without terminating the processes. A terminal multiplexer can be used to leave a session running but detach a virtual terminal from it, leaving processes running as child processes of the session; the user can then reattach session later. Or, termination can be prevented by either starting the process via the nohup command (telling the process to ignore SIGHUP), or by subsequently running disown with the job id, which either removes the job from the job list entirely, or simply prevents SIGHUP from being sent. In the latter case when the session ends, the child processes are not terminated, either because they are not sent SIGHUP or because they ignore it, and thus become orphan processes, which are then adopted by the init process (the kernel sets the init process as their parent), and they continue running without a session, now called daemons .

Example

In this example running on Unix, the sleep utility was launched into the background. Afterward, the ps tool was run in the foreground, where it output the below text. Both were launched from the shell. [12]

  PID TT  STAT    TIME COMMAND 5465910  S    0:00.06 su (zsh)5470310  IN   0:00.00 - sleep 10005485210  R+   0:00.00 - ps -U botty -axd 

Smartphones

Many newer versions of smartphone and PDA operating systems now include the ability to start background processes. Due to hardware limits, background processes on mobile operating systems are often restricted to certain tasks or consumption levels. On Android, CPU use for background processes may be bounded at 5 - 10%. [13] Applications on Apple's iOS are limited to a subset of functions while running in the background. [3] On both iOS and Android, background processes can be killed by the system if they are using too much memory. [3] [13]

See also

Related Research Articles

<span class="mw-page-title-main">Computer multitasking</span> Concurrent execution of multiple processes

In computing, multitasking is the concurrent execution of multiple tasks over a certain period of time. New tasks can interrupt already started ones before they finish, instead of waiting for them to end. As a result, a computer executes segments of multiple tasks in an interleaved manner, while the tasks share common processing resources such as central processing units (CPUs) and main memory. Multitasking automatically interrupts the running program, saving its state and loading the saved state of another program and transferring control to it. This "context switch" may be initiated at fixed time intervals, or the running program may be coded to signal to the supervisory software when it can be interrupted.

<span class="mw-page-title-main">Operating system</span> Software that manages computer hardware resources

An operating system (OS) is system software that manages computer hardware and software resources, and provides common services for computer programs.

Computerized batch processing is a method of running software programs called jobs in batches automatically. While users are required to submit the jobs, no other interaction by the user is required to process the batch. Batches may automatically be run at scheduled times as well as being run contingent on the availability of computer resources.

at (command) Task scheduling command on various operating systems

In computing, at is a command in Unix-like operating systems, Microsoft Windows, and ReactOS used to schedule commands to be executed once, at a particular time in the future.

<span class="mw-page-title-main">Daemon (computing)</span> Computer program that runs as a background process

In multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of an interactive user. Traditionally, the process names of a daemon end with the letter d, for clarification that the process is in fact a daemon, and for differentiation between a daemon and a normal computer program. For example, syslogd is a daemon that implements system logging facility, and sshd is a daemon that serves incoming SSH connections.

An orphan process is a computer process whose parent process has finished or terminated, though it remains running itself.

In computing, kill is a command that is used in several popular operating systems to send signals to running processes.

<span class="mw-page-title-main">Comparison of command shells</span>

A command shell is a command-line interface to interact with and manipulate a computer's operating system.

init UNIX system component

In Unix-based computer operating systems, init is the first process started during booting of the operating system. Init is a daemon process that continues running until the system is shut down. It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes. Init is started by the kernel during the booting process; a kernel panic will occur if the kernel is unable to start it. Init is typically assigned process identifier 1.

<span class="mw-page-title-main">Architecture of Windows NT</span> Overview of the architecture of the Microsoft Windows NT line of operating systems

The architecture of Windows NT, a line of operating systems produced and sold by Microsoft, is a layered design that consists of two main components, user mode and kernel mode. It is a preemptive, reentrant multitasking operating system, which has been designed to work with uniprocessor and symmetrical multiprocessor (SMP)-based computers. To process input/output (I/O) requests, they use packet-driven I/O, which utilizes I/O request packets (IRPs) and asynchronous I/O. Starting with Windows XP, Microsoft began making 64-bit versions of Windows available; before this, there were only 32-bit versions of these operating systems.

In computing, preemption is the act of temporarily interrupting an executing task, with the intention of resuming it at a later time. This interrupt is done by an external scheduler with no assistance or cooperation from the task. This preemptive scheduler usually runs in the most privileged protection ring, meaning that interruption and resuming are considered highly secure actions. Such a change in the currently executing task of a processor is known as context switching.

<span class="mw-page-title-main">Shell (computing)</span> Computer program that exposes an operating systems services to a human user or other programs

In computing, a shell is a computer program that exposes an operating system's services to a human user or other programs. In general, operating system shells use either a command-line interface (CLI) or graphical user interface (GUI), depending on a computer's role and particular operation. It is named a shell because it is the outermost layer around the operating system.

<span class="mw-page-title-main">User Account Control</span> Security software

User Account Control (UAC) is a mandatory access control enforcement feature introduced with Microsoft's Windows Vista and Windows Server 2008 operating systems, with a more relaxed version also present in Windows 7, Windows Server 2008 R2, Windows 8, Windows Server 2012, Windows 8.1, Windows Server 2012 R2, Windows 10, and Windows 11. It aims to improve the security of Microsoft Windows by limiting application software to standard user privileges until an administrator authorises an increase or elevation. In this way, only applications trusted by the user may receive administrative privileges and malware are kept from compromising the operating system. In other words, a user account may have administrator privileges assigned to it, but applications that the user runs do not inherit those privileges unless they are approved beforehand or the user explicitly authorises it.

In Windows NT operating systems, a Windows service is a computer program that operates in the background. It is similar in concept to a Unix daemon. A Windows service must conform to the interface rules and protocols of the Service Control Manager, the component responsible for managing Windows services. It is the Services and Controller app, services.exe, that launches all the services and manages their actions, such as start, end, etc.

In Unix and Unix-like operating systems, job control refers to control of jobs by a shell, especially interactively, where a "job" is a shell's representation for a process group. Basic job control features are the suspending, resuming, or terminating of all processes in the job/process group; more advanced features can be performed by sending signals to the job. Job control is of particular interest in Unix due to its multiprocessing, and should be distinguished from job control generally, which is frequently applied to sequential execution.

<span class="mw-page-title-main">Task Manager (Windows)</span> Task manager application included with the Windows NT family of operating systems

Task Manager, previously known as Windows Task Manager, is a task manager, system monitor, and startup manager included with Microsoft Windows systems. It provides information about computer performance and running software, including name of running processes, CPU and GPU load, commit charge, I/O details, logged-in users, and Windows services. Task Manager can also be used to set process priorities, processor affinity, start and stop services, and forcibly terminate processes.

Windows Vista contains a range of new technologies and features that are intended to help network administrators and power users better manage their systems. Notable changes include a complete replacement of both the Windows Setup and the Windows startup processes, completely rewritten deployment mechanisms, new diagnostic and health monitoring tools such as random access memory diagnostic program, support for per-application Remote Desktop sessions, a completely new Task Scheduler, and a range of new Group Policy settings covering many of the features new to Windows Vista. Subsystem for UNIX Applications, which provides a POSIX-compatible environment is also introduced.

<span class="mw-page-title-main">Windows Task Scheduler</span> Computer application of Microsoft Windows

Task Scheduler is a job scheduler in Microsoft Windows that launches computer programs or scripts at pre-defined times or after specified time intervals. Microsoft introduced this component in the Microsoft Plus! for Windows 95 as System Agent. Its core component is an eponymous Windows service. The Windows Task Scheduler infrastructure is the basis for the Windows PowerShell scheduled jobs feature introduced with PowerShell v3.

In computing job control refers to the control of multiple tasks or jobs on a computer system, ensuring that they each have access to adequate resources to perform correctly, that competition for limited resources does not cause a deadlock where two or more jobs are unable to complete, resolving such situations where they do occur, and terminating jobs that, for any reason, are not performing as expected.

Remote Desktop Services (RDS), known as Terminal Services in Windows Server 2008 and earlier, is one of the components of Microsoft Windows that allow a user to initiate and control an interactive session on a remote computer or virtual machine over a network connection. RDS was first released in 1998 as Terminal Server in Windows NT 4.0 Terminal Server Edition, a stand-alone edition of Windows NT 4.0 Server that allowed users to log in remotely. Starting with Windows 2000, it was integrated under the name of Terminal Services as an optional component in the server editions of the Windows NT family of operating systems, receiving updates and improvements with each version of Windows. Terminal Services were then renamed to Remote Desktop Services with Windows Server 2008 R2 in 2009.

References

  1. 1 2 "What is an Operating System?, Processes". The Linux Tutorial. Archived from the original on 15 August 2020. Retrieved 14 November 2010.
  2. Michele Cyran (December 1993). Oracle Database Concepts, 10g Release 1. Oracle Corporation. B10743-01. Archived from the original on 2 March 2013. Retrieved 12 November 2010.
  3. 1 2 3 Jesus Diaz (8 April 2010). "How Multitasking Works in the New iPhone OS 4.0". Gizmodo. Archived from the original on 2 November 2010. Retrieved 14 November 2010.
  4. 1 2 GNU Bash Reference Manual, Edition 4.1, Job Control Basics. Free Software Foundation, Inc. 23 December 2009. Archived from the original on 3 December 2010. Retrieved 10 November 2010.
  5. "Services overview". Microsoft TechNet . Microsoft. Retrieved 29 March 2013.
  6. "Services". Microsoft Developer Network . Microsoft. Retrieved 29 March 2013.
  7. "New Elevation PowerToys for Windows Vista". TechNet Magazine. Microsoft. June 2008. Retrieved 21 June 2013. The service CmdAsSystem is configured as interactive whose support is being deprecated. The service may not function properly. The problem is that this script tries to create and start an interactive service. Interactive services will not function correctly due to Session 0 Isolation in Windows Vista.
  8. "Services in Windows". MSDN . Microsoft. 18 October 2010. Retrieved 21 June 2013.
  9. Eric S. Raymond (1 October 2004). The Jargon File, version 4.4.8, "daemon". Archived from the original on 3 November 2010. Retrieved 10 November 2010.
  10. raf (12 June 2010). Linux User's Manual, "daemon". Archived from the original on 21 October 2010. Retrieved 10 November 2010.
  11. Åke Nordlund (7 February 2007). "Background Processes in Unix/Linux". Archived from the original on 13 February 2012. Retrieved 10 November 2010.
  12. "POSIX "ps"". IEEE Std 1003.1, 2004 Edition.
  13. 1 2 Matt Buchanan (2010-04-29). "Giz Explains: How Multitasking Works on a Phone". Gizmodo. Archived from the original on 17 October 2010. Retrieved 14 November 2010.