CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,

Slides:



Advertisements
Similar presentations
EEE 435 Principles of Operating Systems Structure of I/O Software Pt II (Modern Operating Systems & 5.3.4)
Advertisements

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.
CSC 322 Operating Systems Concepts Lecture - 29: by
Input/Output Management and Disk Scheduling
04/14/2008CSCI 315 Operating Systems Design1 I/O Systems Notice: The slides for this lecture have been largely based on those accompanying the textbook.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
OPERATING SYSTEM LESSON 2. INTRODUCTION TO OPERATING SYSTEM Computer Hardware’s complexity Operating Systems (OS) hide this complexity from users OS manages.
Operating Systems Input/Output Devices (Ch , 12.7; , 13.7)
04/18/2007CSCI 315 Operating Systems Design1 Mass Storage Structure Notice: The slides for this lecture have been largely based on those accompanying the.
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)
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
OS Spring’03 Introduction Operating Systems Spring 2003.
1 I/O Devices Controller: physically controls the devices Devices are diverse and complicated Present simpler interface to OS E.g, convert a linear sector.
Memory Management, File Systems, I/O How Multiprogramming Issues Mesh ECEN 5043 Software Engineering of Multiprogram Systems University of Colorado, Boulder.
Device Management.
1 Operating Systems Ch An Overview. Architecture of Computer Hardware and Systems Software Irv Englander, John Wiley, Bare Bones Computer.
CS 342 – Operating Systems Spring 2003 © Ibrahim Korpeoglu Bilkent University1 Input/Output – 3 I/O Software CS 342 – Operating Systems Ibrahim Korpeoglu.
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 I/O Management in Representative Operating Systems.
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
Copyright ©: Nahrstedt, Angrave, Abdelzaher
I/O Tanenbaum, ch. 5 p. 329 – 427 Silberschatz, ch. 13 p
Device Management. Serial Port Serial Device Serial Device Memory CPU Printer Terminal Modem Mouse etc.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
1 I/O and Filesystems. 2 How to provide interfaces Rough reading guide (no exam guarantee): Tanenbaum Ch. 5.1 – 5.5 & Silberschatz Ch. 13 & ,
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Cpr E 308 Input/Output Recall: OS must abstract out all the details of specific I/O devices Today –Block and Character Devices –Hardware Issues – Programmed.
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 - 23: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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.
Contact Information Office: 225 Neville Hall Office Hours: Monday and Wednesday 12:00-1:00 and by appointment.
1 Comp 104: Operating Systems Concepts Devices. 2 Today Devices –Introduction –Handling I/O Device handling Buffering and caching.
I/O Management and Disk Structure Introduction to Operating Systems: Module 14.
CSC 322 Operating Systems Concepts Lecture - 20: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Device Drivers CPU I/O Interface Device Driver DEVICECONTROL OPERATIONSDATA TRANSFER OPERATIONS Disk Seek to Sector, Track, Cyl. Seek Home Position.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem.
Chapter 13 – I/O Systems (Pgs ). Devices  Two conflicting properties A. Growing uniformity in interfaces (both h/w and s/w): e.g., USB, TWAIN.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 4 Computer Systems Review.
Silberschatz, Galvin and Gagne  Operating System Concepts Six Step Process to Perform DMA Transfer.
CSC414 “Introduction to UNIX/ Linux” Lecture 2. Schedule 1. Introduction to Unix/ Linux 2. Kernel Structure and Device Drivers. 3. System and Storage.
CSC 322 Operating Systems Concepts Lecture - 7: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Computer Studies (AL) I/O Management. Reference Silberschatz, Galvin, Gagne “Operating System Concepts 6 th edition”, 2003, Wiley Stallings, “Operating.
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
Device Driver Concepts Digital UNIX Internals II Device Driver Concepts Chapter 13.
Fall 2000M.B. Ibáñez Lecture 26 I/O Systems II. Fall 2000M.B. Ibáñez Application I/O Interface I/O system calls encapsulate device behaviors in generic.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 12: I/O Systems I/O hardwared Application I/O Interface Kernel I/O.
I/O Software CS 537 – Introduction to Operating Systems.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 5.
Part IVI/O Systems Chapter 13: I/O Systems. I/O Hardware a typical PCI bus structure 2.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
CSCE451/851 Introduction to Operating Systems
Introduction to Operating Systems Concepts
Chapter 13: I/O Systems Modified by Dr. Neerja Mhaskar for CS 3SH3.
CSC 322 Operating Systems Concepts Lecture - 12: by
Chapter 12: File System Implementation
CSC 322 Operating Systems Concepts Lecture - 16: by
CSCI 315 Operating Systems Design
Operating Systems Chapter 5: Input/Output Management
CS703 - Advanced Operating Systems
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Mr. M. D. Jamadar Assistant Professor
Chapter 5 Input/Output Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Presentation transcript:

