O.s's Role in Running Programs
O.s's Role in Running Programs
O.s's Role in Running Programs
The operating system acts as an interface between an application and the hardware. The user
interacts with the hardware from "the other side". The operating system is a set of services
which simplifies development of applications. Executing a program involves the creation of a
process by the operating system. The kernel creates a process by assigning memory and other
resources, establishing a priority for the process (in multi-tasking systems), loading program
code into memory, and executing the program. The program then interacts with the user
and/or other devices and performs its intended function.
Process :
a process is an instance of a computer 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 multiple threads of execution that execute instructions concurrently
Computer Program :
A computer program is a passive collection of instructions, 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.
Process states :
An operating system kernel that allows multi-tasking needs processes to have certain states.
1 - First, the process is "created" - it is loaded from a secondary storage device (hard disk or
CD-ROM) into main memory. After that the process scheduler assigns it the state "waiting".
2 - 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.
3 - If a process needs to wait for a resource (wait for user input or file to open ...), it is assigned
the "blocked" state. The process state is changed back to "waiting" when the process no
longer needs to wait.
Representation :
In general, a computer system process consists of the following resources:
2 - A 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.
3 - 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.
4 - Security attributes, such as the process owner and the process' set of permissions
(allowable operations).
5 - Processor state, such as the content of registers, physical memory addressing, etc. The
state is typically stored in computer registers when the process is executing, and in memory
otherwise
The operating system holds most of this information about active processes in data structures
called process control blocks.Any subset of resources, but typically at least the processor state,
may be associated with each of the process' threads in operating systems that support threads
or 'daughter' processes.
The operating system keeps its processes separated and allocates the resources they need so
that they are less likely to interfere with each other and cause system failures. The operating
system may also provide mechanisms for inter-process communication to enable processes to
interact in safe and predictable ways.