Thread By Group III Kathryn Bean and Wafa’ Jaffal.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Chapter 4 Threads Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William.
Threads, SMP, and Microkernels
Operating Systems: Internals and Design Principles
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Multithreaded Programming.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Computer Systems/Operating Systems - Class 8
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Modified from Silberschatz, Galvin and Gagne ©2009 Lecture 7 Chapter 4: Threads (cont)
Chapter 4: Multithreaded Programming
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
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  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Threads, SMP, and Microkernels
Threads. Processes and Threads  Two characteristics of “processes” as considered so far: Unit of resource allocation Unit of dispatch  Characteristics.
Process Concept An operating system executes a variety of programs
A. Frank - P. Weisberg Operating Systems Threads Implementation.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Threads Chapter 4. Modern Process & Thread –Process is an infrastructure in which execution takes place  (address space + resources) –Thread is a program.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Multithreaded Programming.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 4: Threads Overview Multithreading Models Threading Issues.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E.
Operating Systems Lecture 09: Threads (Chapter 4)
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Multithreading Allows application to split itself into multiple “threads” of execution (“threads of execution”). OS support for creating threads, terminating.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 4: Threads.
Threads, SMP, and Microkernels Chapter 4. 2 Outline n Threads n Symmetric Multiprocessing (SMP) n Microkernel n Linux Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
1 Threads, SMP, and Microkernels Chapter 4. 2 Focus and Subtopics Focus: More advanced concepts related to process management : Resource ownership vs.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Multithreading Models Threading Issues Pthreads Solaris 2 Threads.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.1.
Threads G.Anuradha (Reference : William Stallings)
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership: process includes a virtual address space to hold the process image (fig 3.16)
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
1 Lecture 4: Threads Advanced Operating System Fall 2010.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 4: Threads Overview Multithreading Models Threading Issues.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 4: Threads Modified from the slides of the text book. TY, Sept 2010.
Chapter 4: Multithreaded Programming. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts What is Thread “Thread is a part of a program.
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.
Department of Computer Science and Software Engineering
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Chapter 4 Threads Seventh Edition By William Stallings Operating Systems: Internals and Design Principles.
Operating Systems: Internals and Design Principles
Module 2.0: Threads.
Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
Threads, SMP and Microkernels Process vs. thread: –Unit of resource ownership (process has virtual address space, memory, I/O channels, files) –Unit of.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads (7 th Edition)
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Chapter 5: Threads Overview Multithreading Models Threading Issues
Chapter 4 Threads.
Threads, SMP, and Microkernels
Threads Chapter 4.
Lecture 4- Threads, SMP, and Microkernels
Threads Chapter 4.
Presentation transcript:

Thread By Group III Kathryn Bean and Wafa’ Jaffal

Topics Covered Process vs. Thread Multithreading Benefits of Threads Thread States Different Thread Types Mapping between Processes and Threads Threading Issues Conclusion

Process vs. Thread, Process: Related to resource ownership Have a virtual address space which holds the process image Protected access to processors, other processes, files, and I/O resources

Process vs. Thread, Thread: Related to program execution Saved thread context when not running Has an execution stack Some per-thread static storage for local variables Access to the memory and resources of its process all threads of a process share this

Process vs. Thread Single-Threaded PCB Addr. Space Kernel Stack User Stack PCB Addr. Space Thread CB User Stack Kernel Stack Thread CB User Stack Kernel Stack Thread CB User Stack Kernel Stack Thread CB User Stack Kernel Stack Multithreaded

Multithreading MS-DOS - a single thread UNIX - multiple user processes but only supports one thread per process Java Run-Time engine - one process, multiple threads Windows 2000, Solaris, Linux, Mach, and OS/2 - multiple threads

Multithreading 1 Process 1 Thread M Processes 1 Thread per Process 1 Process M Threads M Processes N Threads

Benefits of Threads Takes less time to create a new thread than a process Less time to terminate a thread than a process Less time to switch between two threads within the same process Since threads within the same process share memory and files, they can communicate with each other without invoking the kernel

Uses of Threads Foreground to background work Asynchronous processing Speed execution Modular program structure

Remote Procedure Call Using Threads Server Time RPC Request RPC Using Single Thread Server

Remote Procedure Call Using Thread Server Time RPC Request Server RPC Request Thread 1 Thread 2

Threads within Process States Suspending a process involves suspending all threads of the process since all threads share the same address space Termination of a process, terminates all threads within the process

Thread States States associated with a change in thread state Spawn Spawn another thread Block Unblock Finish Deallocate register context and stacks

User-Level Threads (ULT) All thread management is done by the application The kernel is not aware of the existence of threads Example: POSIX Pthread Mach C-thread Solaris 2 UI-thread

Kernel-Level Threads (KLT) Kernel maintains context information for the process and the threads Scheduling is done on a thread basis W2K, Linux, and OS/2 are examples of this approach

Combined Approaches Example is Solaris Thread creation done in the user space Bulk of scheduling and synchronization of threads done in the user space Multiple ULT from a single application are mapped onto some number of KLT

Relationship Between Threads and Processes Threads:ProcessDescriptionExample Systems 1:1Each thread of execution is a unique process with its own address space and resources. Traditional UNIX implementations M:1 A process defines an address space and dynamic resource ownership. Multiple threads may be created and executed within that process. Windows NT, Solaris, OS/2, OS/390, MACH

Relationship Between Threads and Processes Threads:ProcessDescriptionExample Systems 1:MA thread may migrate from one process environment to another. This allows a thread to be easily moved among distinct systems. Ra (Clouds), Emerald M:MCombines attributes of M:1 and 1:M cases TRIX

Thread Issue Cancellation Target thread - thread to be cancelled Asynchronous cancellation Deferred cancellation Thread pool Create a number of threads at process startup and place them into a pool

Conclusion Responsiveness Resource sharing Economy Utilization of multiprocessor architectures Threads synchronization

Thank You Questions?

Bibliography W. Stallings, Operating Systems Prentice-Hall, 1998 A. Silberschatz, P. Galvin, G. Gagne, Operating System Concepts John Wiley & Sons, Inc. 2002