Slide 1

Slide 1 text

Computer Science E-1 Lecture 2: Hardware

Slide 2

Slide 2 text

From last time...

Slide 3

Slide 3 text

Pre-requisites

Slide 4

Slide 4 text

Pre-requisites

Slide 5

Slide 5 text

Math

Slide 6

Slide 6 text

Math

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

CPU RAM Hard Drive

Slide 9

Slide 9 text

CPU

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Instruction Set

Slide 15

Slide 15 text

Instruction Set • data: read/write data from RAM

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

Instruction Set • data: read/write data from RAM • arithmetic: add two numbers • control flow: where do we go next?

Slide 18

Slide 18 text

Pipeline

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Pipeline • fetch: get the next instruction

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

Pipeline • fetch: get the next instruction • decode: determine which instruction was fetched • execute: run the instruction • writeback: store the result (if necessary)

Slide 24

Slide 24 text

Fetch 0000001001010011

Slide 25

Slide 25 text

Decode 0000001001010011 Add 5 3

Slide 26

Slide 26 text

Decode Add 5 + 3

Slide 27

Slide 27 text

Execute 5 + 3 = 8

Slide 28

Slide 28 text

Writeback

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

Parallelism

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Superscalar

Slide 34

Slide 34 text

Multi-core

Slide 35

Slide 35 text

Counting Candy

Slide 36

Slide 36 text

1. Start with a total of 0 2. For each piece in the pile, add 1 to total 3. Remember that piece was counted

Slide 37

Slide 37 text

1. Find 4 friends 2. Divide candy among friends 3. Friends count at same time

Slide 38

Slide 38 text

Four times as fast!

Slide 39

Slide 39 text

Four times as fast!

Slide 40

Slide 40 text

1. Find 4 friends 2. Divide candy among friends 3. Friends count at same time 4. Add up friends’ totals

Slide 41

Slide 41 text

More friends!

Slide 42

Slide 42 text

Not faster :(

Slide 43

Slide 43 text

1. Pair up, add totals together 2. One friend goes home, other remembers total 3. Repeat until counted

Slide 44

Slide 44 text

Much faster!

Slide 45

Slide 45 text

CPU Performance

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

“Megahertz Myth”

Slide 48

Slide 48 text

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

Slide 49

Slide 49 text

CPU RAM Hard Drive

Slide 50

Slide 50 text

Memory

Slide 51

Slide 51 text

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)

Slide 52

Slide 52 text

Byte B Kilobyte KB Megabyte MB Gigabyte GB Terabyte TB

Slide 53

Slide 53 text

Byte B Character of text Kilobyte KB Megabyte MB Gigabyte GB Terabyte TB

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

Byte B Character of text Kilobyte KB Word document Megabyte MB MP3 song Gigabyte GB Movie Terabyte TB 250,000 songs

Slide 58

Slide 58 text

Registers

Slide 59

Slide 59 text

RAM

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

00000000000000000000010100111001 101 102 103 104

Slide 65

Slide 65 text

Big-Endian

Slide 66

Slide 66 text

00111001000001010000000000000000 104 103 102 101

Slide 67

Slide 67 text

Little-Endian

Slide 68

Slide 68 text

Cache

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

CPU RAM Hard Drive

Slide 71

Slide 71 text

Hard Disk Drive

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

http://www.youtube.com/watch? v=kdmLvl1n82U

Slide 76

Slide 76 text

Filesystems

Slide 77

Slide 77 text

HDD Performance • seek time: position platters and read-write head • data rate: transfer data to motherboard

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Solid State Drive

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

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

Slide 82

Slide 82 text

Flash Memory

Slide 83

Slide 83 text

Virtual Memory

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

Capacity

Slide 87

Slide 87 text

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

Slide 88

Slide 88 text

Performance

Slide 89

Slide 89 text

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

Slide 90

Slide 90 text

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

Slide 91

Slide 91 text

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

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

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

Slide 94

Slide 94 text

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

Slide 95

Slide 95 text

Shopping!

Slide 96

Slide 96 text

Factors to Consider • display • weight • resolution • CPU cores • CPU cache size • RAM size • storage capacity • HDD / SSD • peripherals • keyboard

Slide 97

Slide 97 text

Summary

Slide 98

Slide 98 text

CPU • instruction set • pipeline • parallelism • superscalar • multi-core • clock speed • Moore’s Law • Megahertz Myth

Slide 99

Slide 99 text

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

Slide 100

Slide 100 text

Computer Science E-1 Lecture 2: Hardware