1 / 11

Operating Systems 11 - disk

Operating Systems 11 - disk. PIETER HARTEL. Hardware. Intended for humans, local devices and communication (challenge?) Hardware support for interrupts and DMA. Direct Memory Access (DMA). CPU sends commands to controller indicating: w hat to do and w here in memory to get/put the data

tracey
Download Presentation

Operating Systems 11 - disk

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Operating Systems 11 - disk PIETER HARTEL

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

  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

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

  5. #define M 1024*1024 /* One MByte */ int main(intargc, 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 • gccSparse.c • for d • in . /tmp • do • for n • in 1 2 4 8 16 32 64 128 256 512 1024 • do • time ./a.out $d/$n.dat $n • time cp $d/$n.dat $d/junk • done • done • ls –l /tmp/*dat /tmp.junk 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? ??? 4ms 4ms 10ms/MB

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

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

  9. Linux design – uniform! • Block devicesfor 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

  10. #define M 1024*256 #define N 1000 /* number of buffers written */ intmain(intargc, char *argv[]) { int out = open(argv[1], O_RDWR|O_CREAT|O_TRUNC, 0666); inti,k; intbuf[M]; /* One Mbyte */ for(i=0;i<N;i++) { for(k=0;k<M;k++) { buf[k] = i*N+k; } write(out,buf,sizeof(buf)); } if(argc>=3) { fdatasync(out); posix_fadvise(out,0,0, POSIX_FADV_DONTNEED); } close(out); return 0; } Disk cache • man free • gccFadvise.c

  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

More Related