operating system processes
operating system processes:- In computing, a process is an instance of a computer program that is being executed. It contains the program code and its activity. While 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 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 task at a time. A common form of multitasking is time-sharing. Time-sharing is a method to allow high responsiveness for interactive user applications.
operating system processes
This section describes process, process states and process control block (PCB).
A process is a program in execution. The execution of a process must progress in a sequential fashion. Definition of process is following.
- A process is defined as an entity which represents the basic unit of work to be implemented in the system.
- Components of a process are following.
A program by itself is not a process. It is a static entity made up of program statement while process is a dynamic entity. Program contains the instructions to be executed by processor. A program takes a space at single place in main memory and continues to stay there. A program does not perform any action by itself.
As a process executes, it changes state. The state of a process is defined as the current activity of the process. Process can have one of the following five states at a time.
Process Control Block, PCB:-
Each process is represented in the operating system by a process control block (PCB) also called a task control block. PCB is the data structure used by the operating system. Operating system groups all information that needs about particular process. PCB contains many pieces of information associated with a specific process which is described below.
This section describes process scheduling, scheduling queues and various types of process schedulers.
The process scheduling is the activity of the process manager that handles the removal of the running process from the CPU and the selection of another process on the basis of a particular strategy. Process scheduling is an essential part of a Multi programming operating system. Such operating systems allow more than one process to be loaded into the executable memory at a time and loaded process shares the CPU using time multiplexing.
Scheduling queues refers to queues of processes or devices. When the process enters into the system, then this process is put into a job queue. This queue consists of all processes in the system. The operating system also maintains other queues such as device queue. Device queue is a queue for which multiple processes are waiting for a particular I/O device. Each device has its own device queue.
This figure shows the queuing diagram of process scheduling.
- Queue is represented by rectangular box.
- The circles represent the resources that serve the queues.
- The arrows indicate the process flow in the system.
Queues are of two types:-
- Ready queue
- Device queue
A newly arrived process is put in the ready queue. Processes waits in ready queue for allocating the CPU. Once the CPU is assigned to a process, then that process will execute. While executing the process, any one of the following events can occur.
- The process could issue an I/O request and then it would be placed in an I/O queue.
- The process could create new sub process and will wait for its termination.
- The process could be removed forcibly from the CPU, as a result of interrupt and put back in the ready queue.
Two State Process Model:-
Two state process models refer to running and non-running states which are described below.
Schedulers are special system software which handles process scheduling in various ways. Their main task is to select the jobs to be submitted into the system and to decide which process to run. Schedulers are of three types
- Long Term Scheduler
- Short Term Scheduler
- Medium Term Scheduler
Long Term Scheduler:-
It is also called job scheduler. Long term scheduler determines which programs are admitted to the system for processing. Job scheduler selects processes from the queue and loads them into memory for execution. Process loads into the memory for CPU scheduling. The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It also controls the degree of multi programming. If the degree of multi programming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system.
On some systems, the long term scheduler may not be available or minimal. Time-sharing operating systems have no long term scheduler. When process changes the state from new to ready, then there is use of long term scheduler.
Short Term Scheduler:-
It is also called CPU scheduler. Main objective is increasing system performance in accordance with the chosen set of criteria. It is the change of ready state to running state of the process. CPU scheduler selects process among the processes that are ready to execute and allocates CPU to one of them.
Short term scheduler also known as dispatcher, execute most frequently and makes the fine grained decision of which process to execute next. Short term scheduler is faster than long term scheduler.
Medium Term Scheduler:-
Medium term scheduling is part of the swapping. It removes the processes from the memory. It reduces the degree of multi programming. The medium term scheduler is in-charge of handling the swapped out-processes.
Running process may become suspended if it makes an I/O request. Suspended processes cannot make any progress towards completion. In this condition, to remove the process from memory and make space for other process, the suspended process is moved to the secondary storage. This process is called swapping, and the process is said to be swapped out or rolled out. Swapping may be necessary to improve the process mix.
I hope that you understand my post. if you like this post then share my post, and comment on my post if you have any suggestion or Queries related to operating system processes. Thank you!