Content deleted Content added
mNo edit summary |
A multiprogramming or multitasking O.S. is a Operating System that can execute many processes concurrently. Added Operating before system for disambiguition. |
||
(20 intermediate revisions by 14 users not shown) | |||
Line 2:
{{OS}}
A process is a program in execution, and an integral part of any modern-day [[operating system]] (OS). The OS must allocate resources to [[process (computing)|processes]], enable processes to share and exchange information, protect the resources of each process from other processes and enable synchronization among processes. To meet these requirements,
== Multiprogramming ==
In any modern operating system, there can be more than one instance of a [[computer program|program]] loaded in memory at the same time. For example, more than one user
A [[multiprogramming]] or [[Computer multitasking|multitasking]]
There are two
# The process issues a [[system call]] (sometimes called a ''software [[interrupt]]''); for example, an I/O request occurs requesting to access a file on a hard disk.
Line 17:
==How multiprogramming increases efficiency==
A common trait observed among processes associated with most computer programs is that they alternate between [[CPU]] cycles and [[I/O]] cycles. For the portion of the time required for CPU cycles, the process is being executed
: ''t''<sub>uni</sub> = ''t''<sub>1</sub> + ''t''<sub>2</sub> + ... + ''t''<sub>''N''</sub>.
Line 91:
At any instant, a process is in one and only one of the three states. For a single processor computer, only one process can be in the ''RUNNING'' state at any one instant. There can be many processes in the ''READY'' and ''BLOCKED'' states, and each of these states will have an associated queue for processes.
Processes entering the system must go initially into the ''READY'' state, and processes can only enter the ''RUNNING'' state via the ''READY'' state. Processes normally leave the system from the ''RUNNING'' state. For each of the three states, the process occupies space in the main memory. While the reason for most transitions from one state to another might be obvious, some may not be so clear.
* '''''RUNNING → READY:''''' The most common reason for this transition is that the running process has reached the maximum allowable time for uninterrupted execution; i.e. time-out occurs. Other reasons can be the imposition of priority levels as determined by the [[scheduling (computing)|scheduling]] policy used for the Low Level [[Scheduling (computing)|Scheduler]], and the arrival of a higher priority process into the READY state.
* '''''RUNNING → BLOCKED:''''' A process is put into the ''BLOCKED'' state if it requests something for which it must wait. A request to the OS is usually in the form of a system call, (i.e. a call from the running process to a function that is part of the OS code). For example, a process might become ''BLOCKED'' if it is requesting a file from disk or a saving a section of code or data from memory to a file on disk.
== Process description and control ==
Line 112:
Contemporary [[Processor (computing)|processors]] incorporate a mode bit to define the execution capability of a program in the processor. This bit can be set to ''[[kernel mode]]'' or ''[[user mode]]''. Kernel mode is also commonly referred to as ''[[supervisor mode]]'', ''monitor mode'' or ''[[ring 0 (computer security)|ring 0]]''.
In kernel mode, the processor can execute every instruction in its hardware repertoire, whereas in user mode, it can only execute a subset of the instructions. Instructions that can be executed only in kernel mode are called kernel, privileged, or protected instructions to distinguish them from the user mode instructions. For example, [[I/O]] instructions are privileged.
== The Kernel system concept ==
The critical parts of the [[operating system|OS]] run in [[kernel mode]], while other [[software]] (such as system utilities and application programs) run in [[user mode]]. This serves as the fundamental distinction between the OS and other [[system software]]. The part of the system executing in the kernel mode is called the [[kernel (computer science)|kernel]], or nucleus, of the OS. The kernel is designed as trusted software, meaning it implements protection mechanisms that cannot be covertly modified by untrusted software running in user mode. Extensions to the OS operate in [[user mode]], so the core functionality of the OS does not depend on these extensions for its correct operation.
A key design decision for any OS function is determining whether it should be implemented in the kernel. If implemented in the kernel, it operates in kernel mode, gaining access to other parts of the kernel and being trusted by them. Conversely, if the function executes in [[user mode]], it lacks access to kernel data structures but requires minimal effort to invoke. Although functions implemented in the kernel can be straightforward, the [[trap (computing)|trap mechanism]] and authentication process required during the call can be relatively resource-intensive. While the kernel code itself runs efficiently, the overhead associated with the call can be significant. This is a subtle but important distinction.
== Requesting system services ==
Line 123 ⟶ 126:
* [[Message passing]]
[[Operating systems]] are designed with one or the other of these two facilities, but not both. First, assume that a [[user mode|user process]] wishes to invoke a particular target system function. For the [[system call]] approach, the user process uses the trap instruction. The idea is that the system call should appear to be an ordinary procedure call to the application program; the [[operating system|OS]] provides a library of user functions with names corresponding to each actual system call. Each of these stub functions contains a trap to the OS function. When the application program calls the stub, it executes the trap instruction, which switches the [[CPU]] to [[kernel mode]], and then branches (indirectly through an OS table{{Technical inline|date=November 2023}}), to the entry point of the function which is to be invoked. When the function completes, it switches the processor to [[user mode]] and then returns control to the user process
In the [[message passing]] approach, the user process constructs a message
The distinction between the two approaches has important consequences regarding the
== See also ==
Line 142 ⟶ 145:
* Process Management Models, Scheduling, UNIX System V Release 4:
* Modern Operating Systems, Andrew Tanenbaum, Prentice Hall, (2nd Edition, 2001).
* Operating System Concepts, Silberschatz & Galvin & Gagne (
{{Operating System}}
|