AAchapter4 Schedulers
AAchapter4 Schedulers
An interrupt occurs
Cont…
• Running process may become suspended if
it makes an I/O request. Suspended
processes cannot make any progress
towards completion.
• In this condition, to remove the process from
memory and make space for other process,
the suspended process is moved to the
secondary storage.
Cont..
• This process is called swapping, and the
process is said to be swapped out or rolled
out. Swapping may be necessary to improve
the process mix.
3.4 Operations on Processes
Process Creation
• Parent process creates children processes, which, in
turn create other processes, forming a tree of
processes
• Resource sharing options
– Parent and children share all resources
– Children share subset of parent’s resources
– Parent and child share no resources
• Execution options
– Parent and children execute concurrently
– Parent waits until some or all of its children
have terminated
Process Creation (Cont.)
• Address space options
– Child process is a duplicate of the parent
process (same program and data)
– Child process has a new program loaded
into it
• UNIX example
– fork() system call creates a new process
– exec() system call used after a fork() to
replace the memory space of the process
with a new program
Process Termination
• Process executes last statement and asks the operating
system to terminate it (via exit)
– Exit (or return) status value from child is received by
the parent (via wait())
– Process’ resources are deallocated by the operating
system
• Parent may terminate execution of children processes (kill()
function)
– Child has exceeded allocated resources
– Task assigned to child is no longer required
– If parent is exiting
Some operating systems do not allow a child to
continue if its parent terminates
3.4 Interprocess Communication
Cooperating Processes
• An independent process is one that cannot affect or be
affected by the execution of another process
• A cooperating process can affect or be affected by the
execution of another process in the system
Advantages of process cooperation
– Information sharing (of the same piece of data)
– Computation speed-up (break a task into smaller
subtasks)
– Modularity (dividing up the system functions)
– Convenience (to do multiple tasks simultaneously)
Cont…
• Two fundamental models of interprocess
communication
– Shared memory (a region of memory is
shared)
– Message passing (exchange of messages
between processes)
Inter Process Communication (IPC)
• Inter Process Communication (IPC) refers to a
mechanism, where the operating systems allow
various processes to communicate with each
other.
• This involves synchronizing their actions and
managing shared data.
Communications Models