1 00:00:04,284 --> 00:00:08,893 If a computer is like a piano, then the term software refers to the code - what runs on it, like the music. 2 00:00:08,893 --> 00:00:13,026 And the hardware is the physical parts of the thing. 3 00:00:13,026 --> 00:00:15,167 So in this section, I'm going to talk about hardware, physical parts of the computer. 4 00:00:15,167 --> 00:00:22,200 So probably one of the most important inventions of the twentieth century is the transistor. 5 00:00:22,200 --> 00:00:27,467 And this is a little electronic component that can be used to build all sorts of different things. 6 00:00:27,467 --> 00:00:32,367 The most common form of transistor today is built on what's called a chip. 7 00:00:32,367 --> 00:00:36,967 And here's a picture of a chip, that I'm linking to from Wikimedia. 8 00:00:40,147 --> 00:00:44,234 And so a chip is made of a little fingernail-sized piece of silicon. 9 00:00:44,234 --> 00:00:46,667 And then different electronic components can be etched onto the silicon 10 00:00:46,667 --> 00:00:50,267 and this allows you to essentially make the components very, very cheaply. 11 00:00:50,267 --> 00:00:58,816 So the most likely, the most common component put on here is transistors. And you can make all sorts of stuff out of transistors. 12 00:00:58,816 --> 00:01:04,100 So the things I'm gonna talk about later, CPUs and memory and whatnot, those all come down to chips that look like this. 13 00:01:04,100 --> 00:01:08,615 Now a chip like this is said to be solid state 14 00:01:08,615 --> 00:01:10,667 meaning there's no moving parts, there's no gears, there's no wheels. 15 00:01:10,667 --> 00:01:13,538 And in a way, that makes it very reliable. 16 00:01:13,538 --> 00:01:14,931 And as I said before, they can be made pretty cheaply. 17 00:01:14,931 --> 00:01:18,100 And so this is one of the driving forces in the, computer revolution. 18 00:01:18,100 --> 00:01:22,033 I should point out, this is the element silicon, which is like glass. 19 00:01:22,033 --> 00:01:28,300 Not to be confused with silicone, which is like that kinda soft, rubbery stuff. 20 00:01:28,300 --> 00:01:33,633 So, one of the most important forces driving silicon development is this thing called Moore's Law. 21 00:01:33,633 --> 00:01:37,600 And so this was formulated by Gordon Moore. And it's just an observation about 22 00:01:37,600 --> 00:01:43,120 how the manufacturing of chips with transistors on them tends to go. 23 00:01:43,120 --> 00:01:47,633 And what the law says is that every 18 to 24 months, approximately, 24 00:01:47,633 --> 00:01:52,867 the number of transistors which can be fit onto one of those chips doubles. 25 00:01:52,867 --> 00:02:00,906 So, you could sorta take that two ways. It might mean that for each year when I make a chip 26 00:02:00,906 --> 00:02:04,733 after it doubles, well, now I can make that same chip but I get twice as many transistors. 27 00:02:04,733 --> 00:02:06,167 So, in some sense it... it's more powerful. 28 00:02:06,167 --> 00:02:12,795 Or you can think of it as just that the transistors are just getting cheaper and cheaper. 29 00:02:12,795 --> 00:02:15,233 Now Moore's Law is not some law of nature, like the law of gravity. 30 00:02:15,233 --> 00:02:19,467 It's just an observation about how transistor manufacturing tends to go, 31 00:02:19,467 --> 00:02:24,776 but it's been true for over twenty years, and it seems to be continuing to be true. 32 00:02:24,776 --> 00:02:32,767 So. Moore's law is why you can have computers now that are getting cheaper and they're showing up in thermostats and microwaves. 33 00:02:32,767 --> 00:02:37,872 Essentially it's the doubling quality of Moore's law, 34 00:02:37,872 --> 00:02:46,742 making what used to be a computer that would fill a room and cost millions of dollars now fit in the size of a sugar cube and cost under a dollar. 35 00:02:46,742 --> 00:02:49,018 That is the effect of Moore's law when you think of doubling. 36 00:02:49,018 --> 00:02:50,500 Well, just one doubling it's not that big. 37 00:02:50,500 --> 00:02:55,334 If you have ten doublings that's a factor of a thousand. 38 00:02:55,334 --> 00:02:57,935 So that's how you get from the room down to the sugar cube. 39 00:02:57,935 --> 00:02:59,800 The other way you can think about this just in your own life, 40 00:02:59,800 --> 00:03:07,408 is imagine buying... maybe six years ago buying a 50 dollar mp3 player. 41 00:03:07,408 --> 00:03:14,096 had some amount of capacity. Maybe it had one gigabyte of capacity. 42 00:03:14,096 --> 00:03:17,967 And then a few years later, with the same $50, if you bought an mp3 player it might have two or maybe four gigabytes of capacity. 43 00:03:17,967 --> 00:03:22,367 And then a few years later, for the same $50, well now they all have eight gigabytes. 44 00:03:22,367 --> 00:03:26,267 And what's going on is, well, basically there's a chip in the mp3 player that does the storage. 45 00:03:26,267 --> 00:03:30,300 And by Moore's law, the manufacturing of that chip... 46 00:03:30,300 --> 00:03:33,415 because there's more transistors that fit in there, 47 00:03:33,415 --> 00:03:36,733 for pretty much the same price they can offer more and more capacity. 48 00:03:36,733 --> 00:03:40,167 So that is the exponential quality of Moore's law. 49 00:03:40,167 --> 00:03:44,100 So, to talk about computers, I'm gonna talk about the major parts that go into one. 50 00:03:44,100 --> 00:03:53,400 And largely - oh, and here's a little picture of a computer - I'm going to say that there's the CPU, which is sort of the brains of the thing; 51 00:03:53,400 --> 00:03:57,656 and then there's RAM, which is sort of the temporary scratch pad memory; 52 00:03:57,656 --> 00:04:01,046 and finally, disk or flash for persistent structure. 53 00:04:01,046 --> 00:04:02,333 So we'll talk about each one of those parts. 54 00:04:02,333 --> 00:04:09,127 So, probably the most important part of the computer is the CPU, which stands for Central Processing Unit, 55 00:04:09,127 --> 00:04:12,467 and it's inevitably described as kind of "the brains" of the computer. It actually does the computing. 56 00:04:12,467 --> 00:04:19,767 So... the CPU has certain fairly simple operations that it can perform, 57 00:04:19,767 --> 00:04:27,533 and so when you say that a computer runs at two billion operations per second, 58 00:04:27,533 --> 00:04:29,900 really that's talking about the CPU: that means the CPU can do two billion things per second. 59 00:04:29,900 --> 00:04:32,765 And that's a very typical number for 2012. 60 00:04:32,765 --> 00:04:38,767 To say that it's the brains, we have to think about, well, the 'run' button in the earlier coding exercises, 61 00:04:38,767 --> 00:04:42,610 where you had the code, and then something was executing the code. 62 00:04:42,610 --> 00:04:45,600 Really, that was the CPU that was taking in that code and doing it. 63 00:04:45,600 --> 00:04:51,833 So, before I talk about, RAM and disk and those things, I need to have a brief word about bytes. 64 00:04:51,833 --> 00:04:57,900 So a byte is the, sort of, most common measure of information storage. 65 00:04:57,900 --> 00:05:02,951 So one byte refers to approximately one letter that you might type, 66 00:05:02,951 --> 00:05:07,688 like a T or an X or something. That fits in one byte. 67 00:05:07,688 --> 00:05:14,700 Later on I'm gonna talk about RAM and disks and things like that. And those are all the sizes. How much information can they hold? 68 00:05:14,700 --> 00:05:20,333 Those are measured in bytes. And later on, I'll go into more detail about the different sizes that you might have. 69 00:05:20,333 --> 00:05:24,067 For now, I'll just say that one megabyte is a common size. That's about a million bytes. 70 00:05:24,067 --> 00:05:28,367 And one gigabyte is about a billion bytes. 71 00:05:28,367 --> 00:05:32,500 So,with that in mind, let's go to our second bit of technology here... 72 00:05:32,500 --> 00:05:38,167 So RAM stands for Random Access Memory - or we might just say 'memory'- 73 00:05:38,167 --> 00:05:44,654 and RAM is the temporary storage used by the CPU 74 00:05:44,654 --> 00:05:47,800 to hold data and code that it's using right then just in the course of doing computation. 75 00:05:47,800 --> 00:05:55,233 So in the code when we said something like 'new SimpleImage ("flowers.jpg")' 76 00:05:55,233 --> 00:06:02,333 and I would say, 'well, this kind of loads the data into the computer' - really what was happening is the bytes of that data were being loaded into RAM, 77 00:06:02,333 --> 00:06:06,016 and once they were in RAM then the CPU could do operations on them. 78 00:06:06,016 --> 00:06:09,833 could do operations on them. So when you wrote code like 'pixel.setRed(0)' - really that was 79 00:06:09,833 --> 00:06:14,767 going into RAM and manipulating of the data; actually making a change. 80 00:06:14,767 --> 00:06:18,300 So, that sort of active stuff happens in RAM. 81 00:06:18,300 --> 00:06:24,824 The main thing about RAM is that it is not persistent. 82 00:06:24,824 --> 00:06:27,000 What that means is - when the power is removed, it just goes blank. 83 00:06:27,000 --> 00:06:31,744 So it just works well as fast, temporary storage, but it's not long-term storage. 84 00:06:31,744 --> 00:06:36,067 And you can kind of, I think you can have some intuition about that if you think about when you're working on 85 00:06:36,067 --> 00:06:42,500 some, you know, paper, and you're typing in a word processor and then suddenly your computer shuts down... 86 00:06:42,500 --> 00:06:44,700 maybe it crashes or the power goes out or something. 87 00:06:44,700 --> 00:06:50,667 And so you have a sense that, well, whatever you were just... those last few bits you were typing. Those are gone. 88 00:06:50,667 --> 00:06:59,283 Those were just in RAM. And the version that you have is the version that you saved. 89 00:06:59,283 --> 00:07:00,233 So in a word processor when you hit the 'save' command, really what you are doing is 90 00:07:00,233 --> 00:07:05,506 you're taking the version that is in RAM - this kinda temporary version - and you're writing it to disk. 91 00:07:05,506 --> 00:07:09,667 (mumbled) I'm just getting something, and we'll talk about it in a second. 92 00:07:09,667 --> 00:07:14,300 So that kinda gives you the sense of what does it mean to be persistent - like disk, or volatile - like RAM. 93 00:07:14,300 --> 00:07:19,577 Alright, that leads us to our third hardware component: persistent storage. 94 00:07:19,577 --> 00:07:22,300 So, the main thing about persistent storage: 95 00:07:22,300 --> 00:07:27,843 It's a big area of bytes, but when you remove the power the data stays there. 96 00:07:27,843 --> 00:07:34,484 So for the longest time persistent storage in computers has been done with a hard drive. 97 00:07:34,484 --> 00:07:40,800 So a hard drive has a spinning disk in it. And there's a little head that writes magnetic patterns on the disk, 98 00:07:40,800 --> 00:07:44,467 and it does that to record 0's and 1's, and store data. 99 00:07:44,467 --> 00:07:48,767 And so when you... if you have a computer and you hear kind of a high-pitched 'whining' sound, 100 00:07:48,767 --> 00:07:54,800 what you're probably hearing is the hard drive disk spinning in its little enclosure. 101 00:07:54,800 --> 00:07:59,500 More recently there's been advances in what's called a flash drive. 102 00:07:59,500 --> 00:08:04,200 And so a flash drive also stores 0's and 1's persistently, but it's solid state. 103 00:08:04,200 --> 00:08:11,868 It just uses a chip - a so-called 'flash chip' - so there's no moving parts, it's very small, it's very reliable. 104 00:08:11,868 --> 00:08:14,667 So, flash chips are used to make those little USB thumb drives 105 00:08:14,667 --> 00:08:19,667 or SD cards, that you might put into a camera or something like that. 106 00:08:19,667 --> 00:08:26,636 It used to be that per byte, flash was much more expensive than hard drives, and so hard drives were used for everything. 107 00:08:26,636 --> 00:08:28,633 Sort of following the pattern of Moore's Law, 108 00:08:28,633 --> 00:08:30,491 flash chips have been getting cheaper and cheaper. 109 00:08:30,491 --> 00:08:34,531 And so it may be that the hard drive kinda dies out for day-to-day usage. 110 00:08:34,531 --> 00:08:38,600 Like, we don't need it: we can just use these chips. So that remains to be seen. 111 00:08:38,600 --> 00:08:41,833 So when you've got a hard drive or a flash chip 112 00:08:41,833 --> 00:08:49,500 that just has this big area of bytes to do persistent storage, um, just on its own it's not really ready for the user to use. 113 00:08:49,500 --> 00:08:54,825 Usually what happens is, the hard drive or flash drive is organised with what's called a file system. 114 00:08:54,825 --> 00:08:59,400 And so the file system is just a way of organising this big area of bytes 115 00:08:59,400 --> 00:09:04,700 and giving it that sort of familiar structure of files and folders. 116 00:09:04,700 --> 00:09:07,178 And they each have names, and you can move them around and stuff. 117 00:09:07,178 --> 00:09:16,791 And so a file is really just a way of taking some area of, you know, 100,000 bytes, and assigning a name to them. 118 00:09:16,791 --> 00:09:20,667 So saying, 'look, this is flowers.jpg'. And flowers.jpg, that name, refers to those 100,000 bytes. 119 00:09:20,667 --> 00:09:23,033 And then the user can copy it, or move it around, or whatever. 120 00:09:23,033 --> 00:09:28,900 So, the file system just facilitates for you, seeing what data you have on there 121 00:09:28,900 --> 00:09:31,800 and moving it around and organising it. 122 00:09:31,800 --> 00:09:34,810 So that's our quick introduction. 123 00:09:34,810 --> 00:09:36,900 So actually what I'd like to do is show you just pictures of actual hardware. 124 00:09:36,900 --> 00:09:37,400 So, this is a picture of a motherboard. 125 00:09:37,400 --> 00:09:41,100 This is a computer, a Shuttle computer, I bought in I think 2008, and then it broke. 126 00:09:41,100 --> 00:09:47,800 So it became my little demo computer. 127 00:09:47,800 --> 00:09:52,318 So this was a cheap computer, about $200 with all the parts. 128 00:09:52,318 --> 00:09:56,358 So this is the motherboard all the electronic components plug into. 129 00:09:56,358 --> 00:09:58,467 And right here in the middle is maybe the most important component. That's the CPU. 130 00:09:58,467 --> 00:10:04,996 So let's zoom in on that. 131 00:10:04,996 --> 00:10:10,733 So, if you kinda zoom in and look at the CPU, this metal package has the CPU chip in it. 132 00:10:10,733 --> 00:10:16,200 And I'm gonna flip it over. If you flip it over you see there's all these gold pads here. 133 00:10:16,200 --> 00:10:20,633 So the CPU is the most complicated chip on here and so it has a very large number of connections, 134 00:10:20,633 --> 00:10:22,933 electrical connections to the motherboard. 135 00:10:22,933 --> 00:10:28,727 And so then I can look again at my Wikimedia image, and now you can appreciate... 136 00:10:28,727 --> 00:10:34,000 ...well, so there's these little tiny wires around the outside. So these connect to pads on the package 137 00:10:34,000 --> 00:10:36,761 - the gold pads we were seeing - 138 00:10:36,761 --> 00:10:41,033 and so inside the package they connect to little tiny spots around the chip 139 00:10:41,033 --> 00:10:43,200 in order to get the electricity into the transistors on the side here. 140 00:10:43,200 --> 00:10:49,667 The other thing I'll point out here is this copper thing. There's a second chip underneath here. 141 00:10:49,667 --> 00:10:55,533 This is called a heatsink. So, the chip, because it has electricity running through it, it can heat up, 142 00:10:55,533 --> 00:10:59,470 so there needs to be a way of dissipating that heat. 143 00:10:59,470 --> 00:11:01,281 This is made of copper: copper's really good at conducting heat, 144 00:11:01,281 --> 00:11:06,715 and so just by bolting that on there, it keeps the chip cool enough to operate. 145 00:11:06,715 --> 00:11:12,167 There used to be another heatsink on top of the CPU here, but I removed it. Just so I could take it apart and show it to you. 146 00:11:12,167 --> 00:11:20,967 All righty. So that's the CPU in the, uh, in this computer. So now let's look at the RAM. 147 00:11:20,967 --> 00:11:24,700 So if you look at the side of the computer here, this is the RAM. 148 00:11:24,700 --> 00:11:31,100 It's on a little separate card. And in this picture I have removed the card. 149 00:11:31,100 --> 00:11:33,533 So the card fits into the slot here, so that's RAM. 150 00:11:33,533 --> 00:11:38,712 So that's about 512 megabytes of RAM. 151 00:11:38,712 --> 00:11:41,533 This is some years ago. You probably couldn't buy a RAM card that small nowadays. 152 00:11:41,533 --> 00:11:47,767 So, you can see there's two chips here and there's two more chips underneath the stickers. 153 00:11:47,767 --> 00:11:55,300 So this was made with four chips. Probably by Moore's Law, when this card was manufactured a few years before, 154 00:11:55,300 --> 00:11:56,967 it probably used to be eight chips. 155 00:11:56,967 --> 00:12:00,567 And then, by Moore's law, they can fit more under each chip and so they can just save money. 156 00:12:00,567 --> 00:12:05,693 So, for the same 512 megabytes they could use fewer chips, so it's cheaper. 157 00:12:05,693 --> 00:12:10,900 So that's...what do we have...CPU and RAM. So the last thing we need is persistent storage. 158 00:12:10,900 --> 00:12:14,833 So, for this computer, persistent storage was provided by this. This is a hard drive. 159 00:12:14,833 --> 00:12:19,000 So this is a three and a half inch hard drive - very typical size for a desktoop computer. 160 00:12:19,000 --> 00:12:23,619 So this is where there's the spinning magnetic disk in here. 161 00:12:23,619 --> 00:12:31,700 And this connects to the motherboard by this little SATA cable, which is a standard thing. 162 00:12:31,700 --> 00:12:35,508 So those are the three parts of a computer. 163 00:12:35,508 --> 00:12:36,767 That was a $200 computer, and it sorta did everything you'd want a computer to do. 164 00:12:36,767 --> 00:12:43,900 More recently now we've got this alternative to the hard drive. 165 00:12:43,900 --> 00:12:49,904 So this is a USB flash drive, or sometimes called a thumb drive. 166 00:12:49,904 --> 00:12:54,367 So it's, you know, it's tiny. And I took this one apart. 167 00:12:54,367 --> 00:12:59,471 And so if you look inside of it, this is a flash chip. 168 00:12:59,471 --> 00:13:04,600 So this is the chip that just stores persistent data, little 0's and 1's, as little groups of electrons. 169 00:13:04,600 --> 00:13:08,852 So this is the thing that's competing with the hard drive. 170 00:13:08,852 --> 00:13:15,800 So this is a one gigabit chip, so it stores one billion bits. 171 00:13:15,800 --> 00:13:22,644 And later on we'll look at how many bytes that might be. So that's a thumb drive. 172 00:13:22,644 --> 00:13:27,520 This is an SD card, which is just a similar, you know, just an alternative to the thumb drive. 173 00:13:27,520 --> 00:13:31,003 It's really just the same technology; it's just a different shape basically. 174 00:13:31,003 --> 00:13:33,300 So this is the sort of thing you would use inside of a camera. 175 00:13:33,300 --> 00:13:37,830 So as a last example, looking at that big computer... 176 00:13:37,830 --> 00:13:43,133 So, one of the effects of Moore's Law is that you get these cheap little computers that can sort of fit into different places. 177 00:13:43,133 --> 00:13:48,465 So a little computer on a chip is known as a microcontroller. 178 00:13:48,465 --> 00:13:49,933 So the idea is, that instead of having all these separate chips 179 00:13:49,933 --> 00:13:56,963 you can fit the CPU, the RAM, and the persistent storage all onto one chip. 180 00:13:56,963 --> 00:14:03,883 And it's not gonna have a lot of power, but it's gonna be cheap. And Moore's Law has made that possible. 181 00:14:03,883 --> 00:14:07,970 So microcontrollers, now, you can buy essentially the whole computer for under a dollar, 182 00:14:07,970 --> 00:14:12,033 and it's just on the one chip. So these are the kinda computers - or I should say microcontrollers - 183 00:14:12,033 --> 00:14:13,821 that you would find in a thermostat, 184 00:14:13,821 --> 00:14:18,133 or they're probably scattered around your car doing little computer functions. 185 00:14:18,133 --> 00:14:27,167 So, a neat example of a micro-controller is this guy. This is an Arduino board. 186 00:14:27,167 --> 00:14:33,167 And this is a free and open source board, just offered by artists or hobbyists, or just for kinda playing around. 187 00:14:33,167 --> 00:14:37,267 So this here. This is the chip; this is the micro controller. 188 00:14:37,267 --> 00:14:40,867 So, it has a little bit of RAM, a little bit of CPU, and a little bit of persistent storage 189 00:14:40,867 --> 00:14:45,300 just all on there. And then it's put on this board with some other support chips: 190 00:14:45,300 --> 00:14:50,000 so, this is a USB chip, and it's got some power chips here to just make the whole thing work. 191 00:14:50,000 --> 00:14:54,167 So, you can buy a version of this I think for about $20. 192 00:14:54,167 --> 00:14:56,333 And the idea is, it's just a little computer, 193 00:14:56,333 --> 00:14:59,633 so it can read sensors or switches, or control little lights or whatever. 194 00:14:59,633 --> 00:15:05,323 So it's just a fun way to play around and make, like, an art project, or something like that. 195 00:15:05,323 --> 00:15:06,000 So if you like working with your hands and you like wires, 196 00:15:06,000 --> 99:59:59,999 then this is another form of computer that might be good to play with.