Threads and Scheduling

Slides:



Advertisements
Similar presentations
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
Advertisements

Structure of Processes
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
ThreadsThreads operating systems. ThreadsThreads A Thread, or thread of execution, is the sequence of instructions being executed. A process may have.
Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.
1 RTOS Design Some of the content of this set of slides is taken from the documentation existing on the FreeRTOS website
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 13 Threads Read Ch 5.1.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Silberschatz, Galvin and Gagne  Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system.
Concurrency & Context Switching Process Control Block What's in it and why? How is it used? Who sees it? 5 State Process Model State Labels. Causes of.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator –Control program.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Introduction to Kernel
Processes and threads.
Process Management Process Concept Why only the global variables?
Chapter 3: Process Concept
CS 6560: Operating Systems Design
Practice Chapter Four.
Processes and Threads Processes and their scheduling
OPERATING SYSTEMS CS3502 Fall 2017
Networks and Operating Systems: Exercise Session 2
Lecture Topics: 11/1 Processes Process Management
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 4 Threads.
Operating Systems: A Modern Perspective, Chapter 6
Chapter 3: Processes.
Processes A process is a running program.
Nachos Threads and Concurrency
Operating System Concepts
System Structure and Process Model
Chapter 3: Processes.
System Structure and Process Model
Chapter 3 Process Management.
2P13 Week 2.
Lecture 2: Processes Part 1
System Structure B. Ramamurthy.
Threads, SMP, and Microkernels
ICS 143 Principles of Operating Systems
Multithreading.
Process & its States Lecture 5.
Mid Term review CSC345.
Threads Chapter 4.
Chapter 3: Processes.
Operating System Concepts
Lecture 4- Threads, SMP, and Microkernels
Threads and Concurrency
Threads Chapter 4.
Operating Systems Processes (Ch 4.1).
Processes Hank Levy 1.
Threads and Concurrency
Chapter 3: Processes.
Thomas E. Anderson, Brian N. Bershad,
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Implementing Processes, Threads, and Resources
Outline Process Management Process manager Hardware process
Processes Hank Levy 1.
Process Description and Control in Unix
Chapter 3: Processes Process Concept Process Scheduling
Structure of Processes
CS Introduction to Operating Systems
Presentation transcript:

Threads and Scheduling Section 4 Threads and Scheduling February 10th, 2017 Taught by Josh Don

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Communication Creation Waiting/Synchronization Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Communication Creation Waiting/Synchronization Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Creation Waiting/Synchronization Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Creation Waiting/Synchronization Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation Waiting/Synchronization Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead Waiting/Synchronization Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead pthread_create() Lower overhead Waiting/Synchronization Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead pthread_create() Lower overhead Waiting/Synchronization wait() Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead pthread_create() Lower overhead Waiting/Synchronization wait() join() Use case Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead pthread_create() Lower overhead Waiting/Synchronization wait() join() Use case Instance of a running program (an executable) Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead pthread_create() Lower overhead Waiting/Synchronization wait() join() Use case Instance of a running program (an executable) Multithreaded process: divide up parallel tasks for a given program Context Switching Overhead

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead pthread_create() Lower overhead Waiting/Synchronization wait() join() Use case Instance of a running program (an executable) Multithreaded process: divide up parallel tasks for a given program Context Switching Overhead higher overhead (need to swap memory, page tables, etc.)

Waiting/Synchronization Context Switching Overhead Process Thread Data/Memory Independent address space Shares address space with other threads in same process. Each thread still has own registers and stack Communication Pipes, files, sockets High overhead Read data of another thread Low overhead Creation fork() Higher overhead pthread_create() Lower overhead Waiting/Synchronization wait() join() Use case Instance of a running program (an executable) Multithreaded process: divide up parallel tasks for a given program Context Switching Overhead higher overhead (need to swap memory, page tables, etc.) lower overhead (only need to swap thread state)

Scheduling Scheduling: The process by which the kernel chooses the next thread to run There may be many threads ready to run at any given time Kernel must choose amongst the ready threads, and start running the chosen thread The kernel switches very quickly between threads of currently running processes, so everything gets some time to run A running thread can either yield to the scheduler, or a timer will go off to preempt the running thread Context Switch: The period during which we stop the current running thread, and load a new thread to run Priority Scheduling: Every thread is assigned a priority. The scheduler chooses the highest priority ready thread to run

Scheduling overview Creation Scheduler exit exit Yield, timer New Terminated Creation Scheduler exit Ready Running exit Zombie Yield, timer I/O or syscall completion, lock_release of desired lock, etc. I/O, syscall, lock_acquire, join/wait, etc. Waiting