Processes and Threads.

Slides:



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

Scheduling Introduction to Scheduling
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Pertemuan 13 Threads Matakuliah: H0483 / Network Programming Tahun: 2005 Versi: 1.0.
Operating Systems COMP 4850/CISG 5550 Processes Introduction to Threads Dr. James Money.
Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
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.
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
Avishai Wool lecture Priority Scheduling Idea: Jobs are assigned priorities. Always, the job with the highest priority runs. Note: All scheduling.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Ceng Operating Systems Chapter 2.5 : Threads Process concept  Process scheduling  Interprocess communication  Deadlocks  Threads.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
1 What is a Process ? The activity of program execution. Also called a task or job Has associated with it: Code Data Resources A State An executing set.
CSCE 351: Operating System Kernels
Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S. TANENBAUM ALBERT S. WOODHULL Yan hao (Wilson) Wu University of the Western.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
Process Description and Control. Process concepts n Definitions – replaces task, job – program in execution – entity that can be assigned to and executed.
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Processes and threads Processes Threads Scheduling
1 Process States (1) Possible process states –running –blocked –ready Transitions between states shown.
Scheduling Chap 2. Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait –a CPU-bound process –an I/O bound.
1 Processes Chapter Processes 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
10/16/ Realizing Concurrency using the thread model B. Ramamurthy.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
1 Processes, Threads, Race Conditions & Deadlocks Operating Systems Review.
1 Scheduling The part of the OS that makes the choice of which process to run next is called the scheduler and the algorithm it uses is called the scheduling.
B. RAMAMURTHY 10/24/ Realizing Concurrency using the thread model.
1 Processes Management 1 Processes 2 Threads 3 IPC problems 4 Processes Scheduling 5 Deadlock.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-1: Process Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Operating Systems Scheduling. Bursts of CPU usage alternate with periods of waiting for I/O. (a) A CPU-bound process. (b) An I/O-bound process. Scheduling.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Operating Systems Processes 1.
ITFN 3601 Introduction to Operating Systems Lecture 3 Processes, Threads & Scheduling Intro.
1 Chapter 2.5 : Threads Process concept  Process concept  Process scheduling  Process scheduling  Interprocess communication  Interprocess communication.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Shahriar Pirnia Operating system سيستم عامل.
Processes and Threads MICROSOFT.  Process  Process Model  Process Creation  Process Termination  Process States  Implementation of Processes  Thread.
1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 2-2: Threads Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
操作系统原理 OPERATING SYSTEM Chapter 2 Processes and Threads 进程与线程.
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
B. RAMAMURTHY 5/10/2013 Amrita-UB-MSES Realizing Concurrency using the thread model.
7/9/ Realizing Concurrency using Posix Threads (pthreads) B. Ramamurthy.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Realizing Concurrency using the thread model
Operating Systems Process Managment.
Realizing Concurrency using the thread model
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Realizing Concurrency using Posix Threads (pthreads)
Realizing Concurrency using the thread model
Implementing Threads in User Space
Module 2.1 COP4600 – Operating Systems Richard Newman
Operating Systems Chapter 2: Processes and Threads
Realizing Concurrency using the thread model
Processes and Threads Part III
Process Description and Control
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Process Description and Control
Realizing Concurrency using the thread model
Realizing Concurrency using Posix Threads (pthreads)
Realizing Concurrency using the thread model
Realizing Concurrency using Posix Threads (pthreads)
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
CS510 Operating System Foundations
Thread Model for Work Unit
Process Management -Compiled for CSIT
Presentation transcript:

Processes and Threads

Processes The Process Model Multiprogramming of four programs Conceptual model of 4 independent, sequential processes Only one program active at any instant

Process Creation Principal events that cause process creation System initialization Execution of a process creation system User request to create a new process Initiation of a batch job

Process Termination Conditions which terminate processes Normal exit (voluntary) Error exit (voluntary) Fatal error (involuntary) Killed by another process (involuntary)

Process Hierarchies Parent creates a child process, child processes can create its own process Forms a hierarchy UNIX calls this a "process group" Windows has no concept of process hierarchy all processes are created equal

Process States (1) Possible process states running blocked ready Transitions between states shown

Process States (2) Lowest layer of process-structured OS handles interrupts, scheduling Above that layer are sequential processes

Implementation of Processes (1) Fields of a process table entry

Implementation of Processes (2) Skeleton of what lowest level of OS does when an interrupt occurs

Threads The Thread Model (1) (a) Three processes each with one thread (b) One process with three threads

The Thread Model (2) Items shared by all threads in a process Items private to each thread

Each thread has its own stack The Thread Model (3) Each thread has its own stack

A word processor with three threads Thread Usage (1) A word processor with three threads

A multithreaded Web server Thread Usage (2) A multithreaded Web server

Three ways to construct a server Thread Usage (4) Three ways to construct a server

Implementing Threads in User Space A user-level threads package

Implementing Threads in the Kernel A threads package managed by the kernel

Hybrid Implementations Multiplexing user-level threads onto kernel- level threads

Scheduler Activations Goal – mimic functionality of kernel threads gain performance of user space threads Avoids unnecessary user/kernel transitions Kernel assigns virtual processors to each process lets runtime system allocate threads to processors Problem: Fundamental reliance on kernel (lower layer) calling procedures in user space (higher layer)

Interprocess Communication Race Conditions Two processes want to access shared memory at same time

Critical Regions (1) Four conditions to provide mutual exclusion No two processes simultaneously in critical region No assumptions made about speeds or numbers of CPUs No process running outside its critical region may block another process No process must wait forever to enter its critical region

Mutual exclusion using critical regions

Barriers Use of a barrier processes approaching a barrier all processes but one blocked at barrier last process arrives, all are let through

Scheduling Introduction to Scheduling (1) Bursts of CPU usage alternate with periods of I/O wait a CPU-bound process an I/O bound process

Introduction to Scheduling (2) Scheduling Algorithm Goals

Scheduling in Batch Systems (1) An example of shortest job first scheduling

Scheduling in Batch Systems (2) Three level scheduling

Scheduling in Interactive Systems (1) Round Robin Scheduling list of runnable processes list of runnable processes after B uses up its quantum

Scheduling in Interactive Systems (2) A scheduling algorithm with four priority classes

Policy versus Mechanism Separate what is allowed to be done with how it is done a process knows which of its children threads are important and need priority Scheduling algorithm parameterized mechanism in the kernel Parameters filled in by user processes policy set by user process

Thread Scheduling (1) Possible scheduling of user-level threads 50-msec process quantum threads run 5 msec/CPU burst

Thread Scheduling (2) Possible scheduling of kernel-level threads 50-msec process quantum threads run 5 msec/CPU burst