lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

Devices.md (2438B)


      1 +++
      2 title = 'Devices'
      3 +++
      4 # Devices
      5 Solid-State Drive (SSD)
      6 
      7 - based on DRAM or NAND/NOR flash memory. no mechanical parts.
      8 - NAND flash memory
      9     - organisation: cells, pages, blocks
     10     - controller can read/program by page
     11     - controller can erase by block
     12     - random/sequential access latency is comparable, but more efficient at reading than writing.
     13 
     14 Hard Disk (HDD)
     15 
     16 - platters and cylinders in a disk, as many tracks as heads. each track has N sectors
     17 - addressing modes:
     18     - CHS (cylinder-head-sector), virtual/physical
     19     - LBA (logical block addressing), only virtual
     20 - in order to transfer data, you have to seek, rotate, and actually transfer. this adds up.
     21 - so how do you optimise it?
     22     - aaand we’re back to scheduling. this time we’re scheduling the disk arm.
     23         - first come first serve: do requests in order of arrival. but that’s not actually an optimisation.
     24         - shortest seek first: do requests with a shortest seek time. but that has to be calculated.
     25         - elevator algorithm: go up the disk, then down the disk, then back up the disk…do requests along the way.
     26 - error handling
     27     - programming errors (if you’re requesting a nonexistent sector)
     28     - transient errors (e.g. shit getting on the head of the arm)
     29     - permanent errors (if a disk block is physically damaged)
     30     - seek errors (the arm went to the wrong place)
     31     - controller errors (controller is a lil bitch and stops accepting commands)
     32     - disk track with bad sector
     33         - in this case you can remap
     34         - switch spare for bad sector, or shift all sectors to bypass the bad one
     35 
     36 Clock
     37 
     38 - Hardware function
     39     - simple clocks send hardware interrupts every voltage cycle of power supply
     40     - advanced clocks have own crystal oscillator which decrements a counter in a register. send hardware interrupt every time the counter is 0
     41 - Software function
     42     - Maintains time of day (real time) — system boot time (backup cock) + uptime (ticks)
     43     - Stops processes from running too long — on every tick, decrement current process’ quantum
     44     - Accounts for CPU usage — on every tick, increment current process’ CPU time
     45     - Handle alarm syscall — on every tick, decrement alarm counter
     46     - Give the system watchdog/software timers — generate system notifications for synchronous alarms
     47     - Profile, monitor, gather statistics — on every tick, increment some set of counters