I/O Flashcards

1
Q

file system components

A

interface
implementation
mass-storage structure: lowest level of the fs, the secondary and tertriary storage structures

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

block devices

A

hard disks, SSDs
store information in fixed-sized blocks
transfers are in units of entire blocks
I/O occurs with random access (by block ID)

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

character devices

A

printers, network interfaces
no blocks, only stream of characters/bytes
not addressable, doesn’t have any seek operation
I/O occurs with sequential access

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

device controller

A
  • Located between actual device and computer
  • Offers electronic interface in form of I/O registers
  • R/W those registers to ask the controller to perform actions
  • e.g. parallel port, usb
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

port-mapped I/O

A

two address spaces: main memory + ports
I/O Registers are accessed via dedicated port numbers and special instructions

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

memory-mapped I/O

A

one address space
I/O Registers are mapped into addresses of main memory and accessed like memory

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

hybrid I/O

A

two address spaces
Both implementation can coexist on a given architecture

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

I/O requests

A

Most devices offer status bits in their registers to signal that a request has been finished (and the error code)
OS can poll this status bit (polling)

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

polling / busy waiting

A

after outputting a character, the CPU continuously polls the device to see if it is ready to accept another one

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

interrupts

A

Device controller can trigger interrupts to signal that an I/O request is complete
=> For the device, this means simply changing the voltage on an electrical interrupt line
- Each controller has interrupt vector assigned
- CPU runs vector-specific handler when int occurs

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

trap

A

deliberate action from a program, software interrupt

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

fault (exception)

A

usually not deliberate, typically caused by programs

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

hardware interrupt

A

device such as printer or network sends a signal to the CPU

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

precise <-> imprecise interrupts

A

precise: state is consistent- everything before the interrupt is executed and after isn’t
imprecise: doesn’t have the same guarantee

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

Data Exchange Between Device and CPU

A
  • Program disk controller reads a sector
  • Wait for interrupt
  • Read sizeof(sector) bytes from I/O registers
  • Repeat for next sector
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

DMA

A

hardware does the data transfer

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

DMA steps

A
  1. CPU programs the DMA controller
  2. DMA requests transfer to memory from disk controller
  3. data transferred to/from main memory
  4. ack sent to DMA controller
  5. interrupt sent to the CPU when done
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

DMA controller

A
  • On ISA systems there was a dedicated DMA controller (third-party DMA)
  • On PCI (and PCIe) systems each PCI device may become “Bus Master” and perform DMA (first-party DMA)
    • Device and DMA controller are combined
    • problem: You have to trust your Hw
  • Embedded systems still have a dedicated DMA controller
  • Disk controller still uses own buffers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

issues in I/O software

A
  • Device independence
  • Uniform naming
  • Error handling
  • Buffering
  • Synchronous vs asynchronous
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

device independence

A
  • I/O software provides abstraction over actual hardware
  • Programs should not have to care about device particularities
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

uniform naming

A
  • We don’t want to type ST6NM04 to address the first hard disk
  • /dev/sda is better
  • /mnt/movies even better
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

error handling

A

errors should be handled closest to their source

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

buffers

A

networking: incoming packets have to be buffered
audio: buffering to avoid clicks

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

synchronous vs asynchronous

A
  • Programs don’t want to deal with interrupts → OS turns async operations into blocking operations
  • Lower levels have to deal with interrupts, DMA, etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

I/O software layers + their functions

A
  1. user processes: make i/o call, format i/o, spooling
  2. device-independent software: naming, protection, blocking, buffering, allocation
  3. device drivers: set up device registers, check status
  4. interrupt handlers: wake up driver when i/o completed
  5. hardware: perform i/o operation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

i/o storage devices

A

SSD
HDD

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

SSD vs HDD

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

DRAM

A

or NOR/NAND flash memory
no mechanical parts (only controller + memory)
can be used as part of SSHDs

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

NAND flash memory

A

organised in cells, pages, blocks
controller can read/program at page granularity
controller can erase at block granularity
RND/SEQ access latency comparable
reads more efficient than writes
wear levelling to improve write endurance
garbage collection to implement write operations

