0% found this document useful (0 votes)
30 views

Chapter 4: Multithreaded Programming Week 6 08.03.2011

Uploaded by

Touseef Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Chapter 4: Multithreaded Programming Week 6 08.03.2011

Uploaded by

Touseef Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Chapter 4: Multithreaded

Programming
Week 6
08.03.2011

Operating System Concepts – 8th Edition, Silberschatz, Galvin and Gagne ©2009
Outline For Today
 Process and threads
 Single and Multithreads
 Benefits and issue regarding Multithreading
 Multi threading on Single and multicore system
 Multithread Model

Operating System Concepts – 8th Edition 4.2 Silberschatz, Galvin and Gagne ©2009
Process and Threads
 Processes are typically independent, while threads exist as subsets of a
Process
 Processes carry considerable STATE information, whereas multiple
threads within a process share state as well as MEMORY and other
RESURCES
 Processes have separate ADDRESS SPACES, whereas threads share
their address space
 CONTEXT SWITCHING between threads in the same process is typically
faster than context switching between processes.

Operating System Concepts – 8th Edition 4.3 Silberschatz, Galvin and Gagne ©2009
Single and Multithreaded Processes

Operating System Concepts – 8th Edition 4.4 Silberschatz, Galvin and Gagne ©2009
Benefits

 Responsiveness

 Resource Sharing

 Economy

 Scalability

Operating System Concepts – 8th Edition 4.5 Silberschatz, Galvin and Gagne ©2009
Multicore Programming
 Multicore systems putting pressure on programmers, challenges include
 Dividing activities
 Balance
 Data splitting
 Data dependency
 Testing and debugging

Operating System Concepts – 8th Edition 4.6 Silberschatz, Galvin and Gagne ©2009
Multithreaded Server Architecture

Operating System Concepts – 8th Edition 4.7 Silberschatz, Galvin and Gagne ©2009
Execution on a Single-core and multicore System

Operating System Concepts – 8th Edition 4.8 Silberschatz, Galvin and Gagne ©2009
Threads
 User threads
 Thread management done by user-level threads library
 Kernel threads
 Supported by the Kernel

 Basic thread libraries:


 POSIX Threads
 Win32 threads
 Java threads

Operating System Concepts – 8th Edition 4.9 Silberschatz, Galvin and Gagne ©2009
Multithreading Models
 Many-to-One

 One-to-One

 Many-to-Many

Operating System Concepts – 8th Edition 4.10 Silberschatz, Galvin and Gagne ©2009
Many-to-One
 Many user-level threads mapped to single kernel thread
 Examples:
 Solaris Green Threads
 GNU Portable Threads

Operating System Concepts – 8th Edition 4.11 Silberschatz, Galvin and Gagne ©2009
Many-to-One Model

Operating System Concepts – 8th Edition 4.12 Silberschatz, Galvin and Gagne ©2009
One-to-One
 Each user-level thread maps to kernel thread
 Examples
 Windows NT/XP/2000
 Linux
 Solaris 9 and later

Operating System Concepts – 8th Edition 4.13 Silberschatz, Galvin and Gagne ©2009
One-to-one Model

Operating System Concepts – 8th Edition 4.14 Silberschatz, Galvin and Gagne ©2009
Many-to-Many Model

 Allows many user level threads to be mapped to many kernel


threads
 Allows the operating system to create a sufficient number of
kernel threads
 Example
 Windows NT/2000 with the ThreadFiber package

Operating System Concepts – 8th Edition 4.15 Silberschatz, Galvin and Gagne ©2009
Many-to-Many Model

Operating System Concepts – 8th Edition 4.16 Silberschatz, Galvin and Gagne ©2009
End of today Lecture

Operating System Concepts – 8th Edition 4.17 Silberschatz, Galvin and Gagne ©2009

You might also like