What is a process?
A process can be thought of as a program in execution. A process will need certain resources- such as CPU time, memory, files, and I/O devices – to accomplish its task. These recourses are allocated to the process either when it is created or while it is executing.
A process is the unit of work in modern time-sharing system. A process is more than program code, which is sometimes known as the text section. It also includes the current activity, as represented by the value of the program counter and contents of the processor’s registers. A process generally also includes the process task, which contains temporary data (such as function parameters, return addresses, and local variables), and the data section, which contains global variables. A process may also contain heap, which is memory that is dynamically allocated during process run time.
A program becomes a process when an executable file is loaded into memory.
Process State
As a process executes, it changes state. The state of a process is defined in part by the current activity of that process. Each process may be in one of the following states:
- New: The process is being created
- Running: The instructions are being executed
- Waiting The process is waiting for some event to occur( such as completion of I/O or reception of a signal)
- Ready The process is waiting to be assigned to processor
- Terminated The process has finished execution
It is important to realize that only one process can be running on any processor at any instant.
Process Control Block
Each process is represented in the operating system by a process control block(PCB) – also called a task control block
Context Switch
Switching the CPU to another process requires performing a state save of the current process and a state restore of a different process. This task is known as context switch. When a context switch occurs, the kernel saves the context of the old process in its PCB and loads the saved context of the new process scheduled to run.
Thread
Is generally defined as fundamental unit of CPU utilization.