Input/Output Hardware in Computer Systems

ch ng 4 n.w
1 / 26
Embed
Share

Explore the world of Input/Output (I/O) hardware in computer systems, including controllers, interfaces, memory-mapped I/O, polling, interrupts, and more. Discover the various devices such as keyboards, displays, disks, printers, scanners, and their integration with the CPU. Learn about character and block devices, I/O operations, data transfer methods, and the role of terminal devices.

  • I/O hardware
  • Computer systems
  • Input/Output
  • CPU
  • Peripheral devices

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Chng 4 Qu n l I/O 1

  2. Ni dung C nb nv thi tb I/O C c d chv I/O c ah i u h nh 2

  3. I/O Hardware 3

  4. I/O Hardware Controller c m t hay nhi u register ch a data v c c control signal CPU giao ti pv i controller b ng c ch c v ghi t ng bit trong c c register The I/O instruction memory-mapped I/O (the device-control registers are mapped into the address space of the processor) 4

  5. I/O Hardware Giao ti pgi a hardware v CPU : Polling th m d : CPU nhk sau m tth i gian s c bit tr ng th i bi tthi tb ho n t t thao tac nh p/xu tch a . Interrupt ng t: thi tb s th ng b o cho CPU khi n ho n t t thao t c nh p/xu t. DMA truy su tb nh tr cti p 5

  6. 6

  7. I/O hardware C c thi tb th ng d ng : keyboards, displays, disks, mice, printers, scanners, C c thi t bi tr n system board : timers, graphics chips, audio chips. C 2 d ngthi tb IO block devices character devices 7

  8. I/O hardware c c thi tb d ng k t (character devices) chuy n t ng byte m t, ng cl ithi tb kh i (block devices) chuy n nv l kh i byte. Kh i byte (block ) c k ch th cc nh . K ch th c 1 block c th t 512 byte n 32768 byte . C c block c nhs => do v y c th truy su t l pl im tkh i data b ngvi cch nh truy su t block N at v tape : l c c thi tb block . at truy su tng u nhi n, tape truy su ttu nt . 8

  9. I/O hardware Character devices C c thi tb d ng n y cung c p truy su t unstructured . Kh ng ach Bao g m : Traditional character-stream devices, such as a terminal multiplexer, modem, printer, scanner, or mouse. 9

  10. I/O hardware V i c c terminal devices : x l input v o c c thi tb n y b ng 1 trong 2 mode Line mode (cooked) : c c k t c a v o h th ng nh th ch ng cchuy nt m t buffer cho n khi nh nm t k t return . Khi m t line s n s ng cho qu tr nh x l Raw mode : c c k t ngay khi nh p v o l s n s ng cho qu tr nh x l . Vd nh mouse. V im t terminal , mode n y cs d ng khi m t tr nh so nth o vb mu nx l c c keystroke ngay khi n cnh n . 10

  11. I/O hardware 11

  12. I/O hardware Blocking IO : ngh a l ti n tr nh ng i d ng s b block ( wait ) cho n khi thao t c IO ho n t t. N ub n ang c 1500 byte t m tthi tb , thao t c cs b kh a cho n khi data s n s ng. Non-blocking IO : ngh a l m tl ig ih th ng IO s ko tti n tr nh v o tr ng th i sleep khi ch IO. Ti n tr nh s nh n c th ng b o r ng IO ch as n s ng. N ub n ang c 1500 byte t m t thi tb , v khi ch 12 byte c xong, thao t c cc a tt s c c 12 byte. H th ngs tr v data khi n s n s ng , nh ngs ko ch cho new data. OS c th tr v l i no data . V d , c c h th ngPOSIX ( Linux , OS X, ) tr v l i EAGAIN khi c file m c non-blocking IO v ko c data s n c c. . 12

  13. Cc thitb - device B i ukhi nthi tb - device controller Tr nh i ukhi nthi tb - device driver 13

  14. Cc thitbcn c phnmmiukhin - g i l device driver Tr nh kthi tb cho ph p ch ng ta c m t interface ngnh tv i kernel , che d u inh ng chi ti t ri ng bi tc athi tb Vd : kernel th chi n ghi data v o a => ko quan t m n chi ti tc alo i a ( at hay flash memory ) Device drivers implement mechanism (c ch t ng t c v ithi tb ), not policy (ksoat ai truy su tthi tb ) . 14

  15. Trong nhiu OS, nh Linux , Unix, BSD, OS X , Windows NT , c c thi tb c giao ti p qua interface d ng file. 15

  16. Trnh iukhinthitb giao tipvi device controller i ukhi nthi tb M t device controler l hardware ( v /ho c l firmware ) i ukhi nho t ngc athi tb . device controler - N ki m so t vi c nh x v o v tr v t l v sinh ra ng t th ng b o cho cpu v c c s ki n, s d ng DMA chuy n c c block data gi a devive v system memory. 16

  17. 17

  18. Kernel IO Sybsystem Kernel cung c pnhi ud chv li n quan n IO : nhth ibi u, v ng m buffering , v ng l u tr cache , spooling , qu n l l i , B ov IO , 18

  19. Lplch IO C c ngd ng ph t ra c c y uc u (system call ) IO v ph ich nl t cth chi n IO tr tt t nhi n n y hi m khi l m tl a ch nt t cho hi un ng chung c a to n b h th ng=> b l pl chc ithi nhi un ngc a to n h th ng , gi m tg ch trung b nh th chi n IO b ng c ch a ra m ttr tt t i u . 19

  20. Lplch IO Vd : Suppose that a disk arm is near the beginning of a disk and that three applications issue blocking read calls to that disk. Application 1 requests a block near the end of the disk, application 2 requests one near the beginning, and application 3 requests one in the middle of the disk. The operating system can reduce the distance that the disk arm travels by serving the applications in the order 2, 3,1. Rearranging the order of service in this way is the essence of I/O scheduling. 20

  21. Lplch IO OS s d ng h ng il u c c request cho m ithi t b . Khi m t ngd ng ph t ra m t IO system call, y u c u n y c a v o h ng ic athi tb . B l p l chs s px pl itr tt c a h ng i t nghi u qu c ah th ng v th i gian ch tb c a ngd ng. 21

  22. Buffering , caching , v spooling Buffer l m t v ng nh l u data trong qu tr nh data c di chuy ngi a 2 thi tb hay gi athi tb v ng d ng. 3 L do : L do 1 : T c kh ng ph h pgi as nxu t v ti u th d ng data. Vd : d li u cchuy nt modem v o a. T c l ch nhau h ng ng n l n. M t buffer ct o trong b nh , l u c c byte nh nt modem. Khi buffer ch a to n b data cchuy n n, b ngm t thao t c to n b data trong buffer c ghi v o a. . 22

  23. Buffering , caching , v spooling L do 2 : s ch nh l chgi a c c thi tb c k ch th c data- transfer kh c nhau. VD : Such disparities are especially common in computer networking, where buffers are used widely for fragmentation and reassembly of messages. At the sending side, a large message is fragmented into small network packets. The packets are sent over the network, and the receiving side places them in a reassembly buffer to form an image of the source data. L do 3: s d ng buffering h tr copy semantics cho ng d ng IO . 23

  24. Buffering , caching , v spooling Caching : l m tb nh c t c truy su t cao , l ugi c c b n sao data. Truy su tb n sao c cached th hi uqu h n l truy su t data g c. Vd, c c l nhc a tt angth c thi cl u tr n a, c cache trong b nh , v copy l nn a v o c c b nh cache primary v secondary c a CPU. Cache v buffer kh c nhau v m c chs d ng . 24

  25. Buffering , caching , v spooling Spooling Spool l m t buffer l uk txu tc a 1 device, nh m y in, v mb o c c d ng data kh ng an xen nhau . Vd ,T im tth i i m 1 m y in ch ph cv 1 t c v , nh ngnhi u ngd ng mong mu n in song song v mb ok txu tc a ch ng ko b tr nl n v o nhau . OS gi iquy tv n n y b ng c ch ch nk txu t ra m y in. M ik txu tc a 1 ngd ng y v o 1 file ri ng. Khi m t ngd ngk t th c in, h ng i spooling c ah th ngs y file ch in ra m y in, m il n 1 file . 25

  26. IO protection ng nng a user th chi nnh ng thao t c IO ko h pl , OS thi tl p c c l nh IO l nh ngl nh cquy n ( privileged instructions ) . => User ko tr cti p a ra l nh IO, ch ng ph ith c hi n th ng qua OS. Vd : m t user program th c thi m t system call y u c u OS th chi n IO thay cho n . OS ki m tra xem y u c u c h pl ko, v n uh pl OS th c hi n y u c u IO . K tqu tr v cho user 26

Related


More Related Content