Threads, SMP, and Microkernels. Chapter 4

Similar documents
Chapter 4 Threads, SMP, and

ECE519 Advanced Operating Systems

2017 Pearson Educa2on, Inc., Hoboken, NJ. All rights reserved.

For use by students enrolled in #71251 CSE430 Fall 2012 at Arizona State University. Do not use if not enrolled.

Operating Systems: Internals and Design Principles. Chapter 4 Threads Seventh Edition By William Stallings

Threads, SMP, and Microkernels

Operating System 4 THREADS, SMP AND MICROKERNELS

Chapter 3 Process Description and Control

Process Characteristics. Threads Chapter 4. Process Characteristics. Multithreading vs. Single threading

Threads Chapter 4. Reading: 4.1,4.4, 4.5

Process Characteristics

Processes, Threads, SMP, and Microkernels

Process Description and Control

Motivation. Threads. Multithreaded Server Architecture. Thread of execution. Chapter 4

Operating System. Chapter 4. Threads. Lynn Choi School of Electrical Engineering

CSCI-GA Operating Systems Lecture 3: Processes and Threads -Part 2 Scheduling Hubertus Franke

Threads Chapter 5 1 Chapter 5

OPERATING SYSTEM : RBMCQ0402. Third RavishBegusarai.

Operating Systems Overview. Chapter 2

UNIT 3. PROCESS MANAGEMENT

Processes and Threads. Processes and Threads. Processes (2) Processes (1)

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

Process Description and Control. Chapter 3

Threads. CS3026 Operating Systems Lecture 06

Operating Systems. Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) alphapeeler.sf.net/pubkeys/pkey.htm

operating system Spring 2017 Prof.Dr. Hasan Balik Student Name : Walid.W. Ramadan mansour Student ID :

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA

Lecture 5: Process Description and Control Multithreading Basics in Interprocess communication Introduction to multiprocessors

Scheduler Activations. Including some slides modified from Raymond Namyst, U. Bordeaux

Threads. Thread Concept Multithreading Models User & Kernel Threads Pthreads Threads in Solaris, Linux, Windows. 2/13/11 CSE325 - Threads 1

The modularity requirement

Operating System Overview. Chapter 2

CHAPTER 2: PROCESS MANAGEMENT

CSCE 313: Intro to Computer Systems

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

Processes and Threads

Chapter 5: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads Linux Threads Java Threads

Non-uniform memory access machine or (NUMA) is a system where the memory access time to any region of memory is not the same for all processors.

Chapter 4: Threads. Overview Multithreading Models Thread Libraries Threading Issues Operating System Examples Windows XP Threads Linux Threads

System Call. Preview. System Call. System Call. System Call 9/7/2018

Operating System. Operating System Overview. Layers of Computer System. Operating System Objectives. Services Provided by the Operating System

Operating System Overview. Operating System

Announcement. Exercise #2 will be out today. Due date is next Monday

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

CS418 Operating Systems

Applications, services. Middleware. OS2 Processes, threads, Processes, threads, communication,... communication,... Platform

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Multithreading. Reading: Silberschatz chapter 5 Additional Reading: Stallings chapter 4

Figure 6.1 System layers

Windows 7 Overview. Windows 7. Objectives. The History of Windows. CS140M Fall Lake 1

Learning Outcomes. Processes and Threads. Major Requirements of an Operating System. Processes and Threads

Operating System Architecture. CS3026 Operating Systems Lecture 03

When we start? 10/24/2013 Operating Systems, Beykent University 1

Process Description and Control. Chapter 3

Chapter 4: Multi-Threaded Programming

