Topic 13 – Input/output Contents Flashcards

1
Q

describe the

status register within an I/O device

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

this is also known as an

interrupt handler

A

what is an

interrupt service routine (ISR)

also known as

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is an

interrupt service routine (ISR)

also known as

A

this is also known as an

interrupt handler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

describe the

data register within an I/O device

A

within an I/O device this holds the data that is to be transferred

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

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

A

describe

polled I/O

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

name an advantage and disadvantage of

caching

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

decribe how a newly connected USB device will initiate communication with the OS

A

the process for this is:

  1. The OS provides a generic USB driver to initiate the communication with the device over the bus via the bus controller
  2. The device can then identify itself to the OS telling it its class such as: storage, human interface device (HID) (mouse keyboard)
  3. Configuration will take place such as negotiating data rates
  4. if necessary a more specific device driver can now be found and installed for the usb device
  5. Data transfer continues using the bus
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

describe the

major number

that the OS allocates to an I/O device in order to uniquely identify it

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

describe the

direct memory access controller (DMAC)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

describe

buffering

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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
A

excluding the user applications and hardware describe each of the interfaces and layers of the I/O module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what is a

benefit of a bus interface

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is a

pseudo file

within linux

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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

A

describe the

minor number

that the OS allocates to an I/O device in order to uniquely identify it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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

A

describe the

status register within an I/O device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what will periphials that make use of a

bus interface

likely have built into them

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

describe

block devices

A

this includes I/O devices such as disk drives where data is sent in large fixed sized blocks at a time (typically 512 bytes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

describe a

device driver

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

name two ways in which caching can be implemented

A

this can be implemented by:

  • Buffer to cache transfer
  • read-ahead caching
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

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

A

describe

read-ahead caching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

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)
A

name the similarities and differences between

caching and buffering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

what is

busy waiting

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

describe two scenerios where

Direct memory access I/O

is particularly useful

A

this method of I/O data transfer is particularly usefull for:

  • block devices
  • slow I/O transfers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

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

A

why are device drivers essential for an OS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

when employing

buffering

under which two circumstances would a process not be blocked

A

within this system A process is only blocked if

  • an output buffer is full
  • an input buffer is empty
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

how is

data transfer carried out between main memory and an I/O device

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

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

A

why is a

bus interface

that allows I/O devices to connect to it also an I/O device in itself

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

describe the linux file

/proc/iomem

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

this can be implemented by:

  • Buffer to cache transfer
  • read-ahead caching
A

name two ways in which caching can be implemented

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

describe the lnux command

Lsusb

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

describe the linux command

modinfo module

A

also known as module info can be used to view information about a linux kernel module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

why are device drivers essential for an OS

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

the layers for this is described in the diagram below

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

name 3 benefits of:

Direct memory access I/O

A

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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

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

A

describe a

device driver

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

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
A

name an advantage and disadvantage of

caching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

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

A

how is

data transfer carried out between main memory and an I/O device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

within an I/O device this holds the data that is to be transferred

A

describe the

data register within an I/O device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

describe how the OS would use and benefit from

Direct memory access I/O

A

with this:

  1. the OS issues a task to the direct memory access controller (DMAC) (such as read data from this device)
  2. the OS can then let the processor handleanother task while the DMAC makes the transfer
  3. when the DMAC has finished it will send an interrupt to the processor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

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
A

name 2 benefits of

buffering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

within this system A process is only blocked if

  • an output buffer is full
  • an input buffer is empty
A

when employing

buffering

under which two circumstances would a process not be blocked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

describe the linux directory

/dev

A

this is a linux directory that holds pseudo files relating to periphial devices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

this method of I/O data transfer is particularly usefull for:

  • block devices
  • slow I/O transfers
A

describe two scenerios where

Direct memory access I/O

is particularly useful

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

this I/O device will include:

  • Address register
  • Byte count register
  • Control register
A

name 3 register that will belong to the

