Threads, SMP, and Microkernels. Processes zResource ownership - process is allocated a virtual address space to hold the process image zDispatched - process.

Slides:



Advertisements
Similar presentations
Threads Chapter 4 Threads are a subdivision of processes
Advertisements

Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
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
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.
Threads, SMP, and MicroKernels
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
Operating Systems (OS) Threads, SMP, and Microkernel, Unix Kernel
1 Chapter 4 Threads Threads: Resource ownership and execution.
Threads, SMP, and Microkernels
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
A. Frank - P. Weisberg Operating Systems Threads Implementation.
Threads, SMP, and Microkernels Chapter 4. Two Characteristics of Processes (1) Resource ownership zA process is allocated a virtual address space to hold.
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.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
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.
Multithreading Allows application to split itself into multiple “threads” of execution (“threads of execution”). OS support for creating threads, terminating.
Threads, SMP, and Microkernels Chapter 4. 2 Outline n Threads n Symmetric Multiprocessing (SMP) n Microkernel n Linux Threads.
Operating System 4 THREADS, SMP AND MICROKERNELS
Threads, Thread management & Resource Management.
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.
Multithreading in Java Project of COCS 513 By Wei Li December, 2000.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
© 2004, D. J. Foreman 2-1 Concurrency, Processes and Threads.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
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)
Operating System Concepts and Techniques Lecture 4 Thread M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and Techniques, First ed.,
Processes and Process Control 1. Processes and Process Control 2. Definitions of a Process 3. Systems state vs. Process State 4. A 2 State Process Model.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
Modern Operating Systems B.Ramamurthy Chapter 2, Section 2.4.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
Threads, SMP, and Microkernels Chapter 4. Threads, SMP, and Microkernels 1. Processes and threads 2. Symmetric MultiProcessing (SMP) 3. Microkernel: structuring.
1 Lecture 4: Threads Advanced Operating System Fall 2010.
Operating System 4 THREADS, SMP AND MICROKERNELS.
Department of Computer Science and Software Engineering
Thread By Group III Kathryn Bean and Wafa’ Jaffal.
Chapter 4 Threads Seventh Edition By William Stallings Operating Systems: Internals and Design Principles.
Operating Systems: Internals and Design Principles
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Module 2.0: Threads.
Processes & Threads Introduction to Operating Systems: Module 5.
Linux Development Lecture
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.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapter 4 Threads.
Principles of Operating Systems Lecture 8
Threads, SMP, and Microkernels
Chapter 15, Exploring the Digital Domain
Symmetric Multiprocessing (SMP)
Threads Chapter 4.
Lecture 4- Threads, SMP, and Microkernels
Operating System 4 THREADS, SMP AND MICROKERNELS
Threads Chapter 4.
Chapter 4 Threads, SMP, and Microkernels
CS510 Operating System Foundations
Presentation transcript:

Threads, SMP, and Microkernels

Processes zResource ownership - process is allocated a virtual address space to hold the process image zDispatched - process is an execution path through one or more programs yexecution may be interleaved with other processes zThese two characteristics are treated independently by the operating system

Processes zDispatching is referred to as a thread zResource of ownership is referred to as a process or task

Multithreading zOperating system supports multiple threads of execution within a single process zMS-DOS supports a single thread zUNIX supports multiple user processes but only supports one thread per process zWindows NT, Solaris, Linux supports multiple threads

Threads and Processes one process one thread multiple processes one thread per process one process multiple threads multiple processes multiple threads per process

Processes zHave a virtual address space which holds the process image zProtected access to processors, other processes, files, and I/O resources

Threads zHas an execution state (running, ready, etc.) zSaves thread context when not running zHas an execution stack zHas some per-thread static storage for local variables zHas access to the memory and resources of its process yall threads of a process share this

Single Threaded and Multithreaded Process Models Thread Control Block User Stack User Stack Kernel Stack Kernel Stack User Address Space User Address Space Process Control Block Process Control Block Thread Single-Threaded Process Model Multithreaded Process Model Thread Control Block User Stack Kernel Stack Thread Control Block User Stack Kernel Stack Thread

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

