IO Management
IO Management
Components
●
I/O device
●
I/O controller
●
I/O bus
I/O Devices based on Characteristics
●
Data transfer ●
Transfer schedule
– Block devices – Synchronous
●
stores information in blocks which ●
The transfer must not return
are usually of fixed size
until the I/O is complete.
●
Data transfer one block at a time
●
Tape drive
●
EX: disks and CDROMs
– character devices
– Asynchronus
●
transfers data as a stream of bytes
●
schedule the I/O and return
●
Ex: keyboard, printer, or modem
immediately to continue
●
Keyboard
●
Access Type
– Sequential
●
I/O Direction
●
Tape drive – Read only
– Random – Write only
●
CDROMs – Both read and write
I/O Devices based on Characteristics
●
Sharing
– Dedicated
●
Assigned to only one job at a time
●
Ex: printers, tape drives
– Shared
●
Can be assigned to several processes, e.g. a disk can be
●
Sharing will be handled by the Device Manager.
– Virtual
●
A combination of the both dedicated and shared
●
a printer made sharable through spooling (Simultaneous
Peripheral Operation On-Line).
I/O Controller
●
I/O controllers
interface between
the I/O devices and
the internal system
components; CPU,
memory, etc.
●
A single I/O controller
may control multiple
devices.
Interfaces to I/O controller
●
CPU interact with the I/O controller through a set of interface registered called I/O
port.
●
I/O port
– consists of four registers, called the status , control, data-in, and data-out
registers.
– Control register
●
The control register can be used give the command.
– Status Register
●
whether the current command has completed or not
●
whether a byte is available to be read or not
●
Indication of device error.
– Data-in register
●
read by the host to get input.
– Data-out register
●
written by the host to send output.
How does CPU interact with the I/O
controller
●
programmed I/O
– the CPU issues an I/O command on behalf of a process to an I/O module through
control register and send the operand through input register
– I/O module performs operation
– I/O module sets status bits
– CPU checks status bits periodically (polling)
– CPU waits for the operation to be completed before proceeding
●
Interrupt-driven I/O
– The CPU issues commands to the I/O module then proceeds with its normal work until
interrupted by I/O device on completion of its work.
– Two Cases
●
Non-blocking instruction:
– Processor continues to execute instructions from the process that issued the I/O command
●
Blocking instruction:
– Put the current process in a blocked state and schedule another proces
– Still inefficient in data transfer of large amount because the CPU has to transfer the data
word by word between I/O module and memory
How does CPU interact with the I/O
controller
●
Direct Memory Access (DMA)
– DMA module controls the exchange of data
between main memory and an I/O module
Device Driver
●
A device driver is usually part of
the OS kernel that contains the
device specific code to control an
I/O device, which is usually
written by device manufacturer
●
Functionality
– handles the translation of requests
between a device and the computer
– defines where a process must put
outgoing data before it can be sent
– where incoming messages will be
stored when they are received
– Sleep & wakes up the device as per
the requirement
Protection
●
Provides the access control mechanism for Subjects
(processes, users, etc.) to perform operations (read, write,
etc.) on Object (files, printer, Disk writer, etc.).
●
Protection vs. Security
– Protection happens inside a computer where as Security considers
external threats.
●
Components involved in protection
– Subjects
●
user, process, procedure, etc.
– Object
●
files, printer, Disk writer, etc.
– Operations
●
read, write, etc.
Protection
●
The reference monitor validates access to
objects by authorized subjects.
●
This validation is based on the protection state
defined by the operating system.
●
a protection state is represented by an access
matrix.
Protection Domain
●
Domains
– User
– Supervisor
●
So, a process executes inside a protection
domain has the has the same rights and
privileges as the domain has.
Access Matrix
●
Access(i, j) is the set ●
Transfer to another
of operations that a domain – switch
process executing in – a process executing in
Domaini can perform D2 can switch to D3 or
on Objectj D4
●
Access Matrix with Copy Right
●
Copy right “*” signifies
the permission can be
copied. Can only
work on the same
object/column.
– Copy
– Limited copy
Access Matrix with Owner Right
●
Owner right means
any values on the
object/column can be
changed.
– D1 is the owner of F1,
and can add and
delete any valid right
in column F1.
Access Matrix With Control Rights
●
We include “control” right in access(D2, D4).
●
Then, a process executing in D2 (row) could
modify D4 (row).