YouTube2Text

[CS61C FA20] Lecture 38.3 - Dependability- Parity, ECC, RAID: Error Detection — Transcript

by CS 61C Departmental · 2,147 words · 364 segments · language en · Watch on YouTube

Full transcript

  1. 0:04[Music]
  2. 0:09hello
  3. 0:10and welcome back to our module on
  4. 0:12dependability so we have defined
  5. 0:15metrics for measuring dependability and
  6. 0:18along the way also we define how we
  7. 0:20measure reliability and availability so
  8. 0:24before trying to add redundancy let's
  9. 0:27try to first
  10. 0:28figure out how we can detect
  11. 0:31whether we have an error or some kind of
  12. 0:34fault in a system
  13. 0:36that we need to react to
  14. 0:41so let's get into that
  15. 0:46errors in compute systems can happen
  16. 0:49anywhere i mean we can have an error in
  17. 0:51our alu we can have an error in our
  18. 0:53register file but most likely it's going
  19. 0:55to be somewhere in the memory system
  20. 0:57and it will be in dram in particular so
  21. 1:00what
  22. 1:00we plan to do now is to add a little bit
  23. 1:04of redundancy some redundant bits that
  24. 1:06are going to
  25. 1:06enable us to detect that an error
  26. 1:09happened
  27. 1:10in a particular
  28. 1:14word in the memory so we are going to do
  29. 1:17that
  30. 1:18by introducing so-called error detection
  31. 1:20and a little bit later correction codes
  32. 1:23so you know why do we see why is it most
  33. 1:26likely that we're going to see
  34. 1:28an error in memory well the reason is
  35. 1:31that we have so many memory cells out
  36. 1:33there
  37. 1:34and they're tiny so when we look at dram
  38. 1:37dram is essentially
  39. 1:39in in the essence every bit is a tiny
  40. 1:41little capacitor that stores a little
  41. 1:43bit of a charge
  42. 1:44and if that charge that is stored in the
  43. 1:47dram cell gets disturbed
  44. 1:49we may think that we have written a 0
  45. 1:52into a cell but we will
  46. 1:53read a1 why would that happen it can
  47. 1:56happen because of a disturbance is in a
  48. 1:58power supply
  49. 1:59or may happen because a particle
  50. 2:04in the form of a cosmic ray um
  51. 2:08cosmic particle struck that particular
  52. 2:11location
  53. 2:11and flipped a bit essentially charge
  54. 2:14that capacitor
  55. 2:15by enough that to change the value
  56. 2:18that corresponds to a zero to something
  57. 2:20that corresponds to a1
  58. 2:22that is a particular type of an error
  59. 2:24that is called the soft error
  60. 2:25there is really nothing wrong physically
  61. 2:27with a memory
  62. 2:28just error happened while the data was
  63. 2:32sitting in there so when we re-execute
  64. 2:35things
  65. 2:36they're going to be working just fine
  66. 2:39as opposed to those there are hard
  67. 2:41errors uh
  68. 2:43a bit cell or
  69. 2:47word in the memory or an
  70. 2:50entire chip can fail and those are
  71. 2:53so-called
  72. 2:54hard failures or hard errors
  73. 2:59and in there we need to use a different
  74. 3:01kind of redundancy to repair that
  75. 3:03we can repair memory chips inside that's
  76. 3:07outside the scope of this
  77. 3:09course but you know we can
  78. 3:12replace a faulty chip or a faulty
  79. 3:16disk drive in a compute system we'll
  80. 3:18talk a little bit more about that
  81. 3:20a bit later um the way how we
  82. 3:24guard against soft errors
  83. 3:28is by using so-called error detection
  84. 3:30and error correction
  85. 3:32codes or edc's and eccs for short
  86. 3:35we can't guard really by shielding our
  87. 3:38compute system somehow i mean
  88. 3:40some of these cosmic particles can
  89. 3:42travel through
  90. 3:43the earth so you know there is a pretty
  91. 3:46low chance that we can guard
  92. 3:47uh our systems by some other way
  93. 3:50so they're gonna hit us no matter what i
  94. 3:53mean they're hitting us
  95. 3:54they're hitting me as i'm speaking right
  96. 3:56now um
  97. 3:58and there there may be a chance that
  98. 4:00they're going to flip the bit
  99. 4:01so the idea here is to add a little bit
  100. 4:04of redundancy
  101. 4:06in our memory systems to tell us if a
  102. 4:09particle strike
  103. 4:10or supply disturbance has altered some
  104. 4:13bits
  105. 4:16so these extra bits as opposed to just
  106. 4:19replicating the entire words
  107. 4:21present a lot less overhead a lot less
  108. 4:23redundancy
  109. 4:24but protect you know give us a
  110. 4:28[Music]
  111. 4:29good enough protection so
  112. 4:33the way how it also works is that
  113. 4:37we stake our
  114. 4:42regular results of computation before
  115. 4:44storing them
  116. 4:45we manipulate them into some kind of
  117. 4:48a code space and that code space as the
  118. 4:50redundancy
  119. 4:52so if a fault charges uh changes this
  120. 4:56valid code into an invalid one we can
  121. 4:59detect that because
  122. 5:00that codeword does not exist in our code
  123. 5:04set
  124. 5:04i'm talking a lot about you know a lot
  125. 5:07about
  126. 5:08kind of hypothetical stuff let's get
  127. 5:10into more practical things but before we
  128. 5:12get into real practical examples
  129. 5:14let's first introduce something
  130. 5:16important that is often
  131. 5:17used for understanding these codes which
  132. 5:20is uh
  133. 5:21so-called the hamming distance it is
  134. 5:23named after richard hamming one of the
  135. 5:25computing pioneers who
  136. 5:26worked at bell labs for a long time and
  137. 5:28then later moved to academia
  138. 5:30he made some pioneering contributions
  139. 5:33for
  140. 5:34uh terror correction and detection and
  141. 5:36he did win a touring award
  142. 5:41hamming distance is essentially
  143. 5:44a difference in the number of bits
  144. 5:47between
  145. 5:48two binary numbers but when looked bit
  146. 5:51by bit you know here is an example
  147. 5:53let's call let's say that we have one
  148. 5:54word that is p the other word that is q
  149. 5:57and we would like to find out how
  150. 5:58different they are in terms of bits
  151. 6:01so the word p is 0 1 1
  152. 6:050 1 1 and q is 0 0 1 1 1
  153. 6:081. we compare them bit by bit
  154. 6:12and find out how many of them are
  155. 6:14different so
  156. 6:16in the most significant bit both of them
  157. 6:18have zeros the next significant bit
  158. 6:21are is different it is one versus a zero
  159. 6:24so we have
  160. 6:25a distance of one so far the next bit
  161. 6:28bits are once and we just
  162. 6:31um you know that's the same so we don't
  163. 6:34have to
  164. 6:34keep track of that the fourth more
  165. 6:37significant bit in the word p
  166. 6:39is a zero the word q is one so the
  167. 6:42hamming distance
  168. 6:43is two and the two least significant
  169. 6:47bits are both ones
  170. 6:48so we don't increase this hamming
  171. 6:50distance counter so the distance between
  172. 6:52words p and q is two
  173. 6:55let's do another example if p is the
  174. 6:58same as what we had before
  175. 7:00zero one one 1 1 and q is a bit
  176. 7:02different
  177. 7:031 1 0 0 0 1 what is the difference
  178. 7:06between p and q well
  179. 7:08let's just compare them at the most
  180. 7:09significant bit position we have a diff
  181. 7:11distance so 1 then same
  182. 7:15this different one versus zero in the
  183. 7:17third bit position
  184. 7:19this one is the same the fifth bit
  185. 7:22position is different so we got three
  186. 7:24and the final bit is the same so the
  187. 7:26distance between p and q
  188. 7:27is three
  189. 7:34so let's see how can we utilize this
  190. 7:39when we work with our binary numbers our
  191. 7:41results of computations are
  192. 7:43just binary words and the hamming
  193. 7:45distance between them
  194. 7:47is one right we use a binary
  195. 7:49representation that
  196. 7:50doesn't have much or any redundancy
  197. 7:53there and because we want to
  198. 7:56efficiently use our compute hardware
  199. 8:03what are we trying to do here is
  200. 8:06to not completely utilize
  201. 8:10all of our storage to
  202. 8:14store just different binary numbers we
  203. 8:16would like to store the code words
  204. 8:18these are sufficiently different from
  205. 8:20each other such that
  206. 8:22they have say a hamming distance of two
  207. 8:25so what happens
  208. 8:26if the words have a hamming distance of
  209. 8:29two
  210. 8:30and if there is a single bit error
  211. 8:33well we started with a legal code word
  212. 8:37that corresponds to our code space and
  213. 8:40the
  214. 8:40particle struck a bit and that bit
  215. 8:42flipped
  216. 8:45so the new word since it has a distance
  217. 8:47of one from the
  218. 8:49valid code word is an invalid code word
  219. 8:53and we can detect that we had an error
  220. 8:57so let's see a practical example how to
  221. 8:59do that this is a lot of
  222. 9:01complexity but the first practical
  223. 9:03example is something that is very
  224. 9:04commonly used and it's very simple
  225. 9:06it is adding the parity bit
  226. 9:10so in our computation we come up with a
  227. 9:12binary word
  228. 9:14and for that value of a binary word
  229. 9:18what we do before writing into the
  230. 9:20memory we add
  231. 9:22a parity bit so we add a little tag in
  232. 9:25the form of an extra bit
  233. 9:27that forces the word to be stored in the
  234. 9:30memory
  235. 9:31to have even parity
  236. 9:36um so if we are working for example with
  237. 9:398-bit words
  238. 9:40in this example and exact same thing
  239. 9:42applies for 32-bit words
  240. 9:44how would we find out how many
  241. 9:48ones that we have in this world well
  242. 9:50we'll just pass it through
  243. 9:51and ain't input xor gate and that xor
  244. 9:54gate is going to produce our
  245. 9:56parity bit what we do then we
  246. 10:00take all these nine bits eight bits that
  247. 10:02is
  248. 10:03our data value and the parity bit and
  249. 10:06store them all
  250. 10:07together in the memory we need to have
  251. 10:10a little wider memory for that and
  252. 10:13that's the reason
  253. 10:14why in some of these drum dimms we have
  254. 10:17nine chips one of those stores the
  255. 10:20parity
  256. 10:22okay now when we read that back we would
  257. 10:25like to check
  258. 10:26if our data is correct
  259. 10:29so we will read all nine bits
  260. 10:33and try to find out if the parity is
  261. 10:36even
  262. 10:36uh how we're going to do that well we'll
  263. 10:38pass it again
  264. 10:40through an xor gate this time and
  265. 10:42exergate with eight inputs
  266. 10:44and we're going to get the check bit at
  267. 10:46the output the check bit
  268. 10:48if the value is 0
  269. 10:51then there is an even number of ones
  270. 10:54at its input so the word is valid
  271. 10:58if it is a 1 we have an error so what do
  272. 11:01we do with that
  273. 11:02error well that's a
  274. 11:05perfect reason to draw an exception and
  275. 11:08have operating system handle it
  276. 11:12okay one thing that you can convince
  277. 11:15yourself and
  278. 11:16we're going to walk through that a
  279. 11:17little bit later is
  280. 11:19since we are storing essentially
  281. 11:26redundant numbers here we can convince
  282. 11:28ourselves that the minimum hamming
  283. 11:29distance
  284. 11:30of a parity code is two we have to have
  285. 11:33two bits in error in order to flip from
  286. 11:35one valid code word
  287. 11:36to another valid code word so
  288. 11:39we detect that this codeword is not
  289. 11:42valid
  290. 11:42by um checking the parity bit
  291. 11:46now we have limited
  292. 11:49ability for checking errors right we
  293. 11:52will be able only to
  294. 11:53check if we have one bit in error
  295. 11:57or actually three bits or five bits in
  296. 12:01error
  297. 12:02if an odd number of bits is in error if
  298. 12:04we have
  299. 12:05if we flip two bits simultaneously we
  300. 12:07will not detect that
  301. 12:08so but in general just a single parity
  302. 12:11bit
  303. 12:12is good enough because you know memory
  304. 12:15systems are generally
  305. 12:16are designed in a way that when hit by a
  306. 12:19particle
  307. 12:20generally just one bit will flip
  308. 12:26here is a simple example of how we add
  309. 12:29parity bits
  310. 12:30so we start with the data word 0 1 0 1
  311. 12:340 1 0 1 8 bit data world
  312. 12:38so we inspect that word by using xor
  313. 12:41gate and we find out that we already
  314. 12:43have even parity so our
  315. 12:45added parity bit should be a0 so we are
  316. 12:48adding a 0 and taking
  317. 12:50this 9 bit word to store into the memory
  318. 12:54so our parity here is going to be even
  319. 12:56if you have a different
  320. 12:58data work here 0 1 0 1 0 1 1
  321. 13:011 that one has 5
  322. 13:04once so in order to keep the parity
  323. 13:08even we are going to add a 1 as a parity
  324. 13:12bit
  325. 13:13so the word 9-bit word that is written
  326. 13:15in memory is going to have an
  327. 13:17even number of months now when we read
  328. 13:20this
  329. 13:20let's take a look at this first word
  330. 13:22that we have stored in memory we now
  331. 13:24read it out from the memory
  332. 13:25if we read it the way it is
  333. 13:29with an even number of ones then the
  334. 13:32parity is even
  335. 13:34so there is no error on the other hand
  336. 13:36if there is a bit flip in this case
  337. 13:38there is a
  338. 13:39bit flip in the most significant memory
  339. 13:42bit location we count the number of ones
  340. 13:44one two three four
  341. 13:45five therefore we have an odd parity
  342. 13:49output of that xor is a one there are
  343. 13:52four there is an error
  344. 13:53what do we do at that point we draw an
  345. 14:00exception
  346. 14:02and another quick question that you may
  347. 14:05ask yourself
  348. 14:06so what happens if there is an error in
  349. 14:07the periodic if all these eight bits
  350. 14:09from our original word
  351. 14:11are correct just the last bit
  352. 14:15is our parity bit got flipped from zero
  353. 14:17to one well we're still going to detect
  354. 14:19an error we don't know where that
  355. 14:20error is um so in once in some sense the
  356. 14:23parity bit is protected but on the other
  357. 14:25hand
  358. 14:26um you know there would have been no
  359. 14:28error if we didn't have a period of it
  360. 14:29so
  361. 14:31we just look at that we're going to talk
  362. 14:33about
  363. 14:34error correction after a quick break see
  364. 14:37you then

About this transcript

This page contains the full transcript of [CS61C FA20] Lecture 38.3 - Dependability- Parity, ECC, RAID: Error Detection by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 2,147 words across 364 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.