Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

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


Download ppt "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."

Similar presentations


Ads by Google