YouTube2Text

[CS61C FA20] Lecture 31.3 - I/O: I/O Interrupts — Transcript

by CS 61C Departmental · 802 words · 149 segments · language en · Watch on YouTube

Full transcript

  1. 0:00[Music]
  2. 0:10hello
  3. 0:10and welcome back to our discussion about
  4. 0:13input output devices
  5. 0:14we have introduced polling as one way to
  6. 0:18work with input devices but it is
  7. 0:20generally
  8. 0:21inefficient especially with those that
  9. 0:24have a lot of data to
  10. 0:26transmit or receive it is
  11. 0:29a valid technique and i certainly have
  12. 0:32used it
  13. 0:33in the past myself um particularly when
  14. 0:36doing some prototyping when for example
  15. 0:39have a raspberry pi i would like to
  16. 0:41figure out if
  17. 0:42some new i o device is working properly
  18. 0:46the easiest thing that we can do is to
  19. 0:49set up a
  20. 0:50very short polling loop and see
  21. 0:53what does the device do more commonly
  22. 0:56the way how we are going to work with
  23. 0:58io devices is through unknown mechanism
  24. 1:01of interrupts
  25. 1:02so we have already highlighted that
  26. 1:05polling waste processor resources why
  27. 1:08well simply because whether the
  28. 1:10input output device has something to
  29. 1:12tell us um
  30. 1:14or not we anyways go to it and check how
  31. 1:18is it doing if it has no data for us we
  32. 1:21still spend processor cycles to go pull
  33. 1:24it
  34. 1:26and there is an analogy in real life you
  35. 1:28know when we throw a party
  36. 1:29um this wood polling would be equivalent
  37. 1:32to
  38. 1:33setting a timer and going to the front
  39. 1:35door every minute to check if somebody
  40. 1:37has arrived we don't do that because
  41. 1:40people long time ago have
  42. 1:41invented a doorbell to exactly prevent
  43. 1:44us from doing that so when the guests
  44. 1:47arrive
  45. 1:48they ring the doorbell to announce
  46. 1:50themselves
  47. 1:51similarly an io device rings their
  48. 1:54doorbell
  49. 1:55when they have something to tell us
  50. 1:57their doorbell
  51. 1:58is the interrupt so they will raise an
  52. 2:02interrupt or throw an interrupt
  53. 2:04whenever they have some data to deliver
  54. 2:06us or perhaps if
  55. 2:08there is some some event that they would
  56. 2:10like to tell us about
  57. 2:15so the interrupt will
  58. 2:18interrupt the current program and then
  59. 2:21we will transfer
  60. 2:22the control to the trap handler in the
  61. 2:25operating system
  62. 2:26that will handle that interrupt
  63. 2:30um why interrupt surprising polling
  64. 2:33because when nothing is happening
  65. 2:36no news from the i o device there is
  66. 2:38nothing to do
  67. 2:39our regular program continues
  68. 2:44if there are if the device is not
  69. 2:46producing a lot of data
  70. 2:48and doesn't have a lot of activity it's
  71. 2:50great because we just periodically
  72. 2:52will receive these interrupts and handle
  73. 2:55them
  74. 2:56accordingly but if the device has
  75. 2:59a lot of io interrupts are expensive
  76. 3:03because
  77. 3:04they interrupt the current programs
  78. 3:06trash the caches uh
  79. 3:08trash the tlbs and we have to go save
  80. 3:11the straight
  81. 3:12save the state restore the state and
  82. 3:14then you know warm up caches
  83. 3:16and so on so they're not the best thing
  84. 3:19to do generally
  85. 3:22they are fine for low rate devices and
  86. 3:26they're preferred to polling
  87. 3:27so my keyboard and so on will use
  88. 3:30interrupts
  89. 3:36the in devices that produce a lot of
  90. 3:40data
  91. 3:41a more common way is that they will
  92. 3:44initiate the data transfer with an
  93. 3:46interrupt when they have something to
  94. 3:48send us
  95. 3:48receive the packet over wi-fi
  96. 3:51but the transfers are generally if there
  97. 3:55is a lot of data to be transferred
  98. 3:56it is done by using a different
  99. 3:59mechanism
  100. 4:01so-called direct memory access or dma
  101. 4:04which we'll cover
  102. 4:05in the next section before we get to the
  103. 4:07next section
  104. 4:08there is an older way of essentially
  105. 4:11orchestrated polling which is it which
  106. 4:14was known as programmed io
  107. 4:17or po this
  108. 4:20was introduced with older ata
  109. 4:23style hard drives probably you do not
  110. 4:26have an
  111. 4:26ata star uh kind of a hard drive
  112. 4:30where essentially it was the role of a
  113. 4:33processor
  114. 4:35that to to initiate
  115. 4:38all the data movement to and from the
  116. 4:41hard drive
  117. 4:42it was done in a more efficient way than
  118. 4:44just using loads and stores
  119. 4:46but loads and stores initiated that
  120. 4:50so this cpu was typically spending some
  121. 4:53number of its cycles to get the data
  122. 4:57to and from the disk
  123. 5:00and into the main memory but
  124. 5:03that was the same cpu that was
  125. 5:06being used to do the main computation so
  126. 5:10handling the disk was an overhead
  127. 5:12typically what would go
  128. 5:14to programmed io were about five percent
  129. 5:18of processor cycles
  130. 5:23so these kind of things happen still
  131. 5:26there are still instructions in big
  132. 5:29processors that
  133. 5:30are being dealt that are being used to
  134. 5:32copy
  135. 5:33a piece of data from one location to
  136. 5:36another
  137. 5:37for example if you look at google's uh
  138. 5:40workload they report that about five
  139. 5:42percent of cpu cycles
  140. 5:44go to instructions like mem
  141. 5:47copy which copies from one memory
  142. 5:49location
  143. 5:50to another
  144. 5:54we're going to see some other
  145. 5:57methods like the dma access
  146. 6:01just after the break and we'll use them
  147. 6:03whenever we can
  148. 6:04when we have a lot of data to move
  149. 6:06around see you after a quick break

About this transcript

This page contains the full transcript of [CS61C FA20] Lecture 31.3 - I/O: I/O Interrupts by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 802 words across 149 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.