what is process and process state in operating system.?

what is process and process state in operating system.?


Introduction to Process

A process is a program in execution.
A process is the unit of work in a system. A process is an active entity as opposed to the program
which is considered to be a passive entity. Such a system consists of a collection of
concurrently executing processes, some of which are operating-system processes (those that
execute system code) and the rest of which are user processes (those that execute user code).
The process will need certain resources—such as CPU time, memory, files, and I/O devices to
accomplish its task. These resources are allocated to the process either when it is created or
while it is executing.

Process memory is divided into four sections for efficient working:


1. The text section is made up of the compiled program code, read in from non-volatile
storage when the program is launched.
2. The data section is made up of the global and static variables, allocated and initialized
before executing the main.
3. The heap is used for the dynamic memory allocation and is managed via calls to new,
delete, malloc, free, etc.
4. The stack is used for local variables. Space on the stack is reserved for local variables
when they are declared.
The structure of a process in memory is shown in Figure

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:

 1.  New: The process is being created.
 2.  Ready: Ready processes are waiting to have the processor allocated to them by the
operating system so that they can run.
 3.  Running: The process that is currently being executed.
 4.  Waiting or Blocked: The process is waiting for some event to occur (such as an I/O
completion). (A process can block itself, but not “run” itself)
  Terminated: The process has finished execution. (a process that has been released from the pool)

Whenever processes change state, the operating system reacts by placing the process PCB in
the list that corresponds to its new state. Only one process can be running on any processor at
any instant and many processes may be a ready and waiting state.

Comments