Process
Concept
Process: A process is a program in
execution. It is more than the program code, which is sometimes known as Text
Section. It also includes the current activity, as represented by the value of
the program counter & the contents of the processor’s register. It includes
process stack, which contains Temporary data (such as function parameters,
return address & local variables) & data section which contains global
variable. It also includes heap, which is memory that is dynamically allocated
during process runtime. A program is a passive entity, such as a file
containing a list of instructions stored on a disk. A process is an active
entity, with a program counter specifying the next instruction to execute &
a set of associated resources. A program becomes a process when an executable
file is loaded into memory.
Two common
techniques:
For
loading executable file
·
Double-clicking
an icon representing the executable file.
·
Entering
the name of the executable files on the command line (As in prog.exe or a.out).
Although two processes may
be associated with the same program, they are nevertheless considered two
separate execution sequenced. The text sections are equivalent, the data, heap
& stack sections vary.
Process
State:
As
a process executes, it changes state. The state of a person is defined in part
by the current activity of that process.
New- The process is being
created.
Running- Instructions are being
executed.
Waiting- Process is waiting for
some event to occur.
Ready- Process is waiting to be
assigned to a processor.
Terminated- Process has finished
execution.
Process
Control Block:
Each
process is represented in the OS by a PCB, also called Task Control Block.
Process State: State may be new, ready,
running, waiting, halted & so on.
Program
Counter:
It indicates the address of next instruction to be executed.
CPU Registers: Registers vary in number
& type. They include accumulators, index registers, stack pointers &
general purpose registers plus any condition code.
CPU
Scheduling Information:
It includes a process priority, pointers to scheduling queues & other
scheduling parameters.
Memory
Management Information:
It includes such items as the value of the base and limit registers & the
page table, or the segment tables, depending on the memory system used by OS.
Accounting
Information:
It includes the amount of CPU & real time used, time limits, account
number, job or process numbers.
I/O Status
Information:
It includes the list of I/O devices allocated to the process, a list of open
files.
THREADS:
A
process is a program that performs a single thread of execution. For example,
when a process running a word-processor program, a single thread of
instructions is being executed. The user cannot simultaneously type in
character & run spell checker within the same process. Process with
multiple threads, perform than one task at a time.
Diagram
showing CPU switch from process to process
No comments:
Post a Comment