CSC 322 Operating Systems Concepts Lecture - 25: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-4) Silberschatz, Galvin and Gagne 2002, Operating System Concepts, Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Chapter 5 Input/ Output Principals of I/O Software HardwareDisk Lecture-242 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Logical positioning of device drivers. In reality all communication between drivers and device controllers goes over the bus. Device Drivers Lecture-243 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Device Drivers-Act 1 Driver contains code specific to the device Supplied by manufacturer Installed in the kernel (Rebuild binaries, or Plug n play, run in user space) User space might be better place Why? Bad driver can mess up kernel Need interface to OS block and character interfaces procedures which OS can call to invoke driver (e.g. read a block) Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Device drivers Act 2 Checks input parameters for validity Abstract to concrete translation (block number to cylinder, head, track, sector) Check device status. Might have to start it (switch on). Puts commands in device controller’s registers Driver blocks itself until interrupt arrives Might return data to caller Does return status information The end Drivers should be re-entrant (multiple copies in parallel) OS adds devices when system is running (and therefore driver) Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Device-Independent I/O Software Lecture-246 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Driver functions differ for different drivers Kernel functions that each driver needs are different for different drivers Too much work to have new interface for each new device type Why the OS needs a standard interface Lecture-247 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Interface : Driver functions OS defines functions for each class of devices which it MUST supply, e.g. read, write, turn on, turn off…….. Driver has a table of pointers to functions OS just needs table address to call the functions OS maps symbolic device names onto the right driver (Next Slide) Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Interface : Names and protection OS maps symbolic device names onto the right driver Unix: /dev/disk0 maps to an i-node which contains the major and minor device numbers for disk0 Major device number locates driver, (e.g. disk) Minor device number passes locates device unit (e.g. 0,1,2,3 …) Protection: In Unix and Windows devices appear as named objects therefore may apply the same rule as that of file protection system (e.g.rwxrwxrwx) Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Buffering Perform input transfers in advance of requests being made Perform output transfers some time after the request is made Block-oriented device stores information in blocks that are usually of fixed size transfers are made one block at a time possible to reference data by its block number disks and USB keys are examples Stream-oriented device transfers data in and out as a stream of bytes no block structure terminals, printers, communications ports, and most other devices that are not secondary storage are examples

(a) Un-buffered input. (b) Buffering in user space not in kernel. (c) Buffering in the kernel followed by copying to user space. (d) Double buffering in the kernel. Buffering Lecture-2411 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

No Buffer in Kernel Without a buffer in kernel (OS) process directly accesses the device when it needs and buffers data in user space.

Single Buffer Operating system assigns a buffer in main memory for an I/O request

Block-Oriented Single Buffer Input transfers are made to the system buffer Reading ahead/anticipated input is done in the expectation that the block will eventually be needed when the transfer is complete, the process moves the block into user space and immediately requests another block Generally provides a speedup compared to the lack of system buffering Disadvantage: Complicates the logic in the operating system

Stream-Oriented Single Buffer Line-at-a-time operation appropriate for scroll- mode terminals (dumb terminals) user input is one line at a time with a carriage return signaling the end of a line output to the terminal is similarly one line at a time Byte-at-a-time operation used on forms-mode terminals when each keystroke is significant Other peripherals such as sensors and controllers

Double Buffer Use two system buffers instead of one A process can transfer data to or from one buffer while the operating system empties or fills the other buffer Also known as buffer swapping

Circular Buffer Two or more buffers are used Each individual buffer is one unit in a circular buffer Used when I/O operation must keep up with process

Networking may involve many copies of a packet. Kernel does not directly write to bus? ( why 3?) Buffering Lecture-2418 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Un-buffered input. Process: tries to read ch; blocked, interrupted when ch arrives, read ch, block again. Poor performance not used Buffering in user space. Process: defined buffer in user space, tries to read ch, blocked, kernel copies data to user buffer, un block process. What if buffer paged out? Buffering in the kernel followed by copying to user space. Process: tries to read ch, blocked, data copied to user buffer from kernel buffer. What if while copying data fresh data arrives? Double buffering in the kernel. Use one buffer to read from device, one to write to user buffer, then swap. Circular buffering Summary: Buffering Lecture-2419 Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

The Utility of Buffering Technique that smooth out peaks in I/O demand with enough demand eventually all buffers become full and their advantage is lost When there is a variety of I/O and process activities to service, buffering can increase the efficiency of the OS and the performance of individual processes

More Functions of Independent Software Error reporting programming errors (the user asks for the wrong thing write to input, read from output device), hardware problems (bad disk) are reported if they can’t be solved by the driver Allocate share and dedicated devices Allocates and releases devices which can only be used by one user at a time (CD-ROM players) Block the user and Queues their requests or Regret (device not available) Device open fail Device independent block size OS does not have to know the details of the devices e.g. combine sectors into blocks Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

User Space I/O Software Library routines in user space but are involved with I/O These routines makes system calls. (pass parameters) Do formatting while reading and writing for example.(printf, scanf ) Spooling systems keep track of requests made by users on shared devices Example Print Demon, Network Demon User generates file, puts it in a spooling directory. Print Daemon process monitors the directory, printing the user file Network demon monitors the spooling directory and transfers file over network. Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad

Example Flow through layers User wants to read a block, asks OS Device independent software looks for block in cache If not there, invokes device driver to request block from disk hardware Transfer finishes, interrupt is generated by handler Device driver unblocks and returns the data to device independent software User process is awakened and goes back to work Ahmed Mumtaz Mustehsan, GM-IT, CIIT, Islamabad