os5 - Operating Systems : Threads (Chapter 5) Sung-Yong...

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

View Full Document Right Arrow Icon
Operating Systems : Threads (Chapter 5) Sung-Yong Park, Ph.D. Distributed Computing & Communication Laboratory Department of Computer Science Sogang University Sogang University Distributed Computing & Communication Lab. Page 2 Shared memory segments, pipes, open files Shared memory segments, pipes, open files Concurrency in Process Model Data Stack Code Data Stack Code process process maintained by kernel System Call ± Use of concurrency within an application has several advantages. ± Concurrency can be implemented by structuring an application as a set of concurrent processes (e.g., using fork() ).
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sogang University Distributed Computing & Communication Lab. Page 3 Overhead in Process Model Kernel P1 P2 P3 P4 Processes ± Each process is completely independent (need IPC via kernel). ± Too heavy for process creation, context switching. Context Switch Need IPC Sogang University Distributed Computing & Communication Lab. Page 4 What is Thread ? ± A basic unit of CPU utilization (or scheduling) , and consists of a PC, a register set and a stack space (similar to process). ± An individual thread has at least its own register state, and usually its own stack. ± Multiple threads can be created within a same process and share code , address space , and operating resources for the process. ± The environment in which a thread executes is called task , and a traditional ( heavyweight ) process is equal to a task with one thread. ± Thread makes creation and switching inexpensive (use small context).
Background image of page 2
Sogang University Distributed Computing & Communication Lab. Page 5 Threaded Process Model Thread Stack Thread Data Thread Code Share Code & Data ± Threads within a process ± Independent executables (multiple threads of control). ± All threads are parts of a process hence communication easier and simpler. ± Lightweight thread creation and context switching .
Background image of page 3

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

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

Page1 / 12

os5 - Operating Systems : Threads (Chapter 5) Sung-Yong...

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

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