4.Threads - Threads Mehdi Kargahi School of ECE University...

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

View Full Document Right Arrow Icon
Threads Mehdi Kargahi School of ECE University of Tehran Spring 2008
Background image of page 1

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

View Full DocumentRight Arrow Icon
M. Kargahi (School of ECE) Definition s What’s the difference between a thread and a process? s Heavyweight process: A single thread process s What a thread has for itself? s Thread-Specific Data s Thread ID s Program Counter s A register set s A stack
Background image of page 2
M. Kargahi (School of ECE) Single-threaded and Multithreaded Processes
Background image of page 3

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

View Full DocumentRight Arrow Icon
M. Kargahi (School of ECE) Examples s A Web server s A RPC server s Since the requests from these servers are similar, it is better to avoid creating new processes that may be much more costly
Background image of page 4
M. Kargahi (School of ECE) The Benefits of Multithreaded Programming s Responsiveness s If a thread is blocked, other threads can continue s E.g., showing an image while getting text from the user in a web page s Resource sharing s Threads share the memory and resources of the respective process (shared code and data) s Economy s Allocating memory and resource to processes and their respective context-switch is more costly with respect to threads s Solaris: speed of process creation=1/30 speed of thread creation s Solaris: speed of process CS=1/5 speed of thread CS s Utilization of multiprocessor architectures s No speed-up with a heavyweight process on a multiprocessor system s Concurrency with multithreaded processes on multiprocessor systems
Background image of page 5

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

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

This note was uploaded on 11/21/2010 for the course COMPUTER S 001 taught by Professor Kargahi during the Spring '10 term at Amirkabir University of Technology.

Page1 / 19

4.Threads - Threads Mehdi Kargahi School of ECE University...

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

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