lecture08-chapter04 - OperatingSystems Lecture08 Threads...

Info icon This 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
Image of page 1

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

View Full Document Right 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
Image of page 2
3 Single vs. Multi Threaded Approaches MSDOS Old UNIX Java Runtime Env Windows, Unix, etc
Image of page 3

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

View Full Document Right 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
Image of page 4
Threads vs. Processes 5
Image of page 5

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

View Full Document Right 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
Image of page 6
Thread Use in a Single User System Foreground and background work Asynchronous processing Speed of execution Modular program structure 7
Image of page 7

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

View Full Document Right Arrow Icon