Topic 13 – Input/output Contents Flashcards
describe the
status register within an I/O device
within an I/O device:
this is used to indicate for example whether more data is waiting to be collected or whether the I/O device is busy and cannot yet accept more data
this is also known as an
interrupt handler
what is an
interrupt service routine (ISR)
also known as
what is an
interrupt service routine (ISR)
also known as
this is also known as an
interrupt handler
describe the
data register within an I/O device
within an I/O device this holds the data that is to be transferred
This is a method for the control of I/O data transfers.
It involves the processor frequently polling an I/O device to check whether an event has occurred
An event can be detected by looking at the I/O devices status register which could change from busy to ready for example
describe
polled I/O
name an advantage and disadvantage of
caching
these include:
- advantage
- speed increase - since the data held in cache is instantly accessible
- disadvnatge
- Multitasking/usability vs performance - this requires its own space in main memory. There is a trade of then between processes and cache in general cache size will be reduced as more processes are loaded into memory and page faults increase
decribe how a newly connected USB device will initiate communication with the OS
the process for this is:
- The OS provides a generic USB driver to initiate the communication with the device over the bus via the bus controller
- The device can then identify itself to the OS telling it its class such as: storage, human interface device (HID) (mouse keyboard)
- Configuration will take place such as negotiating data rates
- if necessary a more specific device driver can now be found and installed for the usb device
- Data transfer continues using the bus
describe the
major number
that the OS allocates to an I/O device in order to uniquely identify it
this is a number given to a type of device such as a disk drive
any devices that share this number will be of the same type and will be sharing a device driver
describe the
direct memory access controller (DMAC)
this is an I/O device that is dedicated to transferring data between main memory and I/O devices.
It will contain its own I/O registers that the OS can use in order to give this device tasks
describe
buffering
this is a technique employed by OSs in order to reduce context switches and interrupts
with this system a processes I/O system call could potentially be satisfied instantly since the data it requires is already held in a buffer
what is being described below:
- application program interface (API) - a software interface that user applications use in order to use the service of another piece of software
- I/O system services - this is a variety of routines within this module that can carry out tasks for the layer above
- system call - this is made when the layer above must switch the processor to kernel mode in order to carry out a task on hardware
- device independent functions - these are a set of generic instructions that any driver below can understand and be plugged into
- device driver - this will translate the instruction from the layer above and format it into a specific instruction for the hardware being accessed
excluding the user applications and hardware describe each of the interfaces and layers of the I/O module
what is a
benefit of a bus interface
the benefit of this is that each device that can be connected to a system does not require its own hardware interface instead it can connect to standardized interface that is available on the system
what is a
pseudo file
within linux
this is a file that is accessible to the user but does not actually exist in storage
it is created on the fly and simply reads data from system components such as ram or internal tables of the OS
this is a number given to any new I/O devices that might share the same major number
example
a disk drive that is partitioned where each partition is treated as a separate drive
partition 1: 3.0
partition 2: 3.1
describe the
minor number
that the OS allocates to an I/O device in order to uniquely identify it
within an I/O device:
this is used to indicate for example whether more data is waiting to be collected or whether the I/O device is busy and cannot yet accept more data
describe the
status register within an I/O device
what will periphials that make use of a
bus interface
likely have built into them
periphials that make use of this will likely have their own processor and memory in order to to make negotiations with the OS and to work efficiently with the buses data transfer protocol
describe
block devices
this includes I/O devices such as disk drives where data is sent in large fixed sized blocks at a time (typically 512 bytes)
describe a
device driver
these are software written by hardware developers and can be installed within the operating system kernel. Their purpose is to control the specific hardware upon which they were written for
name two ways in which caching can be implemented
this can be implemented by:
- Buffer to cache transfer
- read-ahead caching
this method involves the OS making assumptions about what a process will do.
If a process for example was reading a block of data from disk then the OS would go ahead and assume that it will want the block after it
the OS will then transfer this assumed block to cache before the process asks for it
when/if the process does ask for this assumed block of data it can be offered instantly to the process
describe
read-ahead caching
these include:
- similarities
- they are both a dedicated space in main memory used to improve I/O operations
- differences
- a buffer will hold the only copy of that data
- a cache will hold a copy of data while the original will be held somewhere else (typically in a place that is slower to access such as seconadry storage)
name the similarities and differences between
caching and buffering
what is
busy waiting
this is a phenomenon in the OS where a process will be using a resource and will keep control of the processor until its operation on the resource is complete.
if another process wants to use the same resource it will keep hold of the processor and run a loop that keeps polling a device until it itself can satisfy its task on the resource.
while it is in this state the process is making no progress and processor time is being wasted by the process doing nothing and keeping control of the processor
describe two scenerios where
Direct memory access I/O
is particularly useful
this method of I/O data transfer is particularly usefull for:
- block devices
- slow I/O transfers
these are essential to the OS so that it can achieve device inpependence
without these it would be virtually impossible for an OS to be able to communicate with variants of hardware
why are device drivers essential for an OS
when employing
buffering
under which two circumstances would a process not be blocked
within this system A process is only blocked if
- an output buffer is full
- an input buffer is empty
how is
data transfer carried out between main memory and an I/O device
this is carried out by the appropriate device driver.
The reason for this is that the device driver is the specialised part of the I/O module that is written to deal with that specific hardware
note
remember device drivers are designed to be ‘plugged into the operating system’
more specifically become part of the I/O module and in turn the OS kernel and be the interface bewtween the I/O module and the hardware
I/O module > device driver > hardware
the reason this is an I/O device is because dedicated hardware is required to implement and control the bus
note
In this scenerio then an I/O interface is required between the OS and the bus
OS > I/O interface > bus
why is a
bus interface
that allows I/O devices to connect to it also an I/O device in itself
describe the linux file
/proc/iomem
this file holds details about any memory mapped I/O addresses. It can be assumed that mappings in here will be using the memory-mapped I/O method to interface between the OS and the I/O registers
this can be implemented by:
- Buffer to cache transfer
- read-ahead caching
name two ways in which caching can be implemented
describe the lnux command
Lsusb
this linux command can be used to display usb buses as well as the devices connected to them.
Example
buses could include a bus for USB 2 and a separate bus for USB 3. each bus will have its own root hub controller
describe the linux command
modinfo module
also known as module info can be used to view information about a linux kernel module
why are device drivers essential for an OS
these are essential to the OS so that it can achieve device inpependence
without these it would be virtually impossible for an OS to be able to communicate with variants of hardware
the layers for this is described in the diagram below
from the user application to the hardware what are the
7 layers of an I/O module
including the layers and the interfaces that separate them
name 3 benefits of:
Direct memory access I/O
these benefits include:
- multiple data transfers - There will usually be several Direct Memory Access (DMA) channels which can work in parallel and complete independent tasks
- parralell opeartaion - the processor is free to carry out other instructions in parallel with the data transfer that the direct memory access controller (DMAC) is making
- less interrupts - interrupts will be reduced from 1 per byte to 1 per 512 bytes
these are software written by hardware developers and can be installed within the operating system kernel. Their purpose is to control the specific hardware upon which they were written for
describe a
device driver
these include:
- advantage
- speed increase - since the data held in cache is instantly accessible
- disadvnatge
- Multitasking/usability vs performance - this requires its own space in main memory. There is a trade of then between processes and cache in general cache size will be reduced as more processes are loaded into memory and page faults increase
name an advantage and disadvantage of
caching
this is carried out by the appropriate device driver.
The reason for this is that the device driver is the specialised part of the I/O module that is written to deal with that specific hardware
note
remember device drivers are designed to be ‘plugged into the operating system’
more specifically become part of the I/O module and in turn the OS kernel and be the interface bewtween the I/O module and the hardware
I/O module > device driver > hardware
how is
data transfer carried out between main memory and an I/O device
within an I/O device this holds the data that is to be transferred
describe the
data register within an I/O device
describe how the OS would use and benefit from
Direct memory access I/O
with this:
- the OS issues a task to the direct memory access controller (DMAC) (such as read data from this device)
- the OS can then let the processor handleanother task while the DMAC makes the transfer
- when the DMAC has finished it will send an interrupt to the processor
these include:
- reduced context switching - if buffer is full and data is to be read then an I/O operation does not occur and the process is not placed in a blocked state instead it immedietally reads from ram, similarly if data is to be written and the buffer is empty then an I/O operation does not occur it can instantly write the data to ram
- Time differences can be avoided - user processes and devices do not have to wait for each other instead the buffer can be immediately filled or emptied by either the process or the device
name 2 benefits of
buffering
within this system A process is only blocked if
- an output buffer is full
- an input buffer is empty
when employing
buffering
under which two circumstances would a process not be blocked
describe the linux directory
/dev
this is a linux directory that holds pseudo files relating to periphial devices
this method of I/O data transfer is particularly usefull for:
- block devices
- slow I/O transfers
describe two scenerios where
Direct memory access I/O
is particularly useful
this I/O device will include:
- Address register
- Byte count register
- Control register
name 3 register that will belong to the
direct memory access controller (DMAC)
if this did not exists then:
- a process would make an I/O system call
- the process would most likely be placed in a blocked state
- a context switch would occur
- an interrupt would be made from the device for each byte it has ready
- the process would be put in a ready state
what would happen if operating systems did not use buffering
within an I/O device:
this is used to set options
for example whether data is to be read from or written to the device.
describe the
control register within an I/O device
describe the linux directory
/proc
this is a linux directory that holds pseudo files relating to running processes
this is a file that is accessible to the user but does not actually exist in storage
it is created on the fly and simply reads data from system components such as ram or internal tables of the OS
what is a
pseudo file
within linux
this is a program that is called when an I/O device sends an interrupt to the processor
it is an important part of a device driver
this program will be able to determine why the interrupt occurred and handle it
describe an
interrupt service routine (ISR)
this is a method that can handle the data transfer between the main memory and an I/O device
This method makes use of a direct memory access controller (DMAC). that is able to make transfers of data between main memory and an I/O device directly and without the use of interrupt handlers and importantly the processor
describe
Direct memory access I/O
describe a
bus
this is an interface upon which more than one device can be connected to at a time, connected devices will all be adhering to standardised data transfer protocols
this is a technique employed by OSs in order to reduce context switches and interrupts
with this system a processes I/O system call could potentially be satisfied instantly since the data it requires is already held in a buffer
describe
buffering
describe in detail the process of a disk operation where the following components are used
- Application Programming Interface (API)
- caching
- buffering
- I/O operation
- device driver
- I/O registers
- Direct Memory Access (DMA)
- Interrupt Service Routine (ISR)
- context switch
- The process calls an API function such as read.
- This invokes a system call which switches the processor into kernel mode.
- The OS system call will first check to see if the read request can be satisfied from a cached copy or from the current buffer content.
- If the request can be satisfied, then:
- a.the system call completes, returning the processor to user mode
- b.the API function completes
- c.the data can now be used by the calling process.
- However, if an I/O transfer is required, then:
- a.the transfer request is passed to the device driver
- b.this sets up the device I/O registers with the number of the block to read and the address of the buffer to receive the data
- c.the I/O hardware starts to handle the request
- d.the calling process’s state is set to blocked and the OS performs a context switch.
- The I/O hardware will start a DMA transfer so that data is streamed from the device into a buffer. (This does not involve the processor, which will be executing some other process.)
- When the DMA transfer of the complete block finishes, the status I/O register is updated and an interrupt occurs.
- An interrupt service routine will be invoked which will change the blocked process state to ready.
- Either immediately or some time later, a context switch will allow the original calling process to run again.
- The read request can now be satisfied since the data is in the buffer so:
- a.the system call completes, returning the processor to user mode
- b.the API function completes
- c.the data can now be used by the calling process.
these system calls can be explained as
- OPEN - opens a new buffer
- CLOSE - closes a buffer, and will ensure that an I/O operation is carried out even if the buffer is not in a ready state for an I/O transfer (such as not being full)
describe the system calls used by a process in order to control a buffer
- OPEN
- CLOSE
this file holds details about I/O ports and there mappings. It can be assumed that mappings in here will be using the port-addressed I/O method to interface between the OS and the I/O registers
describe the linux file
/proc/ioports
name the similarities and differences between
caching and buffering
these include:
- similarities
- they are both a dedicated space in main memory used to improve I/O operations
- differences
- a buffer will hold the only copy of that data
- a cache will hold a copy of data while the original will be held somewhere else (typically in a place that is slower to access such as seconadry storage)