Threads zSuspending a process involves suspending all threads of the process since all threads share the same address space zTermination of a process, terminates all threads within the process zThread operations: spawn, block, unblock, finish (no suspend, only active)

User-Level Threads zAll thread management is done by the application, and is fast zThe kernel is not aware of the existence of threads zThread switching does not require kernel mode privileges zScheduling is application specific

Kernel-Level Threads zWindows NT, Linux and OS/2 are examples of this approach zKernel maintains context information for the process and the threads zSwitching between threads requires the kernel and may be slower than user-level

Combined Approaches for Threads zExample is Solaris zThread creation done in the user space zBulk of scheduling and synchronization of threads done in the user space

Relationship Between Threads and Processes Threads:ProcessDescriptionExample Systems 1:1Each thread of execution is a unique process with its own address space and resources. Most 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, Linux, 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

Categories of Computer Systems zSingle Instruction Single Data (SISD) ysingle processor executes a single instruction stream to operate on data stored in a single memory zSingle Instruction Multiple Data (SIMD) yone instruction is executed on a different set of data by the different processors

Categories of Computer Systems zMultiple Instruction Single Data (MISD) ya sequence of data is transmitted to a set of processors, each of which executes a different instruction sequence. Never implemented yMultiple Instruction Multiple Data (MIMD) ya set of processors simultaneously execute different instruction sequences on different data sets

Parallel Processor Architecture MIMD Shared memory multiprocessor Distributed memory (self-contained computers) Clusters Master/Slave Symmetric multiprocessors (SMP)

Symmetric Multiprocessing zKernel can execute on any processor zTypically each processor does self- scheduling from the pool of available process or threads zportions of the kernel can execute in parallel in different processors

Symmetric Multiprocessor Organization Main Memory Processor Cache I/O Subsystem...

Multiprocessor OS requirements zMust provide functionality of a multiprogramming OS plus additional features to support multiple processors zSimultaneous concurrent processes or threads: kernel routines need to be reentrant zScheduling done by any processor, can create conflicts. zSynchronization through locks is required. zMemory management needs to be coordinated in the different processors zMuch more complex than just multiprogramming OS.

Microkernel zSmall operating system corecore zContains only essential operating systems functions zMany services traditionally included in the operating system are now external subsystems ydevice drivers yfile systems yvirtual memory manager ywindowing system and security services

Benefits of a Microkernel Organization zUniform interface on request made by a process yall services are provided by means of message passing zExtensibility yallows the addition of new services zFlexibility yexisting features can be subtracted

Benefits of a Microkernel Organization zPortability ychanges needed to port the system to a new processor is changed in the microkernel - not in the other services zReliability ymodular design ysmall microkernel can be rigorously tested

Benefits of Microkernel Organization zDistributed system support ymessage are sent without knowing what the target machine is zObject-oriented operating system ycomponents are objects with clearly defined interfaces that can be interconnected to form software

Microkernel Design zPrimitive memory management ymapping each virtual page to a physical page frame zInter-process communication zI/O and interrupt management

Windows NT Processes zImplemented as objects zAn executable process may contain one or more threads zBoth process and thread objects have built-in synchronization capabilities

Windows NT Process Object Attributes Process ID Security Descriptor Base priority Default processor affinity Quota limits Execution time I/O counters VM operation counters Exception/debugging ports Exit status

Windows NT Thread Object Attributes Thread ID Thread context Dynamic priority Base priority Thread processor affinity Thread execution time Alert status Suspension count Impersonation token Termination port Thread exit status

NT Thread Status Resource Available Unblock/Resume Resource Available Unblock Resource Not Available Block/ Suspend Terminate Switch Pick to Run Preempted TransitionWaitingTerminated Not Runnable Runnable Ready Standby Running

Solaris zProcess includes the user’s address space, stack, and process control block zUser-level threads zLightweight processes zKernel threads

Solaris User Level Threads Stop Sleep Dispatch Stop Wakeup Continue Preempt Stopped Runnable Active Sleeping

Solaris Lightweight Processes Timeslice or Preempt Wakeup Stop Blocking System Call Wakeup Dispatch Runnable Running Active Stopped Continue Stop