I/O Systems (3): Clocks and Timers. CSE 2431: Introduction to Operating Systems

Similar documents
19: I/O Devices: Clocks, Power Management

Lecture 21 Disk Devices and Timers

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

I/O. Fall Tore Larsen. Including slides from Pål Halvorsen, Tore Larsen, Kai Li, and Andrew S. Tanenbaum)

Computer-System Structures

Common Computer-System and OS Structures

I/O Devices. Chapter 5 Input/Output. Memory-Mapped I/O (2) Memory-Mapped I/O (1) Interrupts Revisited. Direct Memory Access (DMA) 11/26/2013

Brief tour of hardware

OPERATING SYSTEMS CS136

Computer-System Architecture

Computer-System Architecture. Common Functions of Interrupts. Computer-System Operation. Interrupt Handling. Chapter 2: Computer-System Structures

Chapter 5 - Input / Output

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

CSCI-GA Operating Systems I/O. Hubertus Franke

Instruction Cycle. Computer-System Architecture. Computer-System Operation. Common Functions of Interrupts. Chapter 2: Computer-System Structures

Module 2: Computer-System Structures. Computer-System Architecture

Real-Time Concepts for Embedded Systems Author: Qing Li with Caroline Yao

Virtual Memory Outline

A Global Operating System for HPC Clusters

Operating System Review

Optimal Algorithm. Replace page that will not be used for longest period of time Used for measuring how well your algorithm performs

Chapter 1: Introduction. Operating System Concepts 8th Edition,

Interrupt response times on Arduino and Raspberry Pi. Tomaž Šolc

ELEG3923 Microprocessor Ch.9 Timer Programming

Timers 1 / 46. Jiffies. Potent and Evil Magic

Timers and Counters. LISHA/UFSC Prof. Dr. Antônio Augusto Fröhlich Fauze Valério Polpeta Lucas Francisco Wanner.

ò mm_struct represents an address space in kernel ò task represents a thread in the kernel ò A task points to 0 or 1 mm_structs

Scheduling. Don Porter CSE 306

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

15: OS Scheduling and Buffering

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. One OS function is to control devices

Introduction. Operating Systems. Outline. Hardware. I/O Device Types. Device Controllers. (done)

I/O Systems (4): Power Management. CSE 2431: Introduction to Operating Systems

instruction is 6 bytes, might span 2 pages 2 pages to handle from 2 pages to handle to Two major allocation schemes

Operating Systems. Introduction & Overview. Outline for today s lecture. Administrivia. ITS 225: Operating Systems. Lecture 1

EMBEDDED SOFTWARE DEVELOPMENT. George Hadley 2017, Images Property of their Respective Owners

Architectural Support for Operating Systems

Processes. Sanzheng Qiao. December, Department of Computing and Software

AVR XMEGA Product Line Introduction AVR XMEGA TM. Product Introduction.

ANALYSIS OF A DYNAMIC FREQUENCY SCALING ALGORTIHM ON XSCALE.

Application Note One Wire Digital Output. 1 Introduction. 2 Electrical Parameters for One Wire Interface. 3 Start and Data Transmission

This section will cover the core initialization process.

Inf2C - Computer Systems Lecture 16 Exceptions and Processor Management

8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization

TCPivo A High-Performance Packet Replay Engine. Wu-chang Feng Ashvin Goel Abdelmajid Bezzaz Wu-chi Feng Jonathan Walpole

Real Time Embedded Systems. Lecture 1 January 17, 2012

Computer Science Window-Constrained Process Scheduling for Linux Systems

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Section 10. Watchdog Timer and Power Saving Modes

Network performance. slide 1 gaius. Network performance

PC-CARD-DAS16/12 Specifications

ECE 3055: Final Exam

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

BOOST YOUR SYSTEM PERFORMANCE USING THE ZILOG ESCC CONTROLLER

PC-CARD-DAS16/16 Specifications

Lecture 2 - Fundamental Concepts

MCS-51 Serial Port A T 8 9 C 5 2 1

CS 341l Fall 2008 Test #4 NAME: Key

Even coarse architectural trends impact tremendously the design of systems

Chapter 2. Overview of Architecture and Microcontroller-Resources

Power Management for Embedded Systems

CS3600 SYSTEMS AND NETWORKS

POWER MANAGEMENT AND ENERGY EFFICIENCY

CS 31: Intro to Systems Operating Systems Overview. Kevin Webb Swarthmore College March 31, 2015

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

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

Asynchronous Events on Linux

High level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels

General Purpose Programmable Peripheral Devices. Assistant Professor, EC Dept., Sankalchand Patel College of Engg.,Visnagar

CS399 New Beginnings. Jonathan Walpole

Swapping. Operating Systems I. Swapping. Motivation. Paging Implementation. Demand Paging. Active processes use more physical memory than system has

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

Lecture 6: Real-Time Timing + Real-Time Objects

Micrium µc/os II RTOS Introduction EE J. E. Lumpp

Memory Management Outline. Operating Systems. Motivation. Paging Implementation. Accessing Invalid Pages. Performance of Demand Paging

CENG-336 Introduction to Embedded Systems Development. Timers

18-349: Introduction to Embedded Real-Time Systems

I/O Hardwares. Some typical device, network, and data base rates

Multics Technical Bulletin MTB-488. To: Distribution From: John J. Bongiovanni Date: 01/20/81 CPU Time Accounting

