Disks #

  • 6-12 platters, each with 200k inch tracks, 1000 sectors per track, 4096 bytes per sector
  • Total capacity ~100GB to 18TB

I/O operation #

  • Seek: position heads over track we want to read or write (2-10ms)
  • Rotational latency: 4ms at 7500RPM
  • Transfer: 100-150 MB/sec

API: #

void read(start_sector, sector_count, phys_mem_addr);
void write(start_sector, sector_count, phys_mem_addr);

Disk structure hidden because

  • Inner tracks have fewer sectors
  • Disk can remap bad sectors

Device registers #

  • One block per device
  • Words in physical memory
    • Parameters
    • Status bits (“completed”, “error”)
    • Control bits set by CPU (“start operation”)
  • Don’t behave like memory
    • Some fields might always read as 0
    • Can change without being written to

Operation #

  • Write register to start
  • Ready bit reads as 0
  • When operation does, ready bit reads as 1

Interrupts #

  • “Interrupt enabled” (IE) bit in register
  • After starting operation, OS will set this bit
  • OS does something else
  • When device becomes ready, checks IE bit
  • If IE bit on, device interrupts when ready
    • Save IP and PS
    • Branch into OS, load new PS (stored in interrupt vector)
  • Disable IE in handler

Multi-core machines: spread interrupts to many cores

Direct memory acess #

  • Device can transfer to/from memory directly
  • Fixes inefficiency of programmed I/O, where OS feeds data through device register