Operating Systems, Fall

Similar documents
Chap. 3. Input/Output

Chapter 5 Input/Output. I/O Devices

CS330: Operating System and Lab. (Spring 2006) I/O Systems

CSE 380 Computer Operating Systems

Operating Systems, Fall

I/O Device Controllers. I/O Systems. I/O Ports & Memory-Mapped I/O. Direct Memory Access (DMA) Operating Systems 10/20/2010. CSC 256/456 Fall

Operating Systems, Fall

UC Santa Barbara. Operating Systems. Christopher Kruegel Department of Computer Science UC Santa Barbara

Input/Output. Chapter 5: I/O Systems. How fast is I/O hardware? Device controllers. Memory-mapped I/O. How is memory-mapped I/O done?

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

I/O Systems. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

I/O Systems. Jo, Heeseung

Chapter 11 I/O Management and Disk Scheduling

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

CSE380 - Operating Systems. Communicating with Devices

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

I/O Systems and Storage Devices

I/O Management and Disk Scheduling. Chapter 11

CSE 120. Overview. July 27, Day 8 Input/Output. Instructor: Neil Rhodes. Hardware. Hardware. Hardware

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

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College

I/O & Storage. Jin-Soo Kim ( Computer Systems Laboratory Sungkyunkwan University

CS510 Operating System Foundations. Jonathan Walpole

Main Points of the Computer Organization and System Software Module

I/O Handling. ECE 650 Systems Programming & Engineering Duke University, Spring Based on Operating Systems Concepts, Silberschatz Chapter 13

Chapter 5 Input/Output

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

19: I/O. Mark Handley. Direct Memory Access (DMA)

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

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

1993 Paper 3 Question 6

PROCESS SCHEDULING II. CS124 Operating Systems Fall , Lecture 13

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

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

QUESTION BANK UNIT I

Input/Output. Today. Next. ! Principles of I/O hardware & software! I/O software layers! Secondary storage. ! File systems

Today: Secondary Storage! Typical Disk Parameters!

I/O, Disks, and RAID Yi Shi Fall Xi an Jiaotong University

Introduction Disks RAID Tertiary storage. Mass Storage. CMSC 420, York College. November 21, 2006

Operating System Design Issues. I/O Management

EECS 571 Principles of Real-Time Embedded Systems. Lecture Note #10: More on Scheduling and Introduction of Real-Time OS

I/O Design, I/O Subsystem, I/O-Handler Device Driver, Buffering, Disks, RAID January WT 2008/09

Chapter 11. I/O Management and Disk Scheduling

Device-Functionality Progression

Chapter 12: I/O Systems. I/O Hardware

Operating Systems 2010/2011

Operating Systems, Fall Lecture 5, Tiina Niklander 1

Block Device Scheduling. Don Porter CSE 506

Block Device Scheduling

Operating Systems, Fall

Discussion Week 8. TA: Kyle Dewey. Tuesday, November 15, 11

V. Mass Storage Systems

Chapter 13: I/O Systems

Introduction. CS3026 Operating Systems Lecture 01

CSCI-GA Operating Systems I/O. Hubertus Franke

Hard Disk Drives (HDDs) Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Secondary storage. File systems

Hardware OS & OS- Application interface

Hard Disk Drives (HDDs)

CS3600 SYSTEMS AND NETWORKS

Systemy RT i embedded Wykład 11 Systemy RTOS

UNIT 4 Device Management

STORAGE SYSTEMS. Operating Systems 2015 Spring by Euiseong Seo

Commercial Real-time Operating Systems An Introduction. Swaminathan Sivasubramanian Dependable Computing & Networking Laboratory

CSE 120. Operating Systems. March 27, 2014 Lecture 17. Mass Storage. Instructor: Neil Rhodes. Wednesday, March 26, 14

Operating Systems, Fall

Operating Systems, Fall

Operating Systems, Fall

Input/Output Management

File. File System Implementation. File Metadata. File System Implementation. Direct Memory Access Cont. Hardware background: Direct Memory Access

Block Device Scheduling. Don Porter CSE 506

Input/Output Systems Prof. James L. Frankel Harvard University

Chapter 13: I/O Systems

Multimedia Systems 2011/2012

Uniprocessor Scheduling. Basic Concepts Scheduling Criteria Scheduling Algorithms. Three level scheduling

Lecture 15: I/O Devices & Drivers

Module 12: I/O Systems

C02: Interrupts and I/O

CS370 Operating Systems

Week 2: Tiina Niklander

OPERATING SYSTEMS CS136

Outlines. Chapter 2 Storage Structure. Structure of a DBMS (with some simplification) Structure of a DBMS (with some simplification)

Operating Systems. V. Input / Output

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

I/O MANAGEMENT CATEGORIES OF I/O DEVICES 1. Slide 1. Slide 3. Controller: Three classes of devices (by usage):

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

Operating Systems. Mass-Storage Structure Based on Ch of OS Concepts by SGG

The control of I/O devices is a major concern for OS designers

(b) External fragmentation can happen in a virtual memory paging system.

Multimedia-Systems. Operating Systems. Prof. Dr.-Ing. Ralf Steinmetz Prof. Dr. rer. nat. Max Mühlhäuser Prof. Dr.-Ing. Wolfgang Effelsberg

Operating Systems 2010/2011

Lecture 13 Input/Output (I/O) Systems (chapter 13)

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

CS510 Operating System Foundations. Jonathan Walpole

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

CSCI-GA Database Systems Lecture 8: Physical Schema: Storage

CS370: Operating Systems [Fall 2018] Dept. Of Computer Science, Colorado State University

-Device. -Physical or virtual thing that does something -Software + hardware to operate a device (Controller runs port, Bus, device)

Transcription:

Input / Output & Real-time Scheduling Chapter 5.1 5.4, Chapter 7.5 1 I/O Software Device controllers Memory-mapped mapped I/O DMA & interrupts briefly I/O Content I/O software layers and drivers Disks and RAID Clock Briefly about Power management 2 Lecture 8, Tiina Niklander 1

I/O Software 3 Goals of I/O Software Device independence programs can access any I/O device without specifying device in advance Uniform naming name of a file or device a string or an integer not depending on which machine Error handling handle as close to the hardware as possible Synchronous vs. asynchronous transfers blocked transfers vs. interrupt- driven Buffering data coming off a device cannot be stored in final destination Sharable vs. dedicated devices disks are sharable tape drives would not be 4 Lecture 8, Tiina Niklander 2

I/O Communication Techniques Programmed I/O CPU continuously studies the control registers in loop busy-wait Interrupt-driven I/O CPU gives task to controller and continues with something else Controller makes an interrupt, when ready CPU moves the data between controller and memory Direct Memory Access, DMA DMA-controller knows how to access memory directly Interrupt only, when the transfer is fully done 5 I/O Communication Techniques Sta Fig 1.19 6 Lecture 8, Tiina Niklander 3

I/O Software Layers Layers of the I/O Software System 7 Interrupt Handlers Interrupts are best hidden have driver starting an I/O operation block until interrupt notifies of completion Interrupt procedure does its task then unblocks driver that started it The interrupt handling software must perform several steps after hardware interrupt completed list on next page 8 Lecture 8, Tiina Niklander 4

Interrupt Handlers 1. Save regs not already saved by interrupt hardware 2. Set up context for interrupt service procedure 3. Set up stack for interrupt service procedure 4. Ack interrupt controller, reenable interrupts 5. Copy registers from where saved 6. Run service procedure 7. (Choose which process to run next ) 8. Set up MMU context for process to run next 9. Load new process' registers 10. Start running the new process 9 Device Drivers Each device (type) has its own device driver Code written by the manufacturer of the device Still part of the OS kernel! OS designer Architecture must allow such installation Well-defined model of interactions and driver s tasks Two standard interfaces: block devices, character devices How to add or remove drivers Recompilation of the kernel, if single binary file Dynamically loaded during execution Driver code alternatives Blocking vs non blocking Reentrant code No system calls allowed, but some specific kernel procedures available 10 Lecture 8, Tiina Niklander 5

Logical Positioning of Device Drivers 11 Device-Independent I/O Software Uniform interfacing for device drivers To avoid modifying kernel code for new drivers Driver contains a function pointer table for kernel to locate the functions needed in the interface Naming of I/O devices, protection Buffering Used for efficiency; inefficient, if too many Error reporting Error device-specific, framework for error handling general Allocating and releasing dedicated devices Providing a device-independent independent block size 12 Lecture 8, Tiina Niklander 6

Buffering alternatives (a) Unbuffered input (b) Buffering in user space (c) Buffering in the kernel followed by copying to user space (d) Double buffering in the kernel 13 Buffering and networking Networking may involve many copies 14 Lecture 8, Tiina Niklander 7

Layers of the I/O system 15 Disks 16 Lecture 8, Tiina Niklander 8

RAID 0,1,2 0: strips, no redundancy 1: Mirroring (with strips) 2: bits, uses Hamming code 17 RAID 3,4,5 3: bits, uses Parity bit 4: strips, with strip-for-strip parity on dedicated disk 5: strips, distributing parity strips uniformly 18 Lecture 8, Tiina Niklander 9

RAID table Tbl 11.4 [Stal 05] 19 RAID at CS dept. (since 2007) File servers: group ja fs RAID overhead 14% (1/7) 6 RAID5 servers using 7 (+ 1 hot spare), each server total 1,6 TB /group, /fs /fs - 0, /fs - 1, /fs - 2, /fs - 3 (user directories divided to these) Similar, but smaller disks: courier.cs.helsinki.fi (mailserver) - 0,9 TB RAID overhead 20% (1/5) 4 RAID5 servers using 5 disks (each 146 GB), total 550 GB backup for backuping user files from fs (used already in 2007) copy each /fs-i i here and stream using 2 tape robots SW RAID 5 in Linux kernel, since the robot controller and hardware RAID controller were not working together correctly db.cs.helsinki.fi (database server) winserver.cs.helsinki.fi (Windows 2003 Terminal Server) bodbacka.cs.helsinki.fi 20 Lecture 8, Tiina Niklander 10

RAID at CS dept. (since 2007) RAID 1 using 2 disks times 2 RAID-1 1 nameserver (Hydra) RAID overhead 50% (1/2) redundancy overhead 50% RAID 5 using 4 disks, total 0.9 TB (Bioinformatiikka) RAID 5 using 4 disks, total 0.45 TB (b-course) RAID overhead 25% (1/4) 2 RAID 5 servers using 5 disks, each total 0.6 TB (Vera, Chuck) Mainly for number crunching (32 GB), disk space is not crucial 21 Disk Arm Scheduling Time required to read or write a disk block determined by 3 factors 1. Seek time 2. Rotational delay 3. Actual transfer time Seek time dominates Error checking is done by controllers 22 Lecture 8, Tiina Niklander 11

Disk Arm Scheduling Algorithms Goal: Reduce the mean seek time Random? FIFO? PRI? LIFO? Do not consider the current arm position Improvement: order the requests SSF - shortest seek first SCAN, LOOK elevator algorithm Assumption: The real disk geometry matches the virtual, assumed, geometry this may not be true with disks where the controller can do error correction with replacements sectors. 23 Shortest Seek First (SSF) Handle the closest request next, minimize seek time On a heavily loaded disk, the arm has a tendency to stay in the middle of the disk most of the time Old requests on either extreme can suffer with long delays Fairness? 24 Lecture 8, Tiina Niklander 12

Elevator (SCAN, LOOK) Move the arm only to one direction (UP or DOWN) and serve the closest request in that direction When all requests in that direction handled, start moving to the other direction 25 Error Handling (a) A disk track with a bad sector (b) Substituting a spare for the bad sector Reading the whole track takes two turns (b) Shifting all the sectors to bypass the bad one Reading continuous, but more bookkeeping for the controller 26 Lecture 8, Tiina Niklander 13

In controller: Error Handling The methods on previous page are suitable Need remapping tables In operating system (or its driver): Bad sector information from the disk Remove these from free list and allocated files, can f.eg. create a special bad-blocks blocks file (not in the file hierarchy) Backup and bad sectors: Sector level backup will try to read the bad sectors also File level backup must not find the bad block file 27 Real-time scheduling Section 7.5. Multimedia Process Scheduling 28 Lecture 8, Tiina Niklander 14

Real-time systems In addition to the correct results, they must be reached within a given time limit (not too early, not too late) Reacts to external events (and time) Terms: Hard Real-time vs. Soft Real-time Periodic vs aperiodic Static vs dynamic scheduling Requirements: Configurable, deterministic, reliablity, responsiveness, Programmers decide characteristics of the rt processes 29 Multimedia Process Scheduling Periodic processes displaying a movie Frame rates and processing requirements may be different for each movie 30 Lecture 8, Tiina Niklander 15

Interrupt handling delays 31 RT scheduling Timely execution the most important issue No fairness, no minimising the response time OS can only guess the actual execution time Programmer gives some estimates, period gives hints Quite often: just schedule rt-tasks tasks fast High priority, predetermined schedule plan, others can suffer Two main alternative for dynamic scheduling Earliest Deadline First (EDF) Rate Monotonic Scheduling (RM) 32 Lecture 8, Tiina Niklander 16

Rate Monotonic Scheduling Used for processes which meet these conditions 1. Each periodic process must complete within its period 2. No process dependent on any other process 3. Each process needs same CPU time each burst 4. Any nonperiodic processes have no deadlines 5. Process preemption occurs instantaneously, no overhead 33 Real Time Scheduling Real Time Scheduling algorithms RMS EDF 34 Lecture 8, Tiina Niklander 17

Real Time Scheduling Another example of real-time scheduling with RMS and EDF 35 Schedulability test Obviously for any schedule, the schedulable utilisation: U i = C 1 /T 1 + C 2 /T 2 +.. + C n /T n <= 1 Sufficient condition for schedulability using RM scheduling C 1 /T 1 + C 2 /T 2 +.. + C n /T n <= n(2 1/n - 1) N is number of tasks, the upper limit for the value is ln2 ~ 0.693 -> for any i U i < 0.693 For EDF the sufficient and effective condition is U i = C 1 /T 1 + C 2 /T 2 +.. + C n /T n <= 1 36 Lecture 8, Tiina Niklander 18

What can go wrong? Higher priority task may have to wait! for a shared resource Priority inversion, deadlocks, Solution: Non-preemptable (uninterruptible) critical sections Priority inheritance Priority ceiling protocol 37 Priority inversion on Mars Pathfinder (1997) http://research.microsoft.com/~mbj/mars_pathfinder/mars_pathfinder.html 38 Lecture 8, Tiina Niklander 19