Systems - Operating System - Lecture Slides, Slides of Computer Science

These are the Lecture Slides of Operating System which includes Environment, Fundamental Goal, Programs, Time Line, User Programs, Versus, Operating System, Running, Symmetric Multiprocessing etc.Key important points are: Systems, Major Factor, System Performance, Schedule Processes, Fairly and Efficiently, Block and Unblock, Device Drivers, Make Operating Systems, Left Until Relatively, Device Control

Typology: Slides

2012/2013

Uploaded on 03/27/2013

ekana
ekana 🇮🇳

4

(44)

370 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 13: I/O Systems
“The two main jobs of a computer are I/O and [CPU]
processing. In many cases, the main job is I/O, and the
[CPU] processing is merely incidental.” (p. 555)
“I/O is a major factor in system performance. It places
heavy demands on the CPU to execute device-driver
code and to schedule processes fairly and efficiently as
they block and unblock” (p. 582)
“typically, about 70 percent of [an] operating system
consists of device drivers” (p. 44, Tanenbaum et al.,
2006; Can We Make Operating Systems Reliable and
Secure)
It seems curious I/O is left until relatively late in the
textbook
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Systems - Operating System - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Chapter 13: I/O Systems

  • “The two main jobs of a computer are I/O and [CPU]

processing. In many cases, the main job is I/O, and the

[CPU] processing is merely incidental.” (p. 555)

  • “I/O is a major factor in system performance. It places

heavy demands on the CPU to execute device-driver

code and to schedule processes fairly and efficiently as

they block and unblock” (p. 582)

  • “typically, about 70 percent of [an] operating system

consists of device drivers” (p. 44, Tanenbaum et al.,

2006; Can We Make Operating Systems Reliable and

Secure )

  • It seems curious I/O is left until relatively late in the

textbook

Overview

• Computer system architecture

• I/O Device Control

• Accessing devices

  • Polling & interrupts

• Device drivers

• Blocking, non-blocking, and asynchronous I/O

I/O Device Control

  • Devices controlled via special registers of a device controller
  • CPU needs to control devices
    • Read or write control signals or data in special registers of a device controller
  • General interfaces
    • Port I/O : Special I/O machine instructions that trigger the bus to select the proper I/O port & move the data into or out of a device register - E.g., IN, INS, OUT, OUTS on numerous Intel architectures
    • Memory mapped I/O : The I/O registers of the device become part of the linear memory space of the “RAM” of the computer; standard memory load and store machine instructions are used
  • E.g., a serial port might use port I/O, while a graphics controller could have a memory-mapped image of the computer screen

Example I/O Port Instructions on

Intel 64 & IA-32 (See next page)

http://developer.intel.com/products/processor/manuals/index.htm http://download.intel.com/design/processor/manuals/253665.pdf Docsity.com

General Methods for

Accessing Devices

• Two general methods by which devices can

be accessed

  • Each of these methods can be used with either

ports or memory-mapped I/O

• Polling

  • A busy wait, repeatedly checking a device for

some change in status

• Interrupts

  • Using interrupt line of CPU to provide service

to devices

Polling

  • Also called programmed I/O
  • CPU is used (e.g., by a device driver), in a

program code loop, to continuously check a device

to see if it is ready to accept data or commands, or

produce output

  • Continuous polling
  • In some cases, a process periodically checks a

device, and then blocks until next period elapsed

  • Periodic polling
  • E.g., a USB mouse might be periodically polled for data at 100 Hz rate Loop (until device ready) Check device End-loop Docsity.com

Hardware Interrupts

  • I/O via software continuous polling can be inefficient
    • CPU may spend too much time waiting for devices
      • I.e., amount of time between I/O operations may be large
    • Only one CPU; continuous polling may tie up this resource
  • Often better to design differently
    • Handle I/O as different type of event
    • No longer have CPU actively wait until device is ready for next operation
    • Instead, have the device send an asynchronous signal-- an interrupt when it is ready
  • CPU has wire called an interrupt request line
  • I/O controller sets the interrupt request line to 1
    • CPU, as part of instruction processing cycle, automatically checks interrupt request line
    • If it is set to 1, this generates a hardware interrupt Docsity.com

Figure 13.3 Interrupt-driven I/O cycle

Other Interrupt Features

  • Interrupts can have different priorities
    • A higher priority interrupt can interrupt the handler of a lower priority interrupt (but not vice versa)
  • Maskable vs. nonmaskable interrupts
    • Normal I/O uses maskable interrupts that can be turned off (e.g., when kernel executes a critical section)
    • Fatal error conditions may use a nonmaskable interrupt to make sure interrupt gets through (e.g., see Fig. 13.4)

Device Drivers - 1

  • Generally handle device access details
    • E.g., program devices to initiate I/O operations and provide interrupt handlers
  • Present a uniform device-access interface to the I/O

subsystem

  • Standard device driver interfaces are specified by the particular operating system

Figure 13.6: A Kernel I/O Structure

Blocking vs. Nonblocking I/O

  • Blocking I/O (a.k.a., synchronous I/O)
    • Process suspended for duration of I/O operation
    • I.e., Process enters a waiting queue
  • Nonblocking I/O
    • Does not cause a process to enter a waiting queue
    • Returns immediately, with status information such as the number of bytes of data transferred
    • I/O processing (due to a non-blocking I/O request) does not continue after request
  • Asynchronous I/O
    • Similar to nonblocking I/O, but an asynchronous call not only returns immediately, but has I/O processing continue after call
    • Communication with process about completion of I/O can occur via a variable, callback, or signal, or polling