Processes
Processes
A process is a program in execution.
A process is just an instance of an executing program,
including the current values of the program counter, registers,
and variables.
Conceptually, each process has its own virtual CPU.
In reality, the real CPU switches back and forth from process
to process.
This rapid switching back and forth is called
multiprogramming.
Process
A process has the program code, which is
known as the text section.
Process also includes the current activity, as
represented by the value of the program
counter and the contents of the processor’s
registers.
A process generally also includes the process
stack, which contains temporary data (such
as function parameters, return addresses, and
local variables), Data section, which contains
global variables.
A process may also include a heap, which is
memory that is dynamically allocated during
process run time.
Process Model
a) Multiprogramming of four programs.
(b) Conceptual model of four independent, sequential processes.
(c) Only one program is active at once
Process States
New : The process is being created.
Running: Instructions are being executed.
Waiting : The process is waiting for some event to occur (such
as an I/O completion or reception of a signal).
Ready : The process is waiting to be assigned to a processor.
Terminated : The process has finished execution.
Process States
A Five-State Model
New
Running
Waiting(Blocked)
Ready
Terminated(Exit)
1.Start/ New
This is the initial state when a process is first started/created.
2 Ready
The process is waiting to be assigned to a processor. Ready processes are
waiting to have the processor allocated to them by the operating system so that
they can run. Process may come into this state after Start state or while running
it, but interrupted by the scheduler to assign CPU to some other process
Process States
3 Running
Once the process has been assigned to a processor by the OS scheduler,
the process state is set to running and the processor executes its
instructions.
4 Waiting
Process moves into the waiting state if it needs to wait for a resource,
such as waiting for user input, or waiting for a file to become available.
5 Terminated or Exit
Once the process finishes its execution, or it is terminated by the
operating system, it is moved to the terminated state.