Operating Systems (CS 340 D)

Slides:



Advertisements
Similar presentations
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Advertisements

CHAPTER 5 THREADS & MULTITHREADING 1. Single and Multithreaded Processes 2.
Chapter 4: Multithreaded Programming
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Ch 4: Threads Dr. Mohamed Hefeeda.
CS Distributed Computing Systems Chin-Chih Chang, An Introduction to Threads.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Multithreaded Programming.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
9/13/20151 Threads ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original slides.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Operating System Principles Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Thread. A basic unit of CPU utilization. It comprises a thread ID, a program counter, a register set, and a stack. It is a single sequential flow of control.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Operating System Concepts Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
Threads Many software packages are multi-threaded Web browser: one thread display images, another thread retrieves data from the network Word processor:
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.1.
Source: Operating System Concepts by Silberschatz, Galvin and Gagne.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
Threads. Readings r Silberschatz et al : Chapter 4.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Cooperating Processes The concurrent processes executing in the operating system may be either independent processes or cooperating processes. A process.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-2: Threads Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Lecturer 3: Processes multithreaded Operating System Concepts Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess.
Contents 1.Overview 2.Multithreading Model 3.Thread Libraries 4.Threading Issues 5.Operating-system Example 2 OS Lab Sun Suk Kim.
Threads by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
CMSC 421 Spring 2004 Section 0202 Part II: Process Management Chapter 5 Threads.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Lecture 5. Example for periority The average waiting time : = 41/5= 8.2.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Threads Overview Benefits, User and Kernel Threads.
Chapter 4: Threads Modified by Dr. Neerja Mhaskar for CS 3SH3.
Introduction to threads
OPERATING SYSTEM CONCEPT AND PRACTISE
Chapter 4: Threads.
Operating Systems (CS 340 D)
Chapter 5: Threads Overview Multithreading Models Threading Issues
Operating System (013022) Dr. H. Iwidat
Chapter 5: Threads Overview Multithreading Models(多线程模型)
Chapter 4: Multithreaded Programming
Chapter 3 Threads and Multithreading
Operating Systems (CS 340 D)
Chapter 4: Threads.
Threads & multithreading
Chapter 4: Threads.
Operating System Concepts
Chapter 4: Threads.
Chapter 4 Multithreading programming
Chapter 4: Threads.
Chapter 4: Threads.
CHAPTER 4:THreads Bashair Al-harthi OPERATING SYSTEM
Multithreaded Programming
Operating Systems (CS 340 D)
Threads.
Chapter 4: Threads & Concurrency
Chapter 4: Threads.
Chapter 4: Threads.
Chapter 4: Threads.
CS Introduction to Operating Systems
Presentation transcript:

Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department Operating Systems (CS 340 D) Dr. Abeer Mahmoud

(Chapter-4) Threads

Chapter 4: Threads Motivation Benefits Dr. Abeer Mahmoud

To introduce the notion of a thread — OBJECTIVES: To introduce the notion of a thread — a fundamental unit of CPU utilization that forms the basis of multithreaded computer systems. Dr. Abeer Mahmoud

OVERVIEW A thread: is a basic unit of CPU utilization (i.e. It is the smallest sequence of programmed instructions that can be managed independently) Threads provide a way to improve application performance through parallelism. Dr. Abeer Mahmoud

OVERVIEW (cont..) Thread comprises : It shares with other threads belonging to the same process its ID program counter register set stack code section, data section other operating system resources. Dr. Abeer Mahmoud

OVERVIEW (cont..) A traditional (or heavyweight) process has a single thread of control. A thread could be considered a ‘lightweight’ process If a process has multiple threads of control, it can perform more than one task at a time. Each thread belongs to exactly one process and no thread can exist outside a process. Dr. Abeer Mahmoud

Single and Multithreaded Processes Every thread have their own program counter, stack and set of registers, but sharing common code, data, and certain structures such as open files. single thread - There is one program counter, and one sequence of instructions that can be carried out at any given time. Dr. Abeer Mahmoud

MOTIVATION Many software packages that run on modern desktop PCs are multithreaded. An application typically is implemented as a separate process with several threads of control. E.G. (1) : A word processor may have : a thread for displaying graphics, a thread for responding to keystrokes from the user, a third thread for spelling and grammar checking Dr. Abeer Mahmoud

MOTIVATION E.G. (2) : A web server – Multiple threads allow for multiple requests to be satisfied simultaneously, without having to service requests sequentially or to fork off separate processes for every incoming request ….(creating a new thread belongs to an existing process is less overhead of creating a new process) Most operating system kernels are now Dr. Abeer Mahmoud

BENEFITS There are four major categories of benefits to multi- threading: 1- Responsiveness - One thread may provide rapid response while other threads are blocked or slowed down doing intensive calculations. 2- Economy - Creating and managing threads is much faster than performing the same tasks for processes. Dr. Abeer Mahmoud

BENEFITS (cont..) There are four major categories of benefits to multi- threading: 3-Resource sharing – Processes may only share resources through techniques (e.g. shared memory or message passing) …Such techniques must be explicitly arranged by the programmer. By default threads share common code, data, and other resources, which allows multiple tasks to be performed simultaneously in a single address space. Dr. Abeer Mahmoud

BENEFITS (cont..) 4- Scalability The benefits of multithreading can be greatly increased in a multiprocessor architecture, where threads may be running in parallel on different processors. A single-threaded process can only run on one processor, regardless how many CPUs are available. Dr. Abeer Mahmoud

Thank you End of Chapter 4 Dr. Abeer Mahmoud