Lecture Topics. Announcements. Today: Advanced Scheduling (Stallings, chapter ) Next: Deadlock (Stallings, chapter

CS370 Operating Systems

Scheduling in the Supermarket

CSE325 Principles of Operating Systems. Processes. David P. Duggan February 1, 2011

Outline. Process and Thread Management. Data Structures (2) Data Structures. Kernel Process Block (PCB)

Process and Thread Management

Processes and Threads

Operating System Support

Threads Assistant Professor DCS Operating System Concepts

Operating Systems: Internals and Design Principles. Chapter 2 Operating System Overview Seventh Edition By William Stallings

Computer System Overview

Lecture Contents. 1. Overview. 2. Multithreading Models 3. Examples of Thread Libraries 4. Summary

CS420: Operating Systems

Lecture 17: Threads and Scheduling. Thursday, 05 Nov 2009

Chapter 4: Threads. Chapter 4: Threads

Processes and Threads

Threads. Raju Pandey Department of Computer Sciences University of California, Davis Spring 2011

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Unit OS2: Operating System Principles. Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze

OPERATING SYSTEMS UNIT - 1

4. Concurrency via Threads

Threads. Computer Systems. 5/12/2009 cse threads Perkins, DW Johnson and University of Washington 1

Solved MCQs on Operating System Principles. Set-1

This slide show uses materials from the Windows Operating System Internals Curriculum Development Kit

Threads. Still Chapter 2 (Based on Silberchatz s text and Nachos Roadmap.) 3/9/2003 B.Ramamurthy 1

LECTURE 3:CPU SCHEDULING

Operating System Structure

Operating System Support

CISC2200 Threads Spring 2015

Parallel Processing. Computer Architecture. Computer Architecture. Outline. Multiple Processor Organization

Operating Systems. Computer Science & Information Technology (CS) Rank under AIR 100

Multiprocessors and Thread-Level Parallelism. Department of Electrical & Electronics Engineering, Amrita School of Engineering

Yi Shi Fall 2017 Xi an Jiaotong University

by Maria Lima Term Paper for Professor Barrymore Warren Mercy College Division of Mathematics and Computer Information Science

Process Description and Control

Major Requirements of an OS

Sistemas Operacionais I. Valeria Menezes Bastos

Operating Systems. Lecture 3- Process Description and Control. Masood Niazi Torshiz

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective. Part I: Operating system overview: Processes and threads

Chapter 4: Threads. Operating System Concepts 8 th Edition,

Chapter 5: Threads. Outline

Processes and Threads

CSE 4/521 Introduction to Operating Systems. Lecture 29 Windows 7 (History, Design Principles, System Components, Programmer Interface) Summer 2018

CSE 306/506 Operating Systems Threads. YoungMin Kwon

CS 450 Operating System Week 4 Lecture Notes

Transcription:

Threads, SMP, and Microkernels Chapter 4

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

Processes Dispatching is referred to as a thread Resource of ownership is referred to as a process or task

Multithreading Operating system supports multiple threads of execution within a single process MS-DOS supports just one process and a single thread Traditional UNIX supports multiple user processes but only one thread per process Modern Unix (Solaris,Linux,AIX) and Windows (2000/XP) support multiple threads per process

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

Process Resources Have a virtual address space which holds the process image Protected access to processors, communication lines to other processes, files, and I/O resources (devices, channels)

Thread Resources An execution state (running, ready, etc.) Saved thread context when not running An execution stack Per-thread static storage for local variables Access to the memory and other resources of the owner-process all threads of a process share the resources/memory of the owner-process

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

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

Suspension and Termination of Threads 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

User-Level Threads All thread management is done by the application The kernel is not aware of the existence of threads Thread switching does not require kernel mode privileges Scheduling is application specific

Kernel-Level Threads Windows 2000/XP, Modern UNIXes are examples of this approach Kernel maintains context information for the process and the threads Switching between threads requires the kernel

Combined Approaches for Threads Example is Solaris (Sun s Unix) Thread creation is done in the user space Bulk of scheduling and synchronization of threads is done in the user space

Relationship Between Threads and Processes Threads:Process Description Example Systems 1:1 Each 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. Linux, Windows XP, Solaris, OS/2, OS/390, MACH

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

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

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

Symmetric Multiprocessing Kernel can execute on any processor Typically each processor does selfscheduling from the pool of available processes or threads

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

Microkernel Small operating system core Contains only essential operating systems functions Many services traditionally included in the operating system are now external subsystems device drivers file systems virtual memory manager windowing system and security services

Benefits of a Microkernel Organization Uniform interface to requests made by a process all services are provided by means of message passing Extensibility allows the addition of new services Flexibility existing features can be subtracted

Benefits of a Microkernel Organization Portability changes needed to port the system to a new processor can be limited to the microkernel - not to the other services Reliability modular design small microkernel can be rigorously tested

Benefits of Microkernel Organization Distributed system support messages are sent without knowing what the target machine is Object-oriented operating system components are objects with clearly defined interfaces that can be interconnected to form software

Microkernel Design Primitive memory management mapping each virtual page to a physical page frame Inter-process communication I/O and interrupt management

MS Windows Processes Implemented as objects An executable process may contain one or more threads Both process and thread objects have built-in synchronization capabilities

Windows 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 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

Windows Thread States Runnable Pick to Run Standby Switch Ready Preempted Running Resource Available Unblock/Resume Resource Available Block/ Suspend Terminate Transition Waiting Terminated Unblock, Resource Not Available Not Runnable

Solaris Process includes the user s address space, stack, and process control block User-level threads Lightweight processes Kernel threads

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

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

Linux Threads Linux threads appear as processes to the kernel: it doesn t distinguish that much among them But processes can share the same process group ID Processes with the same group ID share resources o Memory o files