Page Replacement. 3/9/07 CSE 30341: Operating Systems Principles

Process Scheduling Queues

A Smart Port Card Tutorial --- Hardware

ECE 477 Digital Systems Senior Design Project. Module 10 Embedded Software Development

Operating Systems (2INC0) 2018/19. Introduction (01) Dr. Tanir Ozcelebi. Courtesy of Prof. Dr. Johan Lukkien. System Architecture and Networking Group

Architectural design proposal for real time clock for wireless microcontroller unit

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

Real-Time Operating Systems (Working Draft) What is an Operating System (OS)?

Section 9. Watchdog Timer and Power-up Timer

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interrupt Programming in Embedded C Module No: CS/ES/20 Quadrant 1 e-text

Section I Section Real Time Systems. Processes. 1.6 Input/Output Management. (Textbook: A. S. Tanenbaum Modern OS - ch. 5)

Unit 2 : Computer and Operating System Structure

Virtual Memory Review. Page faults. Paging system summary (so far)

MODERN OPERATING SYSTEMS. Chapter 3 Memory Management

Four Components of a Computer System

Scheduling Mar. 19, 2018

CS510 Operating System Foundations. Jonathan Walpole

CS 471 Operating Systems. Yue Cheng. George Mason University Fall 2017

CS 326: Operating Systems. CPU Scheduling. Lecture 6

Memory management units

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels

Transcription:

I/O Systems (3): Clocks and Timers CSE 2431: Introduction to Operating Systems 1

Outline Clock Hardware Clock Software Soft Timers 2

Two Types of Clocks Simple clock: tied to the 110- or 220-volt power line and causes an interrupt on every voltage cycle, at 50 or 60 Hz. The other type, used in modern computers, is based on crystal oscillator. High accuracy, in the range of several hundred megahertz 3

Clock Hardware A programmable clock 4

Programmable Clocks Two modes One-shot mode vs. Square-wave mode Periodic interrupts are called clock ticks Interrupt frequency can be controlled by software E.g., with 500-MHz crystal and unsigned 32-bit registers, we can generate interrupts at intervals from 2 ns to 8.6 s. 5

Battery-powered Backup Clock To prevent the current time from being lost when power is off This clock is read at startup The time is translated into the number of clock ticks since a certain point of origin Jan. 01, 1970 for UNIX Jan. 01, 1980 for Windows At every clock tick, the real time is incremented by one count 6

Clock Software Common duties of clock software Maintaining the time of day Preventing processes from running longer than they are allowed to Accounting for CPU usage Handling the alarm system call made by user processes Providing watchdog timers for parts of the system itself Doing profiling, monitoring, and statistics gathering 7

Maintaining the Time of Day With a clock rate of 60 Hz, a 32-bit counter will overflow in just over 2 years. What should we do? 8

Preventing Processes from Running Too Long When a process is started, the scheduler initializes a counter to the value of that process s quantum in clock ticks At every clock interrupt, the clock driver decrements the quantum counter by 1. When the counter gets to zero, the clock driver calls the scheduler to set up another process 9

CPU Accounting The most accurate way is to use a second timer, distinct from the main system timer. A less accurate, but simpler, way is to charge the running process at the time of tick. What if many interrupts occur during a process run? 10

Handling Alarm System Calls A process requests OS to give it a warning after a certain interval E.g., time out for network packet transmission OS simulates virtual clocks with a single physical clock, each virtual clock for one process Using a table to store signal times Using a linked list to store signal times 11

Simulate Multiple Timers On each tick, the value in Next signal is decremented by one 12

Watchdog Timers Part of the operating system also need to set timers (called watchdog timers) A process reads data from an idle floppy disk The mechanism for watchdog timers is the same as that for user signals The only difference is the clock driver calls a procedure supplied by the caller, rather than causing a signal when a timer goes off 13

Profiling A mechanism to build up a histogram of its program counter so that a user program can see where it is spending its time At every tick, the driver checks to see if the current process is being profiled, if so, computes the bin# (a range of addresses) corresponding to the current program counter. It then increments that bin by one. This mechanism can also be used to profile the system itself 14

Motivation for Soft Timers A second clock available for timer interrupts Specified by applications No problems if interrupt frequency is low Two ways to manage I/O Interrupt: low latency, but overhead due to context switching and their influence on the pipeline, TLB, and cache is high Polling: high latency 15

Soft Timers Soft timers avoid interrupts Kernel checks for soft timer expiration before it exits to user mode If the timer expires, the scheduled event (.e.g, packet transmission) is performed, with no context switch Then the soft timer is reset to go off again How well this works depends on rate of kernel entries 16

Reasons for Kernel Entries System calls TLB misses Page faults I/O interrupts CPU going idle 17

An Example for Soft Timers Gigabit Ethernet accepting or delivering a full-size packet every 12 µs An interrupt takes 4.45 µs on a 300 MHz, 35% overhead [AD99] Intervals of kernel entry are 2 18 µs with several CPU loads [AD99] It is doable with a soft timer go off every 12 µs (with an occasional missed deadline) [AD99] M. Aron and P. Druschel, Soft Timers, ACM Trans. Comput. Syst., vol. 18, no. 3, 1999, pp. 197 228. 18

Summary Clock Hardware Clock Software Soft Timers 19