19-12-2012, 02:50 PM
Processes and Threads
Processes and Threads.ppt (Size: 380.5 KB / Downloads: 168)
Processes: Review
Multiprogramming versus multiprocessing
Kernel data structure: process control block (PCB)
Each process has an address space
Contains code, global and local variables..
Process state transitions
Uniprocessor scheduling algorithms
Round-robin, shortest job first, FIFO, lottery scheduling, EDF
Performance metrics: throughput, CPU utilization, turnaround time, response time, fairness
Process Scheduling
Priority queues: multiples queues, each with a different priority
Use strict priority scheduling
Example: page swapper, kernel tasks, real-time tasks, user tasks
Multi-level feedback queue
Multiple queues with priority
Processes dynamically move from one queue to another
Depending on priority/CPU characteristics
Gives higher priority to I/O bound or interactive tasks
Lower priority to CPU bound tasks
Round robin at each level
Why use Threads
Large multiprocessors need many computing entities (one per CPU)
Switching between processes incurs high overhead
With threads, an application can avoid per-process overheads
Thread creation, deletion, switching cheaper than processes
Threads have full access to address space (easy sharing)
Threads can execute in parallel on multiprocessors
Multi-threaded Clients Example : Web Browsers
Browsers such as IE are multi-threaded
Such browsers can display data before entire document is downloaded: performs multiple simultaneous tasks
Fetch main HTML page, activate separate threads for other parts
Each thread sets up a separate connection with the server
Uses blocking calls
Each part (gif image) fetched separately and in parallel
Advantage: connections can be setup to different sources
Ad server, image server, web server…