Lecture 2: CSCI E-1 Spring 2013

Lecture 2: CSCI E-1 Spring 2013

Caching. CPUs. Hard disk drives. Parallelism. Pipelining. RAM. Registers. Solid-state drives

9e4d3e53f8525fdff00691a8b843e66b?s=128

Tommy MacWilliam

February 05, 2013
Tweet

Transcript

  1. Computer Science E-1 Lecture 2: Hardware

  2. From last time...

  3. Pre-requisites

  4. Pre-requisites

  5. Math

  6. Math

  7. None
  8. CPU RAM Hard Drive

  9. CPU

  10. None
  11. None
  12. None
  13. None
  14. Instruction Set

  15. Instruction Set • data: read/write data from RAM

  16. Instruction Set • data: read/write data from RAM • arithmetic:

    add two numbers
  17. Instruction Set • data: read/write data from RAM • arithmetic:

    add two numbers • control flow: where do we go next?
  18. Pipeline

  19. None
  20. Pipeline • fetch: get the next instruction

  21. Pipeline • fetch: get the next instruction • decode: determine

    which instruction was fetched
  22. Pipeline • fetch: get the next instruction • decode: determine

    which instruction was fetched • execute: run the instruction
  23. Pipeline • fetch: get the next instruction • decode: determine

    which instruction was fetched • execute: run the instruction • writeback: store the result (if necessary)
  24. Fetch 0000001001010011

  25. Decode 0000001001010011 Add 5 3

  26. Decode Add 5 + 3

  27. Execute 5 + 3 = 8

  28. Writeback

  29. None
  30. Parallelism

  31. None
  32. None
  33. Superscalar

  34. Multi-core

  35. Counting Candy

  36. 1. Start with a total of 0 2. For each

    piece in the pile, add 1 to total 3. Remember that piece was counted
  37. 1. Find 4 friends 2. Divide candy among friends 3.

    Friends count at same time
  38. Four times as fast!

  39. Four times as fast!

  40. 1. Find 4 friends 2. Divide candy among friends 3.

    Friends count at same time 4. Add up friends’ totals
  41. More friends!

  42. Not faster :(

  43. 1. Pair up, add totals together 2. One friend goes

    home, other remembers total 3. Repeat until counted
  44. Much faster!

  45. CPU Performance

  46. None
  47. “Megahertz Myth”

  48. http://www.youtube.com/watch? v=PKF9GOE2q38

  49. CPU RAM Hard Drive

  50. Memory

  51. Byte B 8 bits Kilobyte KB 1000 bytes Megabyte MB

    1000000 bytes (1000 KB) Gigabyte GB 1000000000 bytes (1000 MB) Terabyte TB 1000000000000 bytes (1000 GB)
  52. Byte B Kilobyte KB Megabyte MB Gigabyte GB Terabyte TB

  53. Byte B Character of text Kilobyte KB Megabyte MB Gigabyte

    GB Terabyte TB
  54. Byte B Character of text Kilobyte KB Word document Megabyte

    MB Gigabyte GB Terabyte TB
  55. Byte B Character of text Kilobyte KB Word document Megabyte

    MB MP3 song Gigabyte GB Terabyte TB
  56. Byte B Character of text Kilobyte KB Word document Megabyte

    MB MP3 song Gigabyte GB Movie Terabyte TB
  57. Byte B Character of text Kilobyte KB Word document Megabyte

    MB MP3 song Gigabyte GB Movie Terabyte TB 250,000 songs
  58. Registers

  59. RAM

  60. None
  61. None
  62. None
  63. None
  64. 00000000000000000000010100111001 101 102 103 104

  65. Big-Endian

  66. 00111001000001010000000000000000 104 103 102 101

  67. Little-Endian

  68. Cache

  69. None
  70. CPU RAM Hard Drive

  71. Hard Disk Drive

  72. None
  73. None
  74. None
  75. http://www.youtube.com/watch? v=kdmLvl1n82U

  76. Filesystems

  77. HDD Performance • seek time: position platters and read-write head

    • data rate: transfer data to motherboard
  78. None
  79. Solid State Drive

  80. None
  81. http://www.youtube.com/watch? v=j84eEjP-RL4

  82. Flash Memory

  83. Virtual Memory

  84. None
  85. None
  86. Capacity

  87. L1 cache 64 kilobytes L2 cache 8 megabytes 1 MB

    from RAM 4 gigabytes 1 MB from SSD 256 gigabytes 1 MB from HDD 1 terabyte
  88. Performance

  89. L1 cache 0.5 nanoseconds L2 cache 7 nanoseconds 1 MB

    from RAM 0.25 milliseconds 1 MB from SSD 1 millisecond 1 MB from HDD 20 milliseconds
  90. L1 cache 0.5 nanoseconds blink of an eye L2 cache

    7 nanoseconds 1 MB from RAM 0.25 milliseconds 1 MB from SSD 1 millisecond 1 MB from HDD 20 milliseconds
  91. L1 cache 0.5 nanoseconds blink of an eye L2 cache

    7 nanoseconds 4 seconds 1 MB from RAM 0.25 milliseconds 1 MB from SSD 1 millisecond 1 MB from HDD 20 milliseconds
  92. L1 cache 0.5 nanoseconds blink of an eye L2 cache

    7 nanoseconds 4 seconds 1 MB from RAM 0.25 milliseconds 2 days 1 MB from SSD 1 millisecond 1 MB from HDD 20 milliseconds
  93. L1 cache 0.5 nanoseconds blink of an eye L2 cache

    7 nanoseconds 4 seconds 1 MB from RAM 0.25 milliseconds 2 days 1 MB from SSD 1 millisecond 1 week 1 MB from HDD 20 milliseconds
  94. L1 cache 0.5 nanoseconds blink of an eye L2 cache

    7 nanoseconds 4 seconds 1 MB from RAM 0.25 milliseconds 2 days 1 MB from SSD 1 millisecond 1 week 1 MB from HDD 20 milliseconds 4.5 months
  95. Shopping!

  96. Factors to Consider • display • weight • resolution •

    CPU cores • CPU cache size • RAM size • storage capacity • HDD / SSD • peripherals • keyboard
  97. Summary

  98. CPU • instruction set • pipeline • parallelism • superscalar

    • multi-core • clock speed • Moore’s Law • Megahertz Myth
  99. Memory • byte, kilobyte, megabyte • registers • RAM •

    addressing • big-endian, little-endian • caching • L1 cache, L2 cache, L3 cache • hard disk drive • platters, tracks, sectors • read-write heads • file allocation table • seek time, data rate • solid state drive • flash memory
  100. Computer Science E-1 Lecture 2: Hardware