ITFN 3601 Introduction to Operating Systems Lecture 3 Processes, Threads & Scheduling Intro.

Slides:



Advertisements
Similar presentations
1 Processes and Threads Creation and Termination States Usage Implementations.
Advertisements

Operating Systems COMP 4850/CISG 5550 Processes Introduction to Threads Dr. James Money.
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.
Chapter 5 Processes and Threads Copyright © 2008.
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.
Processes CSCI 444/544 Operating Systems Fall 2008.
Ceng Operating Systems Chapter 2.5 : Threads Process concept  Process scheduling  Interprocess communication  Deadlocks  Threads.
Scheduler Activations Effective Kernel Support for the User-Level Management of Parallelism.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
Threads CSCI 444/544 Operating Systems Fall 2008.
Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Inter-Process Communication  most OSs provide several abstractions for inter- process communication: message passing, shared memory, etc.  communication.
Process Concept An operating system executes a variety of programs
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Process Description and Control A process is sometimes called a task, it is a program in execution.
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.
ThreadsThreads operating systems. ThreadsThreads A Thread, or thread of execution, is the sequence of instructions being executed. A process may have.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Operating Systems CSE 411 CPU Management Sept Lecture 11 Instructor: Bhuvan Urgaonkar.
Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.
Threads & Scheduling What are threads?
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
CS 153 Design of Operating Systems Spring 2015
Processes and Threads.
1 Process States (1) Possible process states –running –blocked –ready Transitions between states shown.
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.
Scheduler Activations: Effective Kernel Support for the User- Level Management of Parallelism. Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Thread Scheduling.
Scheduler Activations: Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
CS333 Intro to Operating Systems Jonathan Walpole.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
1 Lecture 4: Threads Advanced Operating System Fall 2010.
CSE 451: Operating Systems Winter 2015 Module 5 1 / 2 User-Level Threads & Scheduler Activations Mark Zbikowski 476 Allen Center.
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
1 Chapter 2.5 : Threads Process concept  Process concept  Process scheduling  Process scheduling  Interprocess communication  Interprocess communication.
Processes & Threads Introduction to Operating Systems: Module 5.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Processes and Threads MICROSOFT.  Process  Process Model  Process Creation  Process Termination  Process States  Implementation of Processes  Thread.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-2: Threads Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Operating System Concepts
Lecturer 3: Processes multithreaded Operating System Concepts Process Concept Process Scheduling Operation on Processes Cooperating Processes Interprocess.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
CS 6560: Operating Systems Design
OPERATING SYSTEMS CS3502 Fall 2017
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Chapter 4 Threads.
Lecture 21: Introduction to Process Scheduling
Process Description and Control
Threads and Concurrency
Threads Chapter 4.
Process Description and Control
Process Description and Control
Process Description and Control
Lecture 21: Introduction to Process Scheduling
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
CS510 Operating System Foundations
Process Management -Compiled for CSIT
Process Management -Compiled for CSIT
Presentation transcript:

ITFN 3601 Introduction to Operating Systems Lecture 3 Processes, Threads & Scheduling Intro

Agenda Processes Creation Termination States Threads Definition User vs. Kernel Threads Hybrid Threads Intro to Scheduling

Processes A process is an executing Program Consist of Program, input, output and a state Multiprogramming Pseudo-Parallel Execution

Process Creation System Initialization System call by running process User request to create new process Initiation of a batch job

Process Termination Normal exit Error Exit Fatal Error Killed by another process

Process Internals States Running Ready Blocking Process Control Block State Registers & Memory PC, SP, Files Running Ready Blocked

Threads Lightweight Processes Threads handle all execution activities A thread is a program counter, a stack, and a set of registers Thread creation is relatively cheap in terms of CPU costs

Thread Usage Programming model becomes simpler Easy to create and destroy Speeds up applications Useful on systems with multiple CPUs

User-level threads User-level threads are managed by runtime library routines linked into each application so that thread management operations require no thread intervention User-level threads are also flexible; they can be customized to the needs of the language or user without kernel modification User-level threads execute within the context of traditional processes

Advantages and Disadvantages of User-Level Threads Thread operations do not have to cross protection boundary Parameters do not need to be copied Applications can link in the correct thread management policy for their needs

Advantages and Disadvantages of User-Level Threads Performance is inherently better in user- level threads User-level threads that issue blocking calls to the kernel will block an entire process

Threads in the Kernel Avoids the system integrations problems exhibited by user-level threads because the kernel directly schedules each applications threads onto physical processors Performance has been typical of an order magnitude worse than the best-case performance of user-level threads. Employ user-level threads, which have good performance and correct behavior provided the application is uniprogrammed and does no I/O, or employ kernel threads, which have worse performance but are not as restricted

Advantages and Disadvantages of Kernel-Level Threads Kernel threads are expensive! Kernel does not understand application behavior

User vs. Kernel Threads Software Threads No System Calls for Swapping Process-Blocking System Calls Dual-Conflicting Swaps Process Level Thread Kernel Level Process OS Threads Kernel Calls to Swap Threads Thread-Blocking System Calls Dual-Coordinated Swaps Kernel Level Thread Kernel Level Process

Hybrid Implementation Scheduler Activation Thread-aware Kernel for User-threads Violates Fundamental ‘Flow-of-Control’ Upcalls Pop-Up Threading Implicit Thread Creation Receives Message and processes them

Scheduler Activations Threads are needed for parallel applications User-level and kernel-level threads both have problems User-level threads offer good performance, but do not handle I/O well Kernel-level threads are expensive, but correct

Scheduler Activations SAs notify user-level schedulers of changes in kernel scheduling decisions SAs provide kernel space for threads that block in the kernel Create one activation for each virtual processor Kernel creates SAs to upcall into applications, notifying them of scheduling events

Scheduler Activations Key difference between SAs and kernel threads When an SA blocks, the application is notified by a different SA The blocking SA’s thread is marked blocked and the old SA is freed The new SA can now be scheduled The number of SAs under control of the application never changes (unless requested/told explicitly) Kernel level state is passed to thread system on upcall, so that registers of the blocking thread are accessible to the user-level scheduler

Popup Threads Thread is created spontaneously to handle an incoming request Incoming message mapped into thread’s address space Advantages over traditional request: No waiting on work (no context needs to be saved) Creating new thread is cheaper than restoring old thread (no context is saved)

Process Control Each Process must maintain it’s own PCB Information that Multiple Processes may use is duplicated

Thread Control Each Process has a PCB Each Thread has a TCB Shared information is Shared, not Duplicated

Scheduling Process Conditions Processor Bound I/O Bound Scheduling how? Preemptive Non-preemptive

Scheduler Goals Generic goals Fairness of processor allocation Enforcement of scheduling policies Balance of utilization Batch-based goals Throughput of jobs Turnaround on jobs

Scheduler Goals II Interactive System Goals Response time for user I/O Proportions should be maintained Real-time System Goals Deadlines must be met for process completion System performance must be predictable

The End