Download presentation
Presentation is loading. Please wait.
Published byBridget Barker Modified over 5 years ago
1
What is a Thread? A thread is similar to a process, but it typically consists of just the flow of control. Multiple threads use the address space of a single process. The complete name is: Thread of Execution
2
The Thread Model (a) Three processes each with one thread
(b) One process with three threads
3
The Thread Model Items shared by all threads in a process
Items private to each thread
4
Each thread has its own stack
The Thread Model Each thread has its own stack
5
A word processor with three threads
Why Do We Use Threads? To simplify programs in which multiple activities go on at once. Easier to create and destroy because they have no resources attached to them - they share common memory. Performance gain, when there is substantial amounts of both computing and I/O. A word processor with three threads
6
A multithreaded Web server
7
Rough outline of code for web server
(a) Dispatcher thread (b) Worker thread
8
Three ways to construct a server
9
Implementing Threads in User Space
A user-level threads package
10
Implementing Threads in the Kernel
A threads package managed by the kernel
11
Hybrid Implementations
Multiplexing user-level threads onto kernel- level threads
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.