ch4 - Chapter 4: Threads Chapter Chapter 4: Threads s...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 4: Threads Chapter 4: Threads
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4.2 Silberschatz, Galvin and Gagne ©2005 th Chapter 4: Threads Chapter 4: Threads Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads
Background image of page 2
4.3 Silberschatz, Galvin and Gagne ©2005 th Threads Threads A thread comprises a thread ID, a program counter, a register set, and a stack. It shares with other threads belonging to same process its code section, data section and other OS resources (open files,. ..) A web browser “process” might have one thread display images or text while another thread retrieves data from the network A single application may be required to perform several similar tasks (e.g. a web server) Server may create several processes. Process creation is time consuming. So multiple threads are used. Typically RPC servers are multithreaded. RMI work similarly. Many OS kernels are now multithreaded, each thread performs a specific task, such as interrupt handling.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4.4 Silberschatz, Galvin and Gagne ©2005 th Single and Multithreaded Processes Single and Multithreaded Processes
Background image of page 4
4.5 Silberschatz, Galvin and Gagne ©2005 th Benefits Benefits Responsiveness Resource Sharing Economy Utilization of multiprocessor architectures
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4.6 Silberschatz, Galvin and Gagne ©2005 th User Threads User Threads Thread management done by user-level threads library Three primary thread libraries: POSIX Pthreads Win32 threads Java threads
Background image of page 6
4.7 Silberschatz, Galvin and Gagne ©2005 th Kernel Threads Kernel Threads Supported by the Kernel Examples Windows XP/2000 Solaris Linux Tru64 UNIX Mac OS X
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4.8 Silberschatz, Galvin and Gagne ©2005 th Multithreading Models Multithreading Models Many-to-One One-to-One Many-to-Many
Background image of page 8
4.9 Silberschatz, Galvin and Gagne ©2005 th Many-to-One Many-to-One Many user-level threads mapped to single kernel thread Thread management is done by the thread library in user space Efficient, but the entire process will block if a thread makes a blocking system call True concurrency is not gained because the kernel can schedule only one thread at a time Because only one thread can access the kernel at a time, multiple threads are unable to run in parallel on multiprocessors Examples: Solaris Green Threads GNU Portable Threads
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4.10 Silberschatz, Galvin and Gagne ©2005 th Many-to-One Model Many-to-One Model
Background image of page 10
Silberschatz, Galvin and Gagne ©2005 th One-to-One One-to-One Each user-level thread maps to kernel thread More concurrency than the many-to-one model by allowing another thread to run when a thread makes a blocking system call Allows multiple threads to run in parallel on multiprocessors Creating a user thread requires creating a kernel thread,. ..costly. The developer has to be careful not to create too many threads
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 42

ch4 - Chapter 4: Threads Chapter Chapter 4: Threads s...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online