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)
describe the system calls used by a process in order to control a buffer
- OPEN
- CLOSE
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)
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

what is
busy waiting
describe the linux file
/proc/ioports
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
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
what will periphials that make use of a
bus interface
likely have built into them
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
the layers for this is described in the diagram below

This is a method of handling the control and data transfer to andfrom I/O devices
It involves the I/O device sending an interrupt to the processor whenever it is ready to receive data or it is ready to send data
When the processor receives the interrupt it will halt the current execution (using stack pointers) and the interrupt service routine (ISR) for the device will be called. Upon completion the ISR will make the RETURN call
describe
Interrupt driven I/O
descibe the
address register
of the
direct memory access controller (DMAC)
within the direct memory access controller (DMAC)
the OS can populate this register telling the device where to start read/write in main memory
this is used by the operating system in order to improve speeds.
It involves the operating system dedicating some amount of space in ram that is dedicated to holding cached data
describe
caching
descibe the
control register
of the
direct memory access controller (DMAC)
within the direct memory access controller (DMAC)
this register holds various controls that the dma may offer (and assumed what I/O device is being executed on)
this is a mechanism used by processors to interface with I/O devices.
It involves the processor having special instructions that are dedicated to accessing I/O registers such as IN and OUT.
Within this system the processor will allocate an I/O register with a dedicated I/O port of the processor
describe
port-addressed I/O
within the direct memory access controller (DMAC)
the OS can populate this register telling the device where to start read/write in main memory
descibe the
address register
of the
direct memory access controller (DMAC)
describe the
control register within an I/O device
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.
A buffer can be filled by a process and then written out to disk.
The OS can then allocate that buffer as cache and a new buffer can be created for the next block of data that will be written to disk.
The performance increase that could be gained here is that if the data in this cache is needed again then it can be taken from cache instead of secondary storage
desribe caching being implemented by
Buffer to cache transfer
what would happen if operating systems did not use buffering
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
within a device these include:
- data register
- status register
- control register
name 3
I/O registers
you may find within a device
desribe caching being implemented by
Buffer to cache transfer
A buffer can be filled by a process and then written out to disk.
The OS can then allocate that buffer as cache and a new buffer can be created for the next block of data that will be written to disk.
The performance increase that could be gained here is that if the data in this cache is needed again then it can be taken from cache instead of secondary storage
describe a
character device
this includes I/O devices such as keyboards and mouses where data is sent in a stream of characters which can be handled one byte (character) at a time
describe the linux directory
/sys
this is a directory that holds pseudo files that realte to the linux kernel
name 5
I/O devices
you might find on a pc or mobile
these include:
- Keyboard
- Mouse
- Touchscreen
- Busses
- Hardware components within a system on a chip (SOC) (I.e GPU )
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
benefit of a bus interface
aka list modules is a linux command that can be used to view the modules such as drivers that are currently in use and are in the /proc/modules file
describe the linu command
Lsmod
describe
polled I/O
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 the linux pseudo file
/proc/interrupts
this file can show a list of interrupts and how many times the interrupt has occurred on each processor
this is a directory that holds pseudo files that realte to the linux kernel
describe the linux directory
/sys
what is 2 disadvantage and 1 advantage of
I/O polling
these include:
- disadvantage
- this employs busy waiting. so while process 1 is using a shared resource and has control of processor 0 if process 2 then wants to use the shared resource then it will continue polling the resource and keep control of a processor until it can satisfy its task
- if multiple devices are being polled by a process. This increases the time that the process will be using the processor as well as the risk that important data could be lost due to the time gap between each poll
- advantage
- because this employs busy waiting it also has the added benefit of mutual exclusion
when a file system wants to read data from secondary storage how would it format this request
the file system would:
- want to read a file file.txt which it knows is block 74 and 2 bytes
- the file system gives this information to the I/O module which will handle the task
within the direct memory access controller (DMAC)
this register holds various controls that the dma may offer (and assumed what I/O device is being executed on)
descibe the
control register
of the
direct memory access controller (DMAC)
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
name 3 benefits of:
Direct memory access I/O
why is a
bus interface
that allows I/O devices to connect to it also an I/O device in itself
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
the OS sees this as two separate components:
- There is the hardware itself such as a hdd or ssd
- There is the logical structure of the data on the hardware
Within the OS the file system module will handle the logical structuring and will call upon the I/O module to actually read/write the data at the lower level
how does an OS see a connection to secondary storage
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 lnux command
Lsusb
this can be dedicated hardware, software or a reserved space in ram.
Its general use case is to hold a copy of data that will need to be accessed but the copy this holds is faster to access than the original copy in turn bringing performance gains.
describe what
cache
is
also known as module info can be used to view information about a linux kernel module
describe the linux command
modinfo module
give an example of a text editor receiving data from a keyboard using
polled I/O
this example would include a text editor and a keyboard.
the text editor would be written with a loop that that can ask the processor to poll the I/O device (keyboard) for new data.
If the I/O device has new data the values can be read from its data register to main memory
excluding the user applications and hardware describe each of the interfaces and layers of the I/O module

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
the file system would:
- want to read a file file.txt which it knows is block 74 and 2 bytes
- the file system gives this information to the I/O module which will handle the task
when a file system wants to read data from secondary storage how would it format this request
these include:
- advantage
- high processor utilization - does not use the busy waiting method. instead a process is placed in a block state and a context switch occurs if an I/O device is busy
- disadvantage
- high overhead - with this sytem an interrupt is called for each byte that is sent/received. meaning an ISR will be called many times
name an advantage and disadvantage of
Interrupt driven I/O
name 3 register that will belong to the
direct memory access controller (DMAC)
this I/O device will include:
- Address register
- Byte count register
- Control register
name 3
I/O registers
you may find within a device
within a device these include:
- data register
- status register
- control register
descibe the
Byte count register
of the
direct memory access controller (DMAC)
within the direct memory access controller (DMAC)
the os can populate this register and tells the device how many bytes are to be transferred
give 1 task that an
interrupt service routine (ISR)
would carry out
one task this would carry out upon being called is to transfer data from an I/O device data register to main memory
- 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.
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
this file can show a list of interrupts and how many times the interrupt has occurred on each processor
describe the linux pseudo file
/proc/interrupts
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
major number
that the OS allocates to an I/O device in order to uniquely identify it
describe
I/O registers
these are registers that are located on a hardware device. They are used as an interface between the operating system and the hardware.
Some instructions that the operating system carries out will be able to access these registers to perform actions such as read / write
within a buffering system the OS will carry this out only when:
- buffer is full (for output/write operations)
- buffer is empty (for input/read operations)
when does an
I/O operation
actually occur when employing
buffering
these include:
- Keyboard
- Mouse
- Touchscreen
- Busses
- Hardware components within a system on a chip (SOC) (I.e GPU )
name 5
I/O devices
you might find on a pc or mobile
when does an
I/O operation
actually occur when employing
buffering
within a buffering system the OS will carry this out only when:
- buffer is full (for output/write operations)
- buffer is empty (for input/read operations)
the two components of this numbering system that the OS uses are:
- major number
- minor number
what are the two components of the numbering system that the OS uses to uniquely identify each I/O device
how does an operating system know what I/O devices are connected
to achieve this the operating system maintains a table of all devices and uses a numbering system that uniquely identifies each device
what are the two components of the numbering system that the OS uses to uniquely identify each I/O device
the two components of this numbering system that the OS uses are:
- major number
- minor number
this example would include a text editor and a keyboard.
the text editor would be written with a loop that that can ask the processor to poll the I/O device (keyboard) for new data.
If the I/O device has new data the values can be read from its data register to main memory
give an example of a text editor receiving data from a keyboard using
polled I/O
describe
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
Interrupt driven I/O
This is a method of handling the control and data transfer to andfrom I/O devices
It involves the I/O device sending an interrupt to the processor whenever it is ready to receive data or it is ready to send data
When the processor receives the interrupt it will halt the current execution (using stack pointers) and the interrupt service routine (ISR) for the device will be called. Upon completion the ISR will make the RETURN call
how does an OS see a connection to secondary storage
the OS sees this as two separate components:
- There is the hardware itself such as a hdd or ssd
- There is the logical structure of the data on the hardware
Within the OS the file system module will handle the logical structuring and will call upon the I/O module to actually read/write the data at the lower level
describe
memory-mapped I/O
this is a mechanism used by processors to interface with I/O devices.
It involves mapping main memory addresses to the memory and registers of an I/O device
the OS can then access I/O registers and memory by using the same instructions used to access ram, such as LOAD and STORE
I/O devices will then listen on the address bus and when the processor executes a memory address that is associated with that I/O devices register or memory the I/O device will connect the data bus to the appropriate I/O register or memory
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 the
direct memory access controller (DMAC)
name 2 benefits of
buffering
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
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
describe a
bus
this is a directory that holds various hardware and may even allow control of the hardware (such as keyboard LEDs)
describe the linux directory
/sys/class
describe a
buffer
this is a dedicated space in main memory that processes can read/write data to in order to provide more efficient I/O operations.
This is achieved by allowing the process to fill/empty the buffer before any I/O operations are made by the OS
name an advantage and disadvantage of
Interrupt driven I/O
these include:
- advantage
- high processor utilization - does not use the busy waiting method. instead a process is placed in a block state and a context switch occurs if an I/O device is busy
- disadvantage
- high overhead - with this sytem an interrupt is called for each byte that is sent/received. meaning an ISR will be called many times
describe
port-addressed I/O
this is a mechanism used by processors to interface with I/O devices.
It involves the processor having special instructions that are dedicated to accessing I/O registers such as IN and OUT.
Within this system the processor will allocate an I/O register with a dedicated I/O port of the processor
describe
caching
this is used by the operating system in order to improve speeds.
It involves the operating system dedicating some amount of space in ram that is dedicated to holding cached data
describe what
cache
is
this can be dedicated hardware, software or a reserved space in ram.
Its general use case is to hold a copy of data that will need to be accessed but the copy this holds is faster to access than the original copy in turn bringing performance gains.
describe the linux directory
/sys/class
this is a directory that holds various hardware and may even allow control of the hardware (such as keyboard LEDs)
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
describe the linux file
/proc/iomem
describe the linu command
Lsmod
aka list modules is a linux command that can be used to view the modules such as drivers that are currently in use and are in the /proc/modules file
this is a linux directory that holds pseudo files relating to running processes
describe the linux directory
/proc
within the direct memory access controller (DMAC)
the os can populate this register and tells the device how many bytes are to be transferred
descibe the
Byte count register
of the
direct memory access controller (DMAC)
this is a linux directory that holds pseudo files relating to periphial devices
describe the linux directory
/dev
describe
Direct memory access I/O
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
this includes I/O devices such as keyboards and mouses where data is sent in a stream of characters which can be handled one byte (character) at a time
describe a
character device
these are registers that are located on a hardware device. They are used as an interface between the operating system and the hardware.
Some instructions that the operating system carries out will be able to access these registers to perform actions such as read / write
describe
I/O registers
describe the
minor number
that the OS allocates to an I/O device in order to uniquely identify it
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
to achieve this the operating system maintains a table of all devices and uses a numbering system that uniquely identifies each device
how does an operating system know what I/O devices are connected
one task this would carry out upon being called is to transfer data from an I/O device data register to main memory
give 1 task that an
interrupt service routine (ISR)
would carry out
this is a mechanism used by processors to interface with I/O devices.
It involves mapping main memory addresses to the memory and registers of an I/O device
the OS can then access I/O registers and memory by using the same instructions used to access ram, such as LOAD and STORE
I/O devices will then listen on the address bus and when the processor executes a memory address that is associated with that I/O devices register or memory the I/O device will connect the data bus to the appropriate I/O register or memory
describe
memory-mapped I/O
describe an
interrupt service routine (ISR)
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
this is a dedicated space in main memory that processes can read/write data to in order to provide more efficient I/O operations.
This is achieved by allowing the process to fill/empty the buffer before any I/O operations are made by the OS
describe a
buffer
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
describe how the OS would use and benefit from
Direct memory access I/O
these include:
- disadvantage
- this employs busy waiting. so while process 1 is using a shared resource and has control of processor 0 if process 2 then wants to use the shared resource then it will continue polling the resource and keep control of a processor until it can satisfy its task
- if multiple devices are being polled by a process. This increases the time that the process will be using the processor as well as the risk that important data could be lost due to the time gap between each poll
- advantage
- because this employs busy waiting it also has the added benefit of mutual exclusion
what is 2 disadvantage and 1 advantage of
I/O polling
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
decribe how a newly connected USB device will initiate communication with the OS
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
block devices