Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved. 0-13-142938-8 OPERATING SYSTEMS DESIGN.

Slides:



Advertisements
Similar presentations
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Advertisements

Principles of I/O Hardware I/O Devices Block devices, Character devices, Others Speed Device Controllers Separation of electronic from mechanical components.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Input and Output CS 215 Lecture #20.
Operating Systems Operating Systems - Winter 2009 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Avishai Wool lecture Introduction to Systems Programming Lecture 8 Input-Output.
Part 5 (Stallings) Input/Output 5.1 Principles of I/O hardware
1 Input/Output Chapter Principles of I/O hardware 5.2 Principles of I/O software 5.3 I/O software layers 5.4 Disks 5.5 Clocks 5.6 Character-oriented.
EEE 435 Principles of Operating Systems Principles and Structure of I/O Software (Modern Operating Systems 5.2 & 5.3) 5/22/20151Dr Alain Beaulieu.
Operating Systems COMP 4850/CISG 5550 Deadlock Avoidance Dr. James Money.
Chapter 3 Deadlocks TOPICS Resource Deadlocks The ostrich algorithm
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All.
Tanenbaum Ch 6 Silberschatz Ch 7
Chapter 5 Input/Output Clocks User Interfaces: Keyboard, Mouse Power.
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
1 Wednesday, June 28, 2006 Command, n.: Statement presented by a human and accepted by a computer in such a manner as to make the human feel that he is.
I/O Hardware n Incredible variety of I/O devices n Common concepts: – Port – connection point to the computer – Bus (daisy chain or shared direct access)
Chapter 3 Deadlocks 3.1. Resource 3.2. Introduction to deadlocks
04/16/2010CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying an earlier edition.
Witawas Srisa-an Chapter 6
Chapter 5 Input/Output 5.1 Principles of I/O hardware
Input/Output The messiest part of O.S.
Pertemuan 20 Character oriented terminal
Deadlock Detection with One Resource of Each Type (1)
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 3 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.
Chapter 6 Deadlocks Resources Introduction Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
1 Input/Output Chapter 3 TOPICS Principles of I/O hardware Principles of I/O software I/O software layers Disks Clocks Reference: Operating Systems Design.
1 Today I/O Systems Storage. 2 I/O Devices Many different kinds of I/O devices Software that controls them: device drivers.
Chapter 5 Input/Output I/O Hardware I/O Software Software Layers Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights.
Operating Systems Input/Output Devices (Ch 5: )
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
INPUT-OUTPUT ORGANIZATION
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
INPUT/OUTPUT Operating system controls all I/O devices
I/O Resource Management The operating system is responsible for: Issuing commands to I/O devices Handling all interrupts and errors generated by the.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 8-1: I/O Management Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
Sistem Operasi IKH311 Masukan Luaran (Input/Output)
CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
I/O Systems I/O Hardware Application I/O Interface
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS6: Device Management 6.1. Principles of I/O.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
1 MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 6 Deadlocks Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 5 Input/Output 5.1 Principles of I/O hardware
CSC 322 Operating Systems Concepts Lecture - 28: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CS333 Intro to Operating Systems Jonathan Walpole.
Input/Output Chapter 5 Tanenbaum & Bo,Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved OPERATING SYSTEMS DESIGN.
Interrupts and signals
Multiple Platters.
MODERN OPERATING SYSTEMS Third Edition ANDREW S
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
Chapter 7 Deadlock.
Operating Systems Chapter 5: Input/Output Management
CS703 - Advanced Operating Systems
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Computer Architecture and Assembly Language
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Chapter 5 Input/Output Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Presentation transcript:

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S. TANENBAUM ALBERT S. WOODHULL Chapter 5 Input/Output

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved I/O Devices Figure 3-1. Some typical device, network, and bus data rates.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device Controllers Figure 3-2. A model for connecting the CPU, memory, controllers, and I/O devices.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Memory-Mapped I/O Figure 3-3. (a) Separate I/O and memory space. (b) Memory-mapped I/O. (c) Hybrid.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Interrupts Status Word –Polling / Busy Waiting –Not acceptable for multiprogramming systems Interrupts –IRQ lines –Jumpers –Plug & Play Still uses Status Word to get more information at interrupt time

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Direct Memory Access (DMA) Figure 3-4. Operation of a DMA transfer.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Goals of the I/O Software Figure 3-5. Layers of the I/O software system.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device-Independent I/O Software Figure 3-6. Functions of the device-independent I/O software.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Uniform Interfacing for Device Drivers Figure 3-7. (a) Without a standard driver interface. (b) With a standard driver interface.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved User-Space I/O Software Figure 3-8. Layers of the I/O system and the main functions of each layer.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Resources The sequence of events required to use a resource: 1.Request the resource. 2.Use the resource. 3.Release the resource. We consider mainly non-preemptable resources

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Definition of Deadlock A set of processes is deadlocked if each process in the set is waiting for an event that only another process in the set can cause.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Conditions for Deadlock 1.Mutual exclusion 2.Hold and wait 3.No preemption 4.Circular wait Those conditions are for resources deadlocks

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Deadlock Modeling Figure 3-9. Resource allocation graphs. (a) Holding a resource. (b) Requesting a resource. (c) Deadlock.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Deadlock Handling Strategies 1.Ignore the problem altogether 2.Detection and recovery 3.Avoidance by careful resource allocation 4.Prevention by negating one of the four necessary conditions

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S. TANENBAUM ALBERT S. WOODHULL Chapter 5 Input/Output (part 2)

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Deadlock Avoidance (1) Figure An example of how deadlock occurs and how it can be avoided.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Deadlock Avoidance (2) Figure An example of how deadlock occurs and how it can be avoided.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Deadlock Prevention (1) Figure (a) Numerically ordered resources. (b) A resource graph.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Deadlock Prevention (2) Figure Summary of approaches to deadlock prevention.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved The Banker’s Algorithm for a Single Resource Figure Three resource allocation states: (a) Safe. (b) Safe. (c) Unsafe.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Resource Trajectories Figure Two process resource trajectories.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved The Banker’s Algorithm for Multiple Resources Figure The banker’s algorithm with multiple resources.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Safe State Checking Algorithm 1.Look for a row, R, whose unmet resource needs are all smaller than or equal to A. If no such row exists, the system will eventually deadlock since no process can run to completion. 2.Assume the process of the row chosen requests all the resources it needs (which is guaranteed to be possible) and finishes. Mark that process as terminated and add all its resources to the A vector. 3.Repeat steps 1 and 2 until either all processes are marked terminated, in which case the initial state was safe, or until a deadlock occurs, in which case it was not.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device Drivers in MINIX 3 (1) Figure Two ways of structuring user-system communication.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device Drivers in MINIX 3 (2) Figure Fields of the messages sent by the file system to the block device drivers and fields of the replies sent back.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device-Independent I/O Software in MINIX 3 Figure Outline of the main procedure of an I/O device driver.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Block Device Drivers in MINIX 3 Figure A shared I/O task main procedure using indirect calls.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device Driver Operations 1.OPEN 2.CLOSE 3.READ 4.WRITE 5.IOCTL 6.SCATTERED_IO

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved RAM Disk Hardware and Software Figure A RAM disk.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Disk Software Read/Write timing factors: 1.Seek time 2.Rotational delay 3.Data transfer time

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Disk Arm Scheduling Algorithms (1) Figure Shortest Seek First (SSF) disk scheduling algorithm.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Disk Arm Scheduling Algorithms (2) Figure The elevator algorithm for scheduling disk requests.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Common Hard Drive Errors 1.Programming error - request for nonexistent sector 2.Transient checksum error - caused by dust on the head 3.Permanent checksum error - disk block physically damaged 4.Seek error - the arm sent to cylinder 6 but it went to 7 5.Controller error - controller refuses to accept commands

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Hard Disk Driver in MINIX 3 (1) Figure (a) The control registers of an IDE hard disk controller. The numbers in parentheses are the bits of the logical block address selected by each register in LBA mode.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Hard Disk Driver in MINIX 3 (2) Figure (b) The fields of the Select Drive/Head register.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Floppy Disk Drive Characteristics that complicate the driver: 1.Removable media. 2.Multiple disk formats. 3.Motor control.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminals (1) Figure Terminal types.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminals (2) Figure Memory-mapped terminals write directly into video RAM.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminals (3) Figure (a) A video RAM image for the IBM monochrome display. (b) The corresponding screen.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved RS-232 Terminals Figure An RS-232 terminal communicates with a computer over a communication line, one bit at a time. The computer and the terminal are completely independent.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Input Software (1) Figure (a) Central buffer pool. (b) Dedicated buffer for each terminal.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Input Software (2) Figure Characters that are handled specially in canonical mode.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Input Software (3) Figure The termios structure. In MINIX 3 tc_flag _t is a short, speed_t is an int, and cc_t is a char.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Input Software (4) Figure MIN and TIME determine when a call to read returns in noncanonical mode. N is the number of bytes requested.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Output Software (1) Figure The ANSI escape sequences accepted by the terminal driver on output. ESC denotes the ASCII escape character (0x1B), and n, m, and s are optional numeric parameters.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Output Software (2) Figure The ANSI escape sequences accepted by the terminal driver on output. ESC denotes the ASCII escape character (0x1B), and n, m, and s are optional numeric parameters.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminal Driver in MINIX (1) Terminal driver message types: 1.Read from the terminal (from FS on behalf of a user process). 2.Write to the terminal (from FS on behalf of a user process). 3.Set terminal parameters for IOCTL (from FS on behalf of a user process).

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminal Driver in MINIX (2) Terminal driver message types (continued): 4.I/O occurred during last clock tick (from the clock interrupt). 5.Cancel previous request (from the file system when a signal occurs). 6.Open a device. 7.Close a device.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminal Input (1) Figure Read request from the keyboard when no characters are pending. FS is the file system. TTY is the terminal driver. The TTY receives a message for every keypress and queues scan codes as they are entered. Later these are interpreted and assembled into a buffer of ASCII codes which is copied to the user process.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Figure Input handling in the terminal driver. The left branch of the tree is taken to process a request to read characters. The right branch is taken when a keyboard message is sent to the driver before a user has requested input. Terminal Input (2)

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminal Output (1) Figure Major procedures used in terminal output. The dashed line indicates characters copied directly to ramqueue by cons_write.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminal Output (2) Figure Fields of the console structure that relate to the current screen position.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Loadable Keymaps Figure A few entries from a keymap source file.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device-Independent Terminal Driver (1) Figure Default termios flag values.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Device-Independent Terminal Driver (2) Figure POSIX calls and IOCTL operations.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Terminal Driver Support Code Figure The fields in a character code as it is placed into the input queue.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Keyboard Driver (1) Figure Scan codes in the input buffer, with corresponding key actions below, for a line of text entered at the keyboard. L and R represent the left and right Shift keys. + and - indicate a key press and a key release. The code for a release is 128 more than the code for a press of the same key.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Keyboard Driver (2) Figure Escape codes generated by the numeric keypad. When scan codes for ordinary keys are translated into ASCII codes the special keys are assigned ‘‘pseudo ASCII’’ codes with values greater than 0xFF.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Keyboard Driver (3) Figure The function keys detected by func_key().

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Display Driver (1) Figure Finite state machine for processing escape sequences.

Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved Display Driver (2) Figure Some of the 6845’s registers.