4003-440-02 Operating Systems I
Module 2. Process Management -- Lecture Notes
Prof. Alan Kaminsky -- Winter Quarter 2012
Rochester Institute of Technology -- Department of Computer Science
Processes and Threads
- Thread
- "Thread of execution" -- why is it called a "thread"?
- Resources associated with a thread
- CPU registers (PC, SP, etc.)
- Code (text)
- Data
- Stack
- Heap
- OS resources (e.g. files)
- Process
- A group of threads sharing certain resources
- Resources shared by all threads in a process
- Code (text)
- Global data
- Heap
- OS resources (e.g. files)
- Resources private to each thread in a process
- CPU registers (PC, SP, etc.)
- Thread local data
- Stack
- Threads (within one process) = Same address space
- Processes = Different address spaces
Process and Thread Scheduling
- Mapping of user threads to kernel threads
- One-to-one model -- used by most modern OSes
- Many-to-one model -- historical relict (e.g. Green Threads)
- Many-to-many model
- Thread state diagram
- Thread scheduling queues
- Ready queue
- Wait queues
- I/O completion
- Timer
- Thread coordination
- Thread termination
- Child process termination
- Etc.
- Thread scheduling on a single processor
- Task control block (TCB)
- Context switching
- Multiple threads pattern of execution
- Thread scheduling on a multiprocessor
- Multiple threads pattern of execution
Thread Coordination
- Threads (within a process) can communicate "for free" -- shared memory (same address space)
- Thread coordination
- Exclusive access to shared data
- Read or write access to shared data
- Waiting for another thread to perform some action
Interprocess Communication
- Different processes cannot communicate "for free" -- different address spaces
- IPC via shared memory
- Map the same region of physical memory into the address spaces of multiple processes
- Doesn't make much sense nowadays -- just use threads
- IPC via message passing
- One process explicitly sends a message, another process explicitly receives the message
- Nowadays it usually makes more sense to use . . .
- IPC via networking protocols
- TCP sockets, UDP datagrams
- Works between processes in the same computer (localhost) and between processes in different computers
- Same software works on all architectures from single processor to distributed system
- Platform independent software (Java)
- IPC via remote procedure call (RPC)
- IPC via remote method invocation (RMI)
- CORBA
- Java RMI
- Microsoft .NET remoting
|
Operating Systems I
|
|
•
|
|
4003-440-02
|
|
•
|
|
Winter Quarter 2012
|
|
Course Page
|
|
Alan Kaminsky
|
|
•
|
|
Department of Computer Science
|
|
•
|
|
Rochester Institute of Technology
|
|
•
|
|
4486 +
2220 =
6706
|
|
Home Page
|
Copyright © 2008 Alan Kaminsky.
All rights reserved.
Last updated 27-Aug-2008.
Please send comments to ark@cs.rit.edu.
|