direct memory access controller (DMAC)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

if this did not exists then:

  1. a process would make an I/O system call
  2. the process would most likely be placed in a blocked state
  3. a context switch would occur
  4. an interrupt would be made from the device for each byte it has ready
  5. the process would be put in a ready state
A

what would happen if operating systems did not use buffering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

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

describe the

control register within an I/O device

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

describe the linux directory

/proc

A

this is a linux directory that holds pseudo files relating to running processes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

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

A

what is a

pseudo file

within linux

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

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

A

describe an

interrupt service routine (ISR)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

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

A

describe

Direct memory access I/O

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

describe a

bus

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

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

A

describe

buffering

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

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
A
  1. The process calls an API function such as read.
  2. This invokes a system call which switches the processor into kernel mode.
  3. 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.
  4. If the request can be satisfied, then:
    1. a.the system call completes, returning the processor to user mode
    2. b.the API function completes
    3. c.the data can now be used by the calling process.
  5. However, if an I/O transfer is required, then:
    1. a.the transfer request is passed to the device driver
    2. 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
    3. c.the I/O hardware starts to handle the request
    4. d.the calling process’s state is set to blocked and the OS performs a context switch.
  6. 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.)
  7. When the DMA transfer of the complete block finishes, the status I/O register is updated and an interrupt occurs.
  8. An interrupt service routine will be invoked which will change the blocked process state to ready.
  9. Either immediately or some time later, a context switch will allow the original calling process to run again.
  10. The read request can now be satisfied since the data is in the buffer so:
    1. a.the system call completes, returning the processor to user mode
    2. b.the API function completes
    3. c.the data can now be used by the calling process.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

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)
A

describe the system calls used by a process in order to control a buffer

  • OPEN
  • CLOSE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

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

A

describe the linux file

/proc/ioports

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

name the similarities and differences between

caching and buffering

A

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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

describe the system calls used by a process in order to control a buffer

  • OPEN
  • CLOSE
A

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)
58
Q

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

A

what is

busy waiting

59
Q

describe the linux file

/proc/ioports

A

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

60
Q

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

A

what will periphials that make use of a

bus interface

likely have built into them

61
Q

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

A

the layers for this is described in the diagram below

62
Q

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

A

describe

Interrupt driven I/O

63
Q

descibe the

address register

of the

direct memory access controller (DMAC)

A

within the direct memory access controller (DMAC)

the OS can populate this register telling the device where to start read/write in main memory

64
Q

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

A

describe

caching

65
Q

descibe the

control register

of the

direct memory access controller (DMAC)

A

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)

66
Q

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

A

describe

port-addressed I/O

67
Q

within the direct memory access controller (DMAC)

the OS can populate this register telling the device where to start read/write in main memory

A

descibe the

address register

of the

direct memory access controller (DMAC)

68
Q

describe the

control register within an I/O device

A

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.

69
Q

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

A

desribe caching being implemented by

Buffer to cache transfer

70
Q

what would happen if operating systems did not use buffering

A

if this did not exists then:

  1. a process would make an I/O system call
  2. the process would most likely be placed in a blocked state
  3. a context switch would occur
  4. an interrupt would be made from the device for each byte it has ready
  5. the process would be put in a ready state
71
Q

within a device these include:

  • data register
  • status register
  • control register
A

name 3

I/O registers

you may find within a device

72
Q

desribe caching being implemented by

Buffer to cache transfer

A

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

73
Q

describe a

character device

A

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

74
Q

describe the linux directory

/sys

A

this is a directory that holds pseudo files that realte to the linux kernel

75
Q

name 5

I/O devices

you might find on a pc or mobile

A

these include:

  • Keyboard
  • Mouse
  • Touchscreen
  • Busses
  • Hardware components within a system on a chip (SOC) (I.e GPU )
76
Q

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

A

what is a

benefit of a bus interface

77
Q

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

A

describe the linu command

Lsmod

78
Q

describe

polled I/O

