written 8.0 years ago by | • modified 8.0 years ago |
Mumbai University > Information Technology > Sem 5 > Operating System
Marks: 6M
Year: May 2016
written 8.0 years ago by | • modified 8.0 years ago |
Mumbai University > Information Technology > Sem 5 > Operating System
Marks: 6M
Year: May 2016
written 8.0 years ago by |
A process is basically a program in execution. The execution of a process must progress in a sequential fashion. A process is defined as an entity which represents the basic unit of work to be implemented in the system. To put it in simple terms, we write our computer programs in a text file and when we execute this program, it becomes a process which performs all the tasks mentioned in the program. When a program is loaded into the memory and it becomes a process, it can be divided into four sections ─ stack, heap, text and data. The following image shows a simplified layout of a process inside main memory −
S.N. | Component & Description |
---|---|
1 | Stack,The process Stack contains the temporary data such as method/function parameters, return address and local variables. |
2 | Heap,This is dynamically allocated memory to a process during its run time. |
3 | Text,This includes the current activity represented by the value of Program Counter and the contents of the processor's registers. |
4 | Data,This section contains the global and static variab |
Created
Ready and waiting
Running
A process moves into the running state when it is chosen for execution. The process's instructions are executed by one of the CPUs (or cores) of the system. There is at most one running process per CPU or core. A process can run in either of the two modes, namely kernel mode or user mode
Kernel mode
User mode
Blocked
A process that is blocked on some event (such as I/O operation completion or a signal), may be blocked due to various reasons, such as exhausting its CPU time allocation or waiting for an event to occur.
Terminated
A process may be terminated, either from the "running" state by completing its execution or by explicitly being killed. In either of these cases, the process moves to the "terminated" state. The underlying program is no longer executing, but the process remains in the process table as a zombie process until its parent process calls the waitsystem call to read its exit status, at which point the process is removed from the process table, finally ending the process's lifetime. If the parent fails to call wait, this continues to consume the process table entry (concretely the process identifier or PID), and causes a resource leak.