30
Q

HDD

A

hard disk drive
multiple platters and cylinders in a single disk with as many tracks as their heads
each track has N sectors

31
Q

HDD addressing modes

A

CHS (cylinder-head-sector): virtual/physical
LBA (logical block addressing): virtual

32
Q

HDD block read/write time factors

A

seek time: the time to move the arm to the proper cylinder
rotational delay: the time for the sector to come under the head
data transfer time: the time to transfer a single block

33
Q

Disk Arm Scheduling algorithms aspects

A
  • we want: fast access time and large disk bandwidth
  • access time: seek time + rotational latency
    • seek time: time for the disk arm to move the heads to the cylinder with the desired sector
  • disk bandwidth: total number of bytes transferred / total time between the first request for service and the completion of the last transfer
  • total head movement: sum of differences between sectors between which the moves happpened
34
Q

FCFS disk

A
  • the requests are addressed in the order they arrive in the disk queue
  • fair algorithm
  • no starvation: every request gets its turn
35
Q

shortest seek first

A

can cause starvation: incoming requests can cause a previous one to not get its turn (we are at 15 and 99 waits, but we get 13 then 2, 7 etc.)

36
Q

elevator algorithm

A
  • scan from one end to the other
  • no starvation
  • a request that arrives just behind the head it will have to wait for the head to change direction even though it is right next to it
37
Q

Hard Disk Errors

A

programming errors: request for nonexistent sector
transient errors: cause by dust on the head
permanent errors: disk block physically damaged
seek errors: the arm was sent to cylinder 6 but i went to 7
controller errors: controller refuses to accept commands

38
Q

HD bad sector remapping

A
  1. A disk track with a bad sector
  2. Substituting a spare for the bad sector
  3. Shifting all the sectors to
    bypass the bad one
39
Q

clock hardware types

A
  • Simple clocks deliver hardware interrupts for each voltage cycle of the power supply (i.e., every 20 or 16.7 ms)
  • Advanced programmable clocks that have own crystal oscillator that decrements a counter in a register. If counter hits zero → HW interrupt
40
Q

duties for a clock driver

A
  1. Maintaining the time of day
    • System boot time (backup clock) + uptime (ticks)
  2. Preventing processes from running longer than allowed
    • Decrement current process’ quantum at each tick
  3. Accounting for CPU usage
    • Increment current process’ cpu time at each tick
  4. Handling alarm system call from user processes
    • Decrement alarm counter at each tick
  5. Providing watchdog timers for parts of system itself
    • Generate sys notifications for synchronous alarms
  6. Profiling, monitoring, statistics gathering
    • Increment specific counters at each tick
41
Q

magnetic disk physical geometry

A

Displays the actual structure of a disk with two zones, showing concentric circles representing tracks and numbered sectors on each track

42
Q

magnetic disk virtual geometry

A

Represents the simplified view presented to the operating system, where the disk is organized into a different

43
Q

magnetic disk

A
  • provides the bulk of secondary storage for modern computer systems
  • the surfaces are covered with a magnetic material → we store information by recording it magnetically on the platters
  • read-write head
  • reads and writes are equally fast, which makes them suitable as secondary memory (paging, file systems, etc.)
  • Organized into cylinders, tracks, and sectors; modern disks have multiple heads (1 to 16).
  • Older disks depended on the controller; modern SATA disks have integrated microcontrollers for optimized performance.
  • Features like overlapped seeks and simultaneous operations on multiple drives reduce access times.
44
Q

disk structure

A
  • large one-dimensional arrays of logical blocks
  • logical blocks: the smallest unit of transfer, usually 512 bytes
  • the array is mapped onto the sectors of the disk sequentially
  • Hard disks consist of stacked platters (3.5-inch or 2.5-inch).
  • Initially, disks have no data.
45
Q

disk formatting

A
  1. low-level formatting
  2. logical formatting
46
Q

low-level formatting

A

before a disk can store data, it must be divided into sectors that the disk controller can read and write

47
Q

disk sector layout