A

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

79
Q

describe the linux pseudo file

/proc/interrupts

A

this file can show a list of interrupts and how many times the interrupt has occurred on each processor

80
Q

this is a directory that holds pseudo files that realte to the linux kernel

A

describe the linux directory

/sys

81
Q

what is 2 disadvantage and 1 advantage of

I/O polling

A

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
82
Q

when a file system wants to read data from secondary storage how would it format this request

A

the file system would:

  1. want to read a file file.txt which it knows is block 74 and 2 bytes
  2. the file system gives this information to the I/O module which will handle the task
83
Q

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)

A

descibe the

control register

of the

direct memory access controller (DMAC)

84
Q

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
A

name 3 benefits of:

Direct memory access I/O

85
Q

why is a

bus interface

that allows I/O devices to connect to it also an I/O device in itself

A

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

86
Q

the OS sees this as two separate components:

  1. There is the hardware itself such as a hdd or ssd
  2. 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

A

how does an OS see a connection to secondary storage

87
Q

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

A

describe the lnux command

Lsusb

88
Q

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.

A

describe what

cache

is

89
Q

also known as module info can be used to view information about a linux kernel module

A

describe the linux command

modinfo module

90
Q

give an example of a text editor receiving data from a keyboard using

polled I/O

A

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

91
Q

excluding the user applications and hardware describe each of the interfaces and layers of the I/O module

A

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
92
Q

the file system would:

  1. want to read a file file.txt which it knows is block 74 and 2 bytes
  2. the file system gives this information to the I/O module which will handle the task
A

when a file system wants to read data from secondary storage how would it format this request

93
Q

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
A

name an advantage and disadvantage of

Interrupt driven I/O

94
Q

name 3 register that will belong to the

direct memory access controller (DMAC)

A

this I/O device will include:

  • Address register
  • Byte count register
  • Control register
95
Q

name 3

I/O registers

you may find within a device

A

within a device these include:

  • data register
  • status register
  • control register
96
Q

descibe the

Byte count register

of the

direct memory access controller (DMAC)

A

within the direct memory access controller (DMAC)

the os can populate this register and tells the device how many bytes are to be transferred

97
Q

give 1 task that an

interrupt service routine (ISR)

would carry out

A

one task this would carry out upon being called is to transfer data from an I/O device data register to main memory

98
Q
  1. The process calls an API function such as read.
  2. This invokes a system call which switches the processor into kernel mode.
  3. 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.
  4. If the request can be satisfied, then:
    1. a.the system call completes, returning the processor to user mode
    2. b.the API function completes
    3. c.the data can now be used by the calling process.
  5. However, if an I/O transfer is required, then:
    1. a.the transfer request is passed to the device driver
    2. 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
    3. c.the I/O hardware starts to handle the request
    4. d.the calling process’s state is set to blocked and the OS performs a context switch.
  6. 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.)
  7. When the DMA transfer of the complete block finishes, the status I/O register is updated and an interrupt occurs.
  8. An interrupt service routine will be invoked which will change the blocked process state to ready.
  9. Either immediately or some time later, a context switch will allow the original calling process to run again.
  10. The read request can now be satisfied since the data is in the buffer so:
    1. a.the system call completes, returning the processor to user mode
    2. b.the API function completes
    3. c.the data can now be used by the calling process.
A

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
99
Q

this file can show a list of interrupts and how many times the interrupt has occurred on each processor

A

describe the linux pseudo file

/proc/interrupts

100
Q

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

A

describe the

major number

that the OS allocates to an I/O device in order to uniquely identify it

101
Q

describe

I/O registers

A

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

102
Q

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)
A

when does an

I/O operation

actually occur when employing

buffering

103
Q

these include:

  • Keyboard
  • Mouse
  • Touchscreen
  • Busses
  • Hardware components within a system on a chip (SOC) (I.e GPU )
A

name 5

I/O devices

you might find on a pc or mobile

104
Q

