The Execution Of Sleep()

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

A look at interrupts What are interrupts and why are they needed.
A. Frank - P. Weisberg Operating Systems Process Scheduling and Switching.
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.
A look at interrupts What are interrupts and why are they needed in an embedded system? Equally as important – how are these ideas handled on the Blackfin.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Processes 1 CS502 Spring 2006 Processes Week 2 – CS 502.
OS Spring’03 Introduction Operating Systems Spring 2003.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
A look at interrupts What are interrupts and why are they needed.
1 When to Switch Processes 3 triggers –System call, Interrupt and Trap System call –when a user program invokes a system call. e.g., a system call that.
CPS110: Implementing threads/locks on a uni-processor Landon Cox.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
OS Spring’04 Introduction Operating Systems Spring 2004.
System Calls 1.
Operating Systems Lecture 2 Processes and Threads Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Tami Meredith, Ph.D. CSCI  Devices need CPU access  E.g., NIC has a full buffer it needs to empty  These device needs are often asynchronous.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Computer Studies (AL) Operating System Process Management - Process.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Lecture Topics: 10/29 Architectural support for operating systems –timers –kernel mode –system calls –protected instructions.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
Operating Systems CMPSC 473 Signals, Introduction to mutual exclusion September 28, Lecture 9 Instructor: Bhuvan Urgaonkar.
The OS 215 Project. 2 OS 215 Project Outline Architecture of the Simulator Environment Z215 Hardware Organization and Architecture Generic Operating System.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
Process Synchronization. Concurrency Definition: Two or more processes execute concurrently when they execute different activities on different devices.
Scheduler activations Landon Cox March 23, What is a process? Informal A program in execution Running code + things it can read/write Process ≠
Tutorial 2: Homework 1 and Project 1
Multiprogramming. Readings r Chapter 2.1 of the textbook.
WORKING OF SCHEDULER IN OS
Chapter 13 The Function of Operating Systems
Process concept.
Process Management Process Concept Why only the global variables?
CS 6560: Operating Systems Design
OPERATING SYSTEMS CS3502 Fall 2017
Protection of System Resources
A Step By Step Picture of How Processes Schedule (Using Test4 and TestX as examples) Version 4.40: September 2017.
Scheduler activations
Day 08 Processes.
Day 09 Processes.
CS 3305 System Calls Lecture 7.
Real-time Software Design
Structure of Processes
Module 2: Computer-System Structures
Processor Fundamentals
Process & its States Lecture 5.
TIARA Thread Management
Process Description and Control
CSE 451 Autumn 2003 Section 3 October 16.
Operating Systems Lecture 3.
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
Processes David Ferry CSCI 3500 – Operating Systems
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Process Description and Control in Unix
Process Description and Control in Unix
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Presentation transcript:

The Execution Of Sleep() User Program User Address Space 1 SLEEP Ready Queue 15 Running Process dispatcher() SVC (Handle system call) 6 14 10 give_up_cpu() make_ready_to_run() 5 9 2 3 Timer Queue 8 Start_ Timer Clock_Handler Kernel Address Space 11 Interrupt_Handler 4 12 7 13 Hardware CLOCK

The Execution Of Sleep() Step 1: The user level program does a sleep() system call. Step 2: The system call traps to the kernel, ending up in a predetermined location that’s equipped to handle system calls. The system call handler determines the request is a sleep and passes the request to a routine Start_Timer. Step 3: The Start_Timer routine enques the PCB onto the timer queue. Step 4: The Start_Timer routine invokes the hardware clock and asks it to interrupt at some time in the future. Step 5: The process has nothing to do until the sleep completes, so it calls give_up_cpu(). Step 6: give_up_cpu() unloads the process from the processor and calls the dispatcher to find someone else to run. The dispatcher looks on the ready Q to find the next process to run. If there’s noone to run, then it loops waiting for something to appear on the ready Q. If there is something there, run it. Step 7: At some time, the hardware clock interrupts. The hardware interrupt routine determines that it’s the clock that’d done the interrupt. Step 8: The clock interrupt handler goes to the Timer Queue and extracts the PCB for the process that originally generated the interrupt. Step 9: The clock handler takes that PCB and calls make_ready_to_run. Step 10: make_ready_to_run puts that PCB on the ready queue in the appropriate order. Step 11: The clock handler looks on the timer queue to see if some other process wants to use the timer. Step 12: If yes, start the timer with the new request. Step 13: The interrupt is now complete. The user process that was interrupted can now continue. Step 14: At some point the dispatcher is called on to find the next process to run. The PCB of the process that was sleeping is taken off the Ready Queue and is loaded on the processor. Step 15: The subroutine calls now unwind, going back through start timer, back through the system call handler, and finally back to the user process. It starts there at the line after the sleep() call. Note the names used here are generic and are not meant to imply a particular routine on a particular OS.