0% found this document useful (0 votes)
7 views20 pages

2.0 Process Concept

Uploaded by

Demewoz Deresse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views20 pages

2.0 Process Concept

Uploaded by

Demewoz Deresse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Chapter 2

Process
management

02/04/2025 Bahir Dar University OS(CoSc 1


2034)
2.1 process

02/04/2025 Bahir Dar University OS(CoSc 2


2034)
Contents:
Process concept
Process creation
Process termination
Process state
Process implementation

02/04/2025 Bahir Dar University OS(CoSc 3


2034)
Process concept

• Early systems
– One program at a time was executed and a single program
has a complete control.
• Modern OS allow multiple programs to be loaded in to memory
and to be executed concurrently.
• This requires firm control over execution of programs.
• The notion of process emerged to control the execution of
programs.

02/04/2025 Bahir Dar University OS(CoSc 4


2034)
Process concept con’t…
 Process
 The entity that can be assigned to and executed on a processor

 An activity of some kind which has a program, input, output,

and a state.
 a program in execution; process execution must progress in

sequential fashion
 Conceptually, each process has its own virtual CPU.

 In reality, of course, the real CPU switches back and forth from

process to process.
 Provide the illusion of parallelism, which is some times called

pseudo parallelism.

02/04/2025 Bahir Dar University OS(CoSc 5


2034)
Program Vs Process
• Program
o It is sequence of instructions defined to perform some
task
o It is a passive entity
• Process
o It is a program in execution
o It is an instance of a program running on a computer
o It is an active entity
o A processor performs the actions defined by a process

02/04/2025 Bahir Dar University OS(CoSc 6


2034)
Program Vs Process
 Real life example: Consider a computer scientist who is baking a
birthday cake for her daughter and who is interrupted by her
daughter’s bleeding accident
• Sequence of actions
– Bringing ingredients i.e. flour, sugar, eggs, etc
– Placing the mixture into the oven
– Following the baking processes
– Hearing a cry and analyzing it to be because of bleeding
– Recording baking processes state and switching to provide
first aid service
– Providing first aid service
– Coming back and resuming the baking process

02/04/2025 Bahir Dar University OS(CoSc 7


2034)
Analysis
Processes Baking Cake First Aid
Processor Comp.Scientist Comp Scientist
Program Recipe First Aid Book
Input Ingredients First Aid Kit
Output Cake First Aid Service
States Running, Idle Running, Idle

02/04/2025 Bahir Dar University OS(CoSc 8


2034)
Process creation
o In systems designed for running only a single application, it
may be possible to have all the processes that will ever be
needed be present when the system comes up.
o In general-purpose systems some way is needed to create
processes as needed during operation.
o There are four principal events that cause processes to be
created:
1. System initialization.
2. Execution of a process creation system call by a
running process.
3. A user request to create a new process.
4. Initiation of a batch job.

02/04/2025 Bahir Dar University OS(CoSc 9


2034)
Process creation con’t….
1. System initialization:
 When an operating system is booted, typically several
processes are created.
 These processes can be:
 Foreground processes : processes that interact with
(human) users and perform work for them.
 Background processes: processes which are not
associated with particular users, but instead have some
specific function.
2. Execution of a process creation system call by a running process
 Running process will issue system calls to create one or more
new processes to help it do its job.
 Creating new processes is particularly useful when the work to
be done can easily be formulated in terms of several related,
but otherwise independent interacting processes.
02/04/2025 Bahir Dar University OS(CoSc 10
2034)
Process creation con’t….
3. A user request to create a new process.
 In interactive systems, users can start a program by typing a
command or(double) clicking an icon.
 Taking either of these actions starts a new process and runs the
selected program in it.
4. Initiation of a batch job.
 users can submit batch jobs to the system (possibly remotely).
 When the operating system decides that it has the resources to
run another job, it creates a new process and runs the next job
from the input queue in it.

02/04/2025 Bahir Dar University OS(CoSc 11


2034)
Process termination
o After a process has been created, it starts running and does
whatever its job is.
o However, nothing lasts forever, not even processes.
o Sooner or later the new process will terminate, usually due to one
of the following conditions:
1. Normal exit (voluntary).
2. Error exit (voluntary).
3. Fatal error (involuntary).
4. Killed by another process (involuntary).

02/04/2025 Bahir Dar University OS(CoSc 12


2034)
Process termination(con’t…)
1. Normal exit (voluntary)
o Most processes terminate because they have done their work.
 Example ,When a compiler has compiled the program, it executes a
system call to tell the operating system that it is finished. This call is exit in
UNIX and ExitProcess in Windows
o Screen-oriented programs also support voluntary termination.
 Example Word processors, Internet browsers and similar programs always
have an icon or menu item that the user can click to tell the process to
remove any temporary files it has open and then terminate.
2. Error exit (voluntary)
o The second reason for termination is an error caused by the
process, often due to a program bug.
 Examples include executing an illegal instruction, referencing nonexistent
memory, or dividing by zero.
02/04/2025 Bahir Dar University OS(CoSc 13
2034)
Process termination(con’t…)
3. Fatal error (involuntary)
o A process is terminate if it is discovers a fatal error.
 For example, if a user types the command cc foo.c to compile
the program foo.c and no such file exists, the compiler simply
exits.
4. Killed by another process (involuntary)
o The fourth reason a process might terminate is that the process
executes a system call telling the operating system to kill some
other process.
o In UNIX this call is kill. The corresponding Win32 function is
Terminate Process.

02/04/2025 Bahir Dar University OS(CoSc 14


2034)
Process state
o The process state define the current activity of the process.
o As a process executes, it changes state
o The state in which may in is differ from one system to onather.
o Below we see three states a process may be in:
1. Running : Instructions of program are being executed.
2. Ready: The process is waiting to be assigned to a processor.
3. Blocked :The process is waiting for some event to occur

Bahir Dar University


02/04/2025 15
OS(CoSc2034)
Process state(con’t…)
o Four transitions are possible among these three states.
 Transition 1:Process blocks for an event to occur.
 Transition 2:Scheduler picks another process to have CPU time.
 Transition 3:Scheduler picks first process get the CPU to run
again
 Transition 4:event becomes occurred to awakened for blocked
process.

Bahir Dar University


02/04/2025 16
OS(CoSc2034)
Process implementation
o To implement the process model, the operating system maintains
a table (an array of structures), called the process table, with one
entry per process.
o these entries process control blocks(PCB) also called task control
block.
 PCB Contains information associated with each process.
1. Process state:- can be ready, running, waiting, and etc.
2. Program counter:- indicates the address of the next instruction
to be executed.
3. CPU registers:- includes general-purpose registers, stack
Pointers, index registers and accumulators.

Bahir Dar University


02/04/2025 17
OS(CoSc2034)
Process implementation
4. Memory-management information:- includes the value of base
and limit register. The information is useful for reallocating the
memory when the process terminates.
5. CPU scheduling information:- includes the CPU scheduling
information for each and every process(Eg. process priorities,
pointers to scheduling queues, etc.
6. Accounting information:- includes the amount of CPU and real
time used, time limits, job or process numbers, account
numbers etc.
7. I/O status information:- includes list of opened files
8. Event information:- for a process in the blocked (wait) state this
field contains information concerning the event for which the
process is waiting.
Bahir Dar University
02/04/2025 18
OS(CoSc2034)
Any Questions?

02/04/2025 Bahir Dar University OS(CoSc 19


2034)
Tha
n k yo
u!!
!

02/04/2025 Bahir Dar University OS(CoSc 20


2034)

You might also like