lecture08-chapter04 - OperatingSystems Lecture08 Threads...

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

View Full Document Right Arrow Icon
Operating Systems Lecture 08: Threads Anda Iamnitchi [email protected] 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Processes vs. Threads A process viewed so far as units of: Resource ownership Scheduling/execution In multithreading OS: Process stays the unit of resource ownership Thread (or lightweight process ) is the unit of scheduling Multithreading: the ability of an OS to support multiple, concurrent paths of execution within a single process 2
Background image of page 2
3 Single vs. Multi Threaded Approaches MSDOS Old UNIX Java Runtime Env Windows, Unix, etc
Background image of page 3

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

View Full DocumentRight Arrow Icon
One or More Threads in a Process Each thread in a process has: A thread execution state (Running, Ready, etc.) A saved thread context when not running; one way to view a thread is as an independent program counter operating within a process An execution stack Some per thread static storage for local variables Access to the memory and resources of its process, shared with all other threads in that process 4
Background image of page 4
Threads vs. Processes 5
Background image of page 5

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

View Full DocumentRight Arrow Icon
Benefits of Threads Takes less time to create a new thread than a process Less time to terminate a thread than a process Switching between two threads takes less time than switching between processes Threads enhance efficiency in communication between programs 6
Background image of page 6
Thread Use in a Single User System Foreground and background work Asynchronous processing Speed of execution Modular program structure 7
Background image of page 7

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

View Full DocumentRight Arrow Icon
Threads In an OS that supports threads, scheduling and dispatching is done on a thread basis Most of the state information dealing with execution is maintained in thread level data structures suspending a process involves suspending all threads of the process termination of a process terminates all threads within the process 8
Background image of page 8
Thread Execution States The key states for a thread are: ± Running ± Ready ± Blocked Thread operations associated with a change in thread state are: ± Spawn ± Block ± Unblock ± Finish 9
Background image of page 9

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

View Full DocumentRight Arrow Icon
2 RPCs with single thread and multi threading
Background image of page 10
Multithreading on a Uniprocessor 11
Background image of page 11

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

View Full DocumentRight Arrow Icon
Types of Threads User Level Thread (ULT) Kernel level Thread (KLT) 12
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2012 for the course COP 4600 taught by Professor Andaiamnitchi during the Fall '08 term at University of South Florida.

Page1 / 41

lecture08-chapter04 - OperatingSystems Lecture08 Threads...

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

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