0% found this document useful (0 votes)
64 views27 pages

Operating Systems: Processes

College of Computer Studies Process Control Block 1. 2. 3. 4. 5. 6. 7. Process State Accounting Information CPU Registers Accounting Information memory Management Information I / O Status Information Copyright(c) De La Salle University Professional Schools, Inc.

Uploaded by

kat5t
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views27 pages

Operating Systems: Processes

College of Computer Studies Process Control Block 1. 2. 3. 4. 5. 6. 7. Process State Accounting Information CPU Registers Accounting Information memory Management Information I / O Status Information Copyright(c) De La Salle University Professional Schools, Inc.

Uploaded by

kat5t
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 27

Operating Systems

Processes
Process Concept
An operating system executes a variety
of programs:
 Batch system – jobs
 Time-shared systems – user programs or
tasks
Process – a program in execution;
process execution must progress in
sequential fashion.
A process includes:
 program counter
 stack

data Inc. section


CopyrightDe La Salle University
Professional Schools,
OS Slides – ccsmwt, ccspc, ccsejc
College of Computer Studies
Process State

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Process Control Block
1. Process State
2. Program Counter
3. CPU Registers
4. Accounting Information
5. CPU Scheduling Information
6. Memory Management Information
7. I/O Status Information

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Scheduling Queue
Job Queue – consists of all
processes in the system
Ready Queue – list where
processes which are ready and
waiting to execute are kept
Device Queue – list where
processes waiting for a particular
I/O device are kept

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Ready and Device Queues

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Queuing Diagram

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Schedulers

Long term – determines which jobs are


admitted into the memory for processing
Short term – selects from among the jobs in
memory which are ready to execute and
allocates the CPU to one of them
Medium term – an intermediate level queue
used in systems with virtual memory or
timesharing

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Schedulers (cont.)
Short-term scheduler is invoked very
frequently (milliseconds) ⇒ (must be fast).
Long-term scheduler is invoked very
infrequently (seconds, minutes) ⇒ (may be
slow).

The long-term scheduler controls the


degree of multiprogramming.

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Medium Term Scheduling

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Scheduler Activities
Swapping – in some other time, the
process can be reintroduced and
continued where it left off
Context Switch – switching the CPU
from one process to another
Dispatcher – a module that
gives control of the CPU to
the process selected by the
short term scheduler
Copyright De La Salle University
Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
CPU Switching

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Program Layout in Memory

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Execution Traces
Process A Process B Process C
A1 B1 C1
A2 B2 C2
A3 B3 C3
A4 B4 C4
A5 B5 C5
A6 C6
C7
C8
Copyright De La Salle University
Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Sample Execution

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Suspended Processes
Processor is faster than I/O so all
processes could be waiting for I/O
Swap these processes to disk to
free up more memory
Waiting or blocked state becomes
suspend state when swapped to
disk
Two new states
 Blocked, suspend
 Ready, suspend
Copyright De La Salle University
Professional Schools, Inc.
OS Slides – ccsmwt, ccspc, ccsejc
College of Computer Studies
One Suspend State

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Two Suspend State

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Additional States
Ready – process in main memory and
available for execution
Blocked/Waiting – process in main
memory and awaiting an event
Blocked/Suspend – process in secondary
memory and awaiting an event
Ready/Suspend – process in secondary
memory and available for execution

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
UNIX Process States

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
UNIX Process States

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Process Creation
Parent process create children
processes, which, in turn create
other processes, forming a tree of
processes.
Resource sharing
 Parent and children share all
resources.
 Children share subset of parent’s
resources.
Copyright De La Salle University

Parent and child shareOSno resources.


Professional Schools, Inc.

College of Computer Studies
Slides – ccsmwt, ccspc, ccsejc
Process Creation (cont.)
Execution
 Parent and children execute
concurrently.
 Parent waits until children terminate.
Address space
 Child duplicate of parent
 Child has a program loaded into it

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Process Creation (cont.)
UNIX examples
 fork system call creates new process
 exec system call used after a fork
replaces the process’ memory space
with a new program

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Process Tree on UNIX
System

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Process Termination
Process executes last statement
and asks the operating system to
delete it (exit)
 Output data from child to parent
(via wait)
 Process’ resources are deallocated by
OS

Copyright De La Salle University


Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc
Process Termination
Parent may terminate execution of
children processes (abort)
 Child has exceeded allocated
resources
 Task assigned to child is no longer
required
 Parent is exiting
 OS does not allow child to continue
if parent terminates
Copyright De La Salle University
 Cascading termination
Professional Schools, Inc.
College of Computer Studies
OS Slides – ccsmwt, ccspc, ccsejc

You might also like