Oslecture3 4
Oslecture3 4
Operating Systems
Lectures 3 and 4 - Processes and Threads
Prof. Nalini Venkatasubramanian
[email protected]
Outline
Process Concept
Process Scheduling
Operations on Processes
Cooperating Processes
Threads
Interprocess Communication
Process Concept
new admitted
new exit terminated
interrupt
running
ready
Scheduler
I/O or dispatch
event I/O or
completion event wait
waiting
Process States
Device
Queue
Ready
Queue
Process Scheduling Queues
Schedulers
Long-term scheduler (or job scheduler) -
selects which processes should be brought into the ready
queue.
invoked very infrequently (seconds, minutes); may be slow.
controls the degree of multiprogramming
Short term scheduler (or CPU scheduler) -
selects which process should execute next and allocates
CPU.
invoked very frequently (milliseconds) - must be very fast
Medium Term Scheduler
swaps out process temporarily
balances load for better throughput
Medium Term (Time-sharing)
Scheduler
Process Profiles
Resource sharing
Parent and children share all resources.
Children share subset of parent’s resources - prevents
many processes from overloading the system.
Parent and children share no resources.
Execution
Parent and child execute concurrently.
Parent waits until child has terminated.
Address Space
Child process is duplicate of parent process.
Child process has a program loaded into it.
UNIX Process Creation
Resource Sharing
Economy
Utilization of MP Architectures
Threads(Cont.)
Examples
Windows XP/2000
Solaris
Linux
Tru64 UNIX
Mac OS X
Mach, OS/2
Multithreading Models
Many-to-One
One-to-One
Many-to-Many
Many-to-One
processes?
How many links can there be between every pair
of communicating processes?
What is the capacity of a link?
…….
Direct Communication