OS Device Management - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

OS Device Management

Description:

Driver-Kernel Interface. Drivers are distinct from main part of kernel ... USB and firewire. Serial Port. Serial. Device. Memory. CPU. Printer. Terminal. Modem. Mouse ... – PowerPoint PPT presentation

Number of Views:199
Avg rating:3.0/5.0
Slides: 28
Provided by: cstlcs
Category:

less

Transcript and Presenter's Notes

Title: OS Device Management


1
OS Device Management
2
I/O systems are designed to
  • Provide simple, but abstract software interfaces
    to manage the I/O operations
  • Ensure that there is as much overlap as possible
    between I/O and CPU

3
The Device Driver Interface
write()
Device Interface
Terminal Driver
Printer Driver
Disk Driver
Terminal Controller
Printer Controller
Disk Controller
4
Device Management Organization
Application Process
System Interface
File Manager
Device-Independent
Device-Dependent
Hardware Interface
Command
Status
Data
Device Controller
5
System Call Interface
  • Functions available to application programs
  • Abstract all devices (and files) to a few
    interfaces
  • Make interfaces as similar as possible
  • Block vs character
  • Sequential vs direct access
  • Device driver implements functions (one entry
    point per API function)

6
Example BSD UNIX Driver
open Prepare dev for operation close No longer
using the device ioctl Character dev specific
info read Character dev input op write Character
dev output op strategy Block dev input/output
ops select Character dev check for
data stop Discontinue a stream output op
7
Overlapping the Operation of a Device and the CPU
. . . startRead(dev_I, d, x) . .
. While(stillReading()) y f(x) . . .
. . . read(dev_I, d, x) y f(x) . . .
Data on device
Variable x
Register
Device dev_I
Memory
CPU
8
Overlapping CPU-Controller Operations in a
Process, Gantt Chart
App
I/O Ctlr
t1
t2
t3
t4
t5
t6
t7
t8
t9
CPU computation and I/O can be parallel if CPU
doesnt depend on I/O result
9
Overlapping Processing and I/O Across App., Gantt
Chart
App 1
App 2
I/O Ctlr
t1
t2
t3
t4
When one app. Is doing I/O, CPU can yield to
other app.
10
Polling I/O Read Operation
read(device, )
Data
1
System Interface
read function
5
write function
2
3
4
Hardware Interface
Command
Status
Data
Device Controller
11
Interrupt-driven I/O Operation
read(device, )
9
1
8b
Data
System Interface
Device Status Table
4
7
Device Handler
read driver
write driver
2
6
3
8a
Interrupt Handler
5
Hardware Interface
Command
Status
Data
Device Controller
12
Device Independent Function Call
Trap Table
funci()
dev_func_i(devID, ) // Processing common to
all devices switch(devID) case
dev0 dev0_func_i() break case
dev1 dev1_func_i() break case
devM devM_func_i() break // Processing
common to all devices
13
Driver-Kernel Interface
  • Drivers are distinct from main part of kernel
  • Kernel makes calls on specific functions, drivers
    implement them
  • Drivers use kernel functions for
  • Device allocation
  • Resource (e.g., memory) allocation
  • Scheduling
  • etc. (varies from OS to OS)

14
Reconfigurable Device Drivers
System call interface
open()
read()
Entry Points for Device j
etc.
Other Kernel services
Driver for Device j
15
Hardware Buffering
Process
Process
Process
Controller
Controller
Controller
Data
B
A
B
A
Device
Device
Device
Process reads bi-1 Controller reads bi
Process reads bi Controller reads bi1
Unbuffered
16
Double Buffering in the Driver
Process
Process
B
A
B
A
Driver
Controller
Controller
B
A
B
A
Hardware
Device
Device
17
A Generic Communications Device
Bus
Generic Controller
Communications Controller
Local Device
Cabling connecting the controller to the device
Device
  • Printer
  • Modem
  • Network

18
Device Classes
  • Character-oriented devices read or write one
    byte with a single I/O usually communication
    devices(i.e. printer, modem)
  • Block-oriented devices read or write fixed
    number of bytes with a single I/O usually
    storage devices(i.e. tape, disk)
  • Sequentially accessed storage devices(like tape,
    suited for buffering)
  • Randomly accessed storage devices(like disk, not
    suited for buffering)

19
Communication Devices
  • Use serial or parallel port
  • RS-232 protocol
  • Asynchronous Serial Device(like IBM 3270
    terminal, including input device and output
    device)
  • Universal Asynchronous Receiver Transmitter(UART)
  • USB and firewire

20
Serial Port
CPU
Serial Device
Memory
  • Printer
  • Terminal
  • Modem
  • Mouse
  • etc.

21
Serial Port
Device Driver API
  • Device Driver
  • Set UART parms
  • read/write ops
  • Interrupt hander

Software on the CPU
Bus Interface
Serial Device (UART)
  • UART API
  • parity
  • bits per byte
  • etc.
  • RS-232 Interface
  • 9-pin connector
  • 4-wires
  • bit transmit/receive
  • ...

22
Rotating Media
Cylinder (set of tracks)
Track (Cylinder)
Sector
(a) Multi-surface Disk
(b) Disk Surface
(b) Cylinders
23
Storage Device
Device Driver API
  • Driver
  • Get disk description
  • Set SCSI parms
  • read/write ops
  • Interrupt hander
  • SCSI API
  • commands
  • bits per byte
  • etc.

Controller
(SCSI)
Magnetic Disk
24
Disk Optimizations
  • Transfer Time Time to copy bits from disk
    surface to memory
  • Disk latency time Rotational delay waiting for
    proper sector to rotate under R/W head
  • Disk seek time Delay while R/W head moves to the
    destination track/cylinder
  • Access Time seek latency transfer

25
Optimizing Seek Time
  • Multiprogramming on I/O-bound programs gt set of
    processes waiting for disk
  • Seek time dominates access time gt minimize seek
    time across the set
  • Tracks 099 Head at track 75, requests for 23,
    87, 36, 93, 66
  • FCFS 52 64 51 57 27 251 steps

26
Optimizing Seek Time (cont)
  • Requests 23, 87, 36, 93, 66
  • SSTF (75), 66, 87, 93, 36, 23
  • 11 21 6 57 13 107 steps
  • Scan (75), 87, 93, 99, 66, 36, 23
  • 12 6 6 33 30 13 100 steps
  • Look (75), 87, 93, 66, 36, 23
  • 12 6 27 30 13 87 steps

27
Optimizing Seek Time (cont)
  • Requests 23, 87, 36, 93, 66
  • Circular Scan (75), 87, 93, 99, 23, 36, 66
  • 12 6 6 home 23 13 30 90 home
  • Circular Look (75), 87, 93, 23, 36, 66
  • 12 6 home 23 13 30 84 home
Write a Comment
User Comments (0)
About PowerShow.com