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
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
26
how is ## Footnote **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
27
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
28
describe the linux file ## Footnote **/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
29
this can be implemented by: * **Buffer to cache transfer** * **read-ahead caching**
name two ways in which caching can be implemented
30
describe the lnux command ## Footnote **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
31
describe the linux command **modinfo** *module*
also known as module info can be used to view information about a linux kernel module
32
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
33
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
34
name 3 benefits of: ## Footnote **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
35
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 ## Footnote **device driver**
36
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 ## Footnote **caching**
37
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 ## Footnote **data transfer carried out between main memory and an I/O device**
38
within an I/O device this holds the data that is to be transferred
describe the ## Footnote **data register within an I/O device**
39
describe how the OS would use and benefit from ## Footnote **Direct memory access I/O**
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
40
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 ## Footnote **buffering**
41
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
42
describe the linux directory ## Footnote **/dev**
this is a linux directory that holds pseudo files relating to periphial devices
43
this method of I/O data transfer is particularly usefull for: * block devices * slow I/O transfers
describe two scenerios where ## Footnote **Direct memory access I/O** is particularly useful
44
this I/O device will include: * Address register * Byte count register * Control register
name 3 register that will belong to the ## Footnote **direct memory access controller (DMAC)**
45
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
what would happen if operating systems did not use buffering
46
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 ## Footnote **control register within an I/O device**
47
describe the linux directory ## Footnote **/proc**
this is a linux directory that holds pseudo files relating to running processes
48
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
49
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 ## Footnote **interrupt service routine (ISR)**
50
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 ## Footnote **Direct memory access I/O**
51
describe a ## Footnote **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
52
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 ## Footnote **buffering**
53
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
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.
54
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
55
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 ## Footnote **/proc/ioports**
56
name the similarities and differences between ## Footnote **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)
57
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)
58
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 ## Footnote **busy waiting**
59
describe the linux file ## Footnote **/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
60
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
61
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
62
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 ## Footnote **Interrupt driven I/O**
63
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
64
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 ## Footnote **caching**
65
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)
66
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 ## Footnote **port-addressed I/O**
67
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)**
68
describe the ## Footnote **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.
69
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 ## Footnote **Buffer to cache transfer**
70
what would happen if operating systems did not use buffering
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
within a device these include: * data register * status register * control register
name 3 **I/O registers** you may find within a device
72
desribe caching being implemented by ## Footnote **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
73
describe a ## Footnote **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
74
describe the linux directory /sys
this is a directory that holds pseudo files that realte to the linux kernel
75
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 )
76
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 ## Footnote **benefit of a bus interface**
77
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 ## Footnote **Lsmod**
78
describe ## Footnote **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
79
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
80
this is a directory that holds pseudo files that realte to the linux kernel
describe the linux directory /sys
81
what is 2 disadvantage and 1 advantage of ## Footnote **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
82
when a file system wants to read data from secondary storage how would it format this request
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
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)**
84
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: ## Footnote **Direct memory access I/O**
85
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
86
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
how does an OS see a connection to secondary storage
87
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 ## Footnote **Lsusb**
88
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
89
also known as module info can be used to view information about a linux kernel module
describe the linux command **modinfo** *module*
90
give an example of a text editor receiving data from a keyboard using ## Footnote **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
91
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
92
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
when a file system wants to read data from secondary storage how would it format this request
93
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 ## Footnote **Interrupt driven I/O**
94
name 3 register that will belong to the ## Footnote **direct memory access controller (DMAC)**
this I/O device will include: * Address register * Byte count register * Control register
95
name 3 **I/O registers** you may find within a device
within a device these include: * data register * status register * control register
96
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
97
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
98
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.
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
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
100
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
101
describe ## Footnote **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
102
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**
103
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
104
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)
105
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
106
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
107
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
108
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 ## Footnote **polled I/O**
109
describe ## Footnote **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
110
describe ## Footnote **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
111
how does an OS see a connection to secondary storage
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
describe ## Footnote **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
113
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 ## Footnote **direct memory access controller (DMAC)**
114
name 2 benefits of ## Footnote **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
115
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 ## Footnote **bus**
116
this is a directory that holds various hardware and may even allow control of the hardware (such as keyboard LEDs)
describe the linux directory ## Footnote **/sys/class**
117
describe a ## Footnote **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
118
name an advantage and disadvantage of ## Footnote **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
119
describe ## Footnote **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
120
describe ## Footnote **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
121
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.
122
describe the linux directory ## Footnote **/sys/class**
this is a directory that holds various hardware and may even allow control of the hardware (such as keyboard LEDs)
123
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 ## Footnote **/proc/iomem**
124
describe the linu command ## Footnote **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
125
this is a linux directory that holds pseudo files relating to running processes
describe the linux directory ## Footnote **/proc**
126
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)**
127
this is a linux directory that holds pseudo files relating to periphial devices
describe the linux directory ## Footnote **/dev**
128
describe ## Footnote **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
129
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 ## Footnote **character device**
130
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 ## Footnote **I/O registers**
131
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
132
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
133
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
134
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 ## Footnote **memory-mapped I/O**
135
describe an ## Footnote **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
136
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 ## Footnote **buffer**
137
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
describe how the OS would use and benefit from ## Footnote **Direct memory access I/O**
138
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 ## Footnote **I/O polling**
139
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
decribe how a newly connected USB device will initiate communication with the OS
140
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 ## Footnote **block devices**