ch3 - Process
ch3 - Process
Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018
Objecti
ves
To introduce the notion of a
process -- a program in execution,
which forms the basis of all
computation
including
To describescheduling,
the variouscreation
features of
processes, and communication
and
termination,
To describe
communication in client-
server systems
• https://www.youtube.com/watch?v=7FRW4iGjLrc&list=P
LmbPuZ0NsyGS8ef6zaHd2qYylzsHxL63x&index=4
Global variables
Difference
in size and
content
Difference in
size and
content
Difference
content program
counter
Operating System Concepts – program 3.7 Silberschatz, Galvin and
Process
State
As a process executes, it
changes state
new: The process is being
created
momentary
running: Instructions
states
Short-
term
Long-term schedul
scheduler er
What is
fork?
A tree of processes on a
typical Solaris
Operating System Concepts – 3. Silberschatz, Galvin and
Process Creation
Execution (Cont)
Parent and children execute concurrently
Parent waits until children terminate
Address space
Child address is duplicate of parent – same program and
data
Child has a new program loaded into it (different from the
parent’s program)
UNIX examples
fork system call creates new process
Parent’s address space is duplicated
Both processes resume execution at the instruction
after the fork()
exec system call used after a fork to replace the process’
memory space with a new program
Wait() – takes the process out o f the ready queue
Operating System Concepts – 3.
Process
• Creation
Both processes (the parent and the child) continue execution at the instruction after
the fork(), with one difference: the return code for the fork() is zero for the new
(child) process, whereas the (nonzero) process identifier of the child is returned to
the parent.
• The parent can then create more children; or, if it has nothing else to do while
the child runs, it can issue a wait() system call to move itself off the ready
queue until the termination of the child
Operating System Concepts – 10th Edition 3.28 Silberschatz, Galvin and Gagne ©2018
Interprocess
Communication
Processes within a system may be independent or
cooperating
Independent processes cannot affect or be affected by other
running processes
Cooperating processcan affect or be affectedby other
processes, including sharing data
This scheme exhibits symmetry in addressing; that is, both the sender
process and the receiver process must name the other to communicate.
Operating System Concepts – 10th Edition 3.35 Silberschatz, Galvin and Gagne ©2018
Indirect
Messages Communication
are sent and received from
mailboxes (also referred to as ports)
Each mailbox has a unique id
Processes can communicate only if they share a mailbox
Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018