A
  1. preamble: starts with a certain bit pattern that allows the hardware to recognize the start of the sector
  2. data
  3. ECC: error-correcting code
48
Q

disk sector

A
  • Requires software to format each platter into concentric tracks with sectors and gaps.
  • Sector format includes a preamble, cylinder and sector numbers, a data portion, and an error correction code (ECC)
  • Common sector(data) size is 512 bytes
  • Spare sectors are reserved for replacing defective ones
49
Q

logical formatting

A
  1. partition the disk into one or more groups of cylinders
  2. logical formatting: the os stores the ds data structures onto the disk
50
Q

disk capacity

A
  • Formatted capacity is usually about 20% lower than unformatted capacity due to formatting overhead and spare sectors.
  • Confusion exists between advertised (unformatted) and actual (formatted) capacities.
  • Different interpretations of terabytes (TB) vs. tebibytes (TiB) add to the confusion.
51
Q

disk partitioning

A
  • After formatting, disks are partitioned to allow multiple operating systems.
  • MBR (Master Boot Record) and GPT (GUID Partition Table) support different disk sizes and partitioning methods.
  • The partition table outlines starting sectors and sizes of partitions.
52
Q

high-level formatting

A
  • Each partition undergoes high-level formatting to establish a file system.
  • This includes creating a boot block, free storage administration, and differentiating file systems.
  • The system can then boot using the appropriate partition marked as active.
53
Q

boot process

A

BIOS reads GPT upon power-on to locate the bootloader for the operating system.

54
Q

boot block

A
  • the bootstrap program: initialises all aspects of the system = starts the computer
  • boot disk or system disk
  • most computers store the bootstrap program in the ROM → the bootstrap can’t be changed → put to disk so we can alter it if needed
55
Q

bootstrap loader program

A

in ROM, brings full bootstrap program from the disk

56
Q

bad disk sectors

A

blocks that are damaged and can’t be used

57
Q

bad sector handling

A

manual
sector sparing or forwarding
sector slipping

58
Q

manual bad sector handling

A

format finds a bad block → write a special value in the corresponding FAT entry

59
Q

sector slipping

A
  • the controller maintains a list of bad blocks on the disk
  • initialised at low-level formatting
  • set aside a spare sector not visible to os
60
Q

sector sparing or forwarding

A
  • also has spares
  • logical block n is defective and first available spare is at m
  • remaps all sectors from n to m moving them down one spot: m is copied to the spare, then m-1 into m, and so on until n + 1 is copied into n + 2
  • this frees n + 1 so that we keep sequential order
61
Q

RAID

A

redundant arrays of independent disks
- a way of storing the same data in different places on multiple hard disks or SSDs to protect data in the case of failure
- higher data transfer rate and higher reliability
- working
- it places data on mutliple disks and allows I/O operations to overlap in a balanced way, thus improving performance
- increases mean time between failures
- disk mirroring: copying identical data to more than one drive
→ expensive
- disk stripping: spread data over multiple disk drives
- improvement of reliability over redundancy

62
Q

RAID level 0

A

no mirroring
blocks are split between disks

63
Q

RAID level 1

A

mirroring
data is duplicated
improves reading rate
fault tolerance

64
Q

RAID level 2

A

stripping not mirroring
disks with data + disks wit parity for each block
parity data used for error detection and correction

65
Q

RAID level 3

A

bits are stripped + single parity bit

66
Q

RAID level 4

A

block-level stripping + parity per block

67
Q

RAID level 5

A

parity after each block ( a1, a2, a3, a_parity, b1, b2, b3, b3, b_parity…)

68
Q

RAID level 6

A

like 5 but we use multiple parities → guarding against multiple disk failures

69
Q

stable storage

A
  • data is never lost
  • replicate data on multiple storage devices with independent failure modes
  • partial failure: during the write some data is not damaged some is
  • total failure: before the write started
  • for each logical block must maintain two physical blocks
    • when changing them first complete the write to the first one before changing the second one
  • during recovery both blocks are examined
    • if one is corrupted then replace it with the contents of the other one
    • if neither has an error but the contents differ, replace the content of the first block with that of the second
70
Q
A