Presentation is loading. Please wait.

Presentation is loading. Please wait.

OPERATING SYSTEMS 11 - DISK PIETER HARTEL 1. Hardware Intended for humans, local devices and communication (challenge?) Hardware support for interrupts.

Similar presentations


Presentation on theme: "OPERATING SYSTEMS 11 - DISK PIETER HARTEL 1. Hardware Intended for humans, local devices and communication (challenge?) Hardware support for interrupts."— Presentation transcript:

1 OPERATING SYSTEMS 11 - DISK PIETER HARTEL 1

2 Hardware Intended for humans, local devices and communication (challenge?) Hardware support for interrupts and DMA 2

3 Direct Memory Access (DMA) CPU sends commands to controller indicating: what to do and where in memory to get/put the data Controller runs in parallel with CPU Problem : Contention for system bus cycles Solution : I/O processor or I/O bus 3

4 Design issues Efficiency Buffering (how?) Scheduling Generality Layering Uniform access – Unix! 4

5 #define M 1024*1024 /* One MByte */ int main(int argc, char *argv[]) { int out = open(argv[1], O_RDWR|O_CREAT|O_TRUNC, 0666); int n = atoi(argv[2]); lseek(out, n*M-1, SEEK_SET); write(out, "\0", 1); close(out); return 0; } Sparse files & Network vs disk gcc Sparse.c for d in. /tmp do for n in do time./a.out $d/$n.dat $n time cp $d/$n.dat $d/junk done ls –l /tmp/*dat /tmp.junk 5 Time (s)

6 Mechanisms Disk with rotating platter and moving arm (alternative?) Timing Access time depends on the seek time + rotational delay Transfer time depends on the rotational speed and the channel bandwidth Example: Small blocks? 6 ??? 4ms 4ms 10ms/MB

7 Disk scheduling policies Example: 100, queue contains 55,58,39,18,90,160,150,38,184 Many requests Known address + size Which order? SSTF has an issue… 7

8 Redundant Array of Independent Disks Several physical drives seen as one logical drive Data is striped across the disks (why?) Redundancy (why?) 8

9 Linux design – uniform! Block devices for fast peripherals Character devices for slow peripherals Policies LRU block replacement policy (why?) SCAN scheduler for block R/W Devices are handled as special files: df -l ls –l /dev/cciss/c0d0p2 /dev/tty cat /dev/tty >junk 9

10 #define M 1024*256 #define N 1000 /* number of buffers written */ int main(int argc, char *argv[]) { int out = open(argv[1], O_RDWR|O_CREAT|O_TRUNC, 0666); int i,k; int buf[M]; /* One Mbyte */ for(i=0;i=3) { fdatasync(out); posix_fadvise(out,0,0, POSIX_FADV_DONTNEED); } close(out); return 0; } Disk cache man free gcc Fadvise.c 10 CommandCachedTime free -m20705./a.out Foo2.9 free -m21750 cp Foo Foo12.3 free -m22802./a.out Bar x19.8 free -m22778 cp Bar Bar19.3 free -m24829

11 Summary Without I/O no communication with the outside world Caching crucial for performance Disks are slower than the CPU hence more scope for scheduling RAID for more dependable storage 11


Download ppt "OPERATING SYSTEMS 11 - DISK PIETER HARTEL 1. Hardware Intended for humans, local devices and communication (challenge?) Hardware support for interrupts."

Similar presentations


Ads by Google