when does an

I/O operation

actually occur when employing

buffering

A

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)
105
Q

the two components of this numbering system that the OS uses are:

  • major number
  • minor number
A

what are the two components of the numbering system that the OS uses to uniquely identify each I/O device

106
Q

how does an operating system know what I/O devices are connected

A

to achieve this the operating system maintains a table of all devices and uses a numbering system that uniquely identifies each device

107
Q

what are the two components of the numbering system that the OS uses to uniquely identify each I/O device

A

the two components of this numbering system that the OS uses are:

  • major number
  • minor number
108
Q

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

A

give an example of a text editor receiving data from a keyboard using

polled I/O

109
Q

describe

read-ahead caching

A

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

110
Q

describe

Interrupt driven I/O

A

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

111
Q

how does an OS see a connection to secondary storage

A

the OS sees this as two separate components:

  1. There is the hardware itself such as a hdd or ssd
  2. 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

112
Q

describe

memory-mapped I/O

A

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

113
Q

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

A

describe the

direct memory access controller (DMAC)

114
Q

name 2 benefits of

buffering

A

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
115
Q

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

A

describe a

bus

116
Q

this is a directory that holds various hardware and may even allow control of the hardware (such as keyboard LEDs)

A

describe the linux directory

/sys/class

117
Q

describe a

buffer

A

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

118
Q

name an advantage and disadvantage of

Interrupt driven I/O

A

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
119
Q

describe

port-addressed I/O

A

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

120
Q

describe

caching

A

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

121
Q

describe what

cache

is

A

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.

122
Q

describe the linux directory

/sys/class

A

this is a directory that holds various hardware and may even allow control of the hardware (such as keyboard LEDs)

123
Q

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

A

describe the linux file

/proc/iomem

124
Q

describe the linu command

Lsmod

A

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

125
Q

this is a linux directory that holds pseudo files relating to running processes

A

describe the linux directory

/proc

126
Q

within the direct memory access controller (DMAC)

the os can populate this register and tells the device how many bytes are to be transferred

A

descibe the

Byte count register

of the

direct memory access controller (DMAC)

127
Q

this is a linux directory that holds pseudo files relating to periphial devices

A

describe the linux directory

/dev

128
Q

describe

Direct memory access I/O

A

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

129
Q

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

A

describe a

character device

130
Q

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

A

describe

I/O registers

131
Q

describe the

minor number

that the OS allocates to an I/O device in order to uniquely identify it

A

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

132
Q

to achieve this the operating system maintains a table of all devices and uses a numbering system that uniquely identifies each device

A

how does an operating system know what I/O devices are connected

133
Q

one task this would carry out upon being called is to transfer data from an I/O device data register to main memory

A

give 1 task that an

interrupt service routine (ISR)

would carry out

134
Q

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

A

describe

memory-mapped I/O

135
Q

describe an

interrupt service routine (ISR)

A

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

136
Q

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

A

describe a

buffer

137
Q

with this:

  1. the OS issues a task to the direct memory access controller (DMAC) (such as read data from this device)
  2. the OS can then let the processor handleanother task while the DMAC makes the transfer
  3. when the DMAC has finished it will send an interrupt to the processor
A

describe how the OS would use and benefit from

Direct memory access I/O

138
Q

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
A

what is 2 disadvantage and 1 advantage of

I/O polling

139
Q

the process for this is:

  1. The OS provides a generic USB driver to initiate the communication with the device over the bus via the bus controller
  2. The device can then identify itself to the OS telling it its class such as: storage, human interface device (HID) (mouse keyboard)
  3. Configuration will take place such as negotiating data rates
  4. if necessary a more specific device driver can now be found and installed for the usb device
  5. Data transfer continues using the bus
A

decribe how a newly connected USB device will initiate communication with the OS

140
Q

this includes I/O devices such as disk drives where data is sent in large fixed sized blocks at a time (typically 512 bytes)

A

describe

block devices