×‍×¢×¨×›×•× ×”×¤×¢×œ×” ×¢×¨× ×רו×‍ר ××‍××ר ×' ×שע"ב

  • View
    41

  • Download
    0

Embed Size (px)

DESCRIPTION

מערכות הפעלה ערן טרומר סמסטר א' תשע"ב. הרצאה 3 קלט/פלט (המשך). מנהלי התקן (device drivers). מנהל התקן הוא מודול תוכנה עם ממשק סטנדרטי ששולט על התקן חומרה מסוים, כמו בקר דיסקים מסוג מסוים או בקר רשת מסוג מסוים השגרה שמופעלת על ידי קריאת מערכת קוראת למנהל ההתקן המתאים - PowerPoint PPT Presentation

Text of ×‍ערכו×...

  • ' " 3 / ()

  • (device drivers) , : ; ,

  • ( ) (interrupt handler / interrupt service routine) (initialize) (open) , (close) (read, write) / (seek) (random access) (ioctl): serial port

    .

  • : ( ) read : " N M A"... ( ) ... A

  • (caching): () (read-ahead) (buffering): ; ( )

  • () (, , , ) , ( ) , (, )/ : (block) (character),

  • : (/ ) , / sturcture representing a driverblock devices

  • / :# ls l /dev/lp0crw-rw---- 1 root daemon 6,0 may 5, 1988 /dev/lp0# cat < /dev/lp0skfjkl... , :# cat < /dev/lp0cat: -: Input/output error

    , :# cat < /dev/lp0bash: /dev/lp0: No such device

  • ... fd = open("/dev/lp0",...); // returns 4 read(fd, ...);file descriptor 4 for process 1234 special file (6,0)read system call:call character_devices[6].read(0,...)device driver for lp:int read(...) { retrieve bytes from buffer }void isr(void) { read bytes from controller to buffer }user modekernel mode

  • # ls -ld /dev/*brw-rw---- 1 root root 11, 0 Nov 7 18:47 /dev/cdromcrw-r----- 1 root kmem 10, 144 Nov 7 18:47 /dev/nvrambrw-rw---- 1 root disk 8, 0 Nov 7 18:47 /dev/sdacrw--w---- 1 root tty 4, 0 Nov 7 18:47 /dev/tty0crw--w---- 1 root tty 4, 1 Nov 7 18:47 /dev/tty1crw-rw---- 1 root root 188, 0 Nov 7 18:47 /dev/ttyUSB0crw-rw---- 1 root audio 14, 4 Nov 9 18:47 /dev/audiobrw-rw---- 1 root disk 253, 0 Nov 9 18:47 /dev/dm-0crw-rw-rw- 1 root root 1, 5 Nov 7 18:47 /dev/zerocrw-rw-rw- 1 root root 1, 8 Nov 7 18:47 /dev/random(partial list)

  • ( USB) ,

  • -/dev, , ( ): : (udev) : " X Y Z F "

  • ? CD ISO:cat /dev/cdrom > image.iso :cat /dev/sdb | gzip c | ssh user@server cat > backup :cat /dev/random > /dev/audio" " cat /dev/audio > program .

  • (hard disks) 3600-15000 2 TB, MB/s 100 2011; Read/write headplatearmSector (512 bytes)cylinder

  • ( ) ? (FCFS): ; () (SSTF): ; : , ;

  • scan: c-scan: ", , ; ( )look: scan . c-look: . ? ,

  • flash (Solid State Disks)controllerRAM (volatile, fast)NAND flash chipNAND flash chipNAND flash chipNAND flash chipto the host

  • NAND Flash , -128 64 , (metadata)11111111 1111111111 1111100111 1001010101 0110110111 1011111111 1111100111 1001010101 0110110111 011100111 0011100111 1001010101 0111111111 1111111111 1111100111 1001010101 01program page 0program page 1erase block 0

  • SSDs , () /; -100 ( ) i j -RAM -flash , ,

  • SSDSSD 32GB 32K 1MB, 128 8K, 1MB RAM ? 1MB -flash -SSD -RAM () : -flash -SSD; log-structured file systems

  • 0.1% 24 ( ) 3 ( ) -10 ( ), ______

  • 0.1% 24 ( ) 3 ( ) -10 ( ), 100 ; 100 1000 ...

  • : 0+0=0, 0+1=1, 1+0=1, 1+1=0 (xor) 4 x1, x2, x3, x4 x5 x1 + x2 + x3 + x4 + x5 = 0 1 + 1 + 1 + 0 + _ = 0 x51 + 1 + 0 + 1 + 1 = 0 1 + ? + 1 + 1 + 1 = 0 ( ) ? ? ( RAID, )

  • (Logical Volumes) (extents) ( ) : ( , , )

  • (RAID)Redundant Array of Inexpensive Disks ( ) +, ;

  • RAID 0 / , ;

  • RAID 1 (mirroring) ( ) , (hot-swap)

  • RAID 3 ,

  • RAID n-1 ; , ,

    * 100 , 3 * 100 , 3 *The failure mode of disks is fail stop because they either (1) break down and dont respond at all, or (2) they read a sector with errors but detect they errors using an error-detection (and perhaps also correction, but definitely also detection when there are too many errors to correct), so they normally dont return incorrect data. But they might with some low probability.We can detect and correct an error, or deal with more than one broken bit using more constraints and more redundant bits; beyond the scope but doable

    *