0:00:04.284,0:00:08.893 If a computer is like a piano, then the[br]term software refers to the code - what runs on it, like the music. 0:00:08.893,0:00:13.026 And the hardware is the physical parts of the thing. 0:00:13.026,0:00:15.167 So in this section, I'm going to talk about hardware, physical parts of the computer. 0:00:15.167,0:00:22.200 So probably one of the most important inventions of the twentieth century is the transistor. 0:00:22.200,0:00:27.467 And this is a little electronic component that can be used to build all sorts of different things. 0:00:27.467,0:00:32.367 The most common form of transistor today is built on what's called a chip. 0:00:32.367,0:00:36.967 And here's a picture of a chip, that I'm linking to from Wikimedia. 0:00:40.147,0:00:44.234 And so a chip is made of a little fingernail-sized piece of silicon. 0:00:44.234,0:00:46.667 And then different electronic components can be etched onto the silicon 0:00:46.667,0:00:50.267 and this allows you to essentially make the components very, very cheaply. 0:00:50.267,0: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. 0:00:58.816,0: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. 0:01:04.100,0:01:08.615 Now a chip like this is said to be solid state 0:01:08.615,0:01:10.667 meaning there's no moving parts, there's no gears, there's no wheels. 0:01:10.667,0:01:13.538 And in a way, that makes it very reliable. 0:01:13.538,0:01:14.931 And as I said before, they can be made pretty cheaply. 0:01:14.931,0:01:18.100 And so this is one of the driving forces[br]in the, computer revolution. 0:01:18.100,0:01:22.033 I should point out, this is the element silicon,[br]which is like glass. 0:01:22.033,0:01:28.300 Not to be confused with silicone, which is like that kinda[br]soft, rubbery stuff. 0:01:28.300,0:01:33.633 So, one of the most important forces driving silicon development is this thing called Moore's Law. 0:01:33.633,0:01:37.600 And so this was formulated by Gordon[br]Moore. And it's just an observation about 0:01:37.600,0:01:43.120 how the manufacturing of chips with[br]transistors on them tends to go. 0:01:43.120,0:01:47.633 And what the law says is that every 18 to 24[br]months, approximately, 0:01:47.633,0:01:52.867 the number of transistors which can be fit onto one of those chips doubles. 0:01:52.867,0:02:00.906 So, you could sorta take that two ways. It might mean that for[br]each year when I make a chip 0:02:00.906,0:02:04.733 after it doubles, well, now I can make that same chip but I get twice as many transistors. 0:02:04.733,0:02:06.167 So, in some sense it... it's more powerful. 0:02:06.167,0:02:12.795 Or you can think of it as just that the transistors are just[br]getting cheaper and cheaper. 0:02:12.795,0:02:15.233 Now Moore's Law is not some law of nature, like the[br]law of gravity. 0:02:15.233,0:02:19.467 It's just an observation about how transistor manufacturing tends to go, 0:02:19.467,0:02:24.776 but it's been true for over twenty years, and it seems to be continuing to be true. 0:02:24.776,0: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. 0:02:32.767,0:02:37.872 Essentially it's the doubling quality of Moore's law, 0:02:37.872,0: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. 0:02:46.742,0:02:49.018 That is the effect of Moore's law when you think of doubling. 0:02:49.018,0:02:50.500 Well, just one doubling it's not that big. 0:02:50.500,0:02:55.334 If you have ten doublings that's a factor of a[br]thousand. 0:02:55.334,0:02:57.935 So that's how you get from the room down to the sugar cube. 0:02:57.935,0:02:59.800 The other way you can think about this just in your own life, 0:02:59.800,0:03:07.408 is imagine buying... maybe six years ago buying a 50 dollar mp3 player. 0:03:07.408,0:03:14.096 had some amount of capacity. Maybe it had one[br]gigabyte of capacity. 0:03:14.096,0:03:17.967 And then a few years later, with the same $50, if you[br]bought an mp3 player it might have two or maybe four gigabytes of capacity. 0:03:17.967,0:03:22.367 And then a few years later, for the same $50, well now they all have eight gigabytes. 0:03:22.367,0:03:26.267 And what's going on is, well, basically there's a chip in the mp3 player that does the storage. 0:03:26.267,0:03:30.300 And by Moore's law, the manufacturing of that chip... 0:03:30.300,0:03:33.415 because there's more transistors that fit in there, 0:03:33.415,0:03:36.733 for pretty much the same price they can offer more and more capacity. 0:03:36.733,0:03:40.167 So that is the exponential quality of Moore's law. 0:03:40.167,0:03:44.100 So, to talk about computers, I'm gonna talk about the major parts that go into one. 0:03:44.100,0: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; 0:03:53.400,0:03:57.656 and then there's RAM, which is sort of the temporary scratch pad memory; 0:03:57.656,0:04:01.046 and finally, disk or flash for persistent structure. 0:04:01.046,0:04:02.333 So we'll talk about each one of those parts. 0:04:02.333,0:04:09.127 So, probably the most important part of the computer is the CPU, which stands for Central Processing Unit, 0:04:09.127,0:04:12.467 and it's inevitably described as kind of "the[br]brains" of the computer. It actually does the computing. 0:04:12.467,0:04:19.767 So... the CPU has certain fairly simple operations that it can perform, 0:04:19.767,0:04:27.533 and so when you say that a computer runs at two billion operations per second, 0:04:27.533,0:04:29.900 really that's talking about the CPU: that means the CPU can do two billion things per second. 0:04:29.900,0:04:32.765 And that's a very typical number for 2012. 0:04:32.765,0:04:38.767 To say that it's the brains, we have to think[br]about, well, the 'run' button in the earlier coding exercises, 0:04:38.767,0:04:42.610 where you had the code, and then something was executing the code. 0:04:42.610,0:04:45.600 Really, that was the CPU that was taking in that code and doing it. 0:04:45.600,0:04:51.833 So, before I talk about, RAM and disk and those things, I need to have a brief word about bytes. 0:04:51.833,0:04:57.900 So a byte is the, sort of, most common measure of information storage. 0:04:57.900,0:05:02.951 So one byte refers to approximately one letter that you might type, 0:05:02.951,0:05:07.688 like a T or an X or something. That fits in one byte. 0:05:07.688,0: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? 0:05:14.700,0: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. 0:05:20.333,0:05:24.067 For now, I'll just say that one megabyte is a common size. That's about a million bytes. 0:05:24.067,0:05:28.367 And one gigabyte is about a billion bytes. 0:05:28.367,0:05:32.500 So,with that in mind, let's go to our second bit of technology here... 0:05:32.500,0:05:38.167 So RAM stands for Random Access Memory - or we might just say 'memory'- 0:05:38.167,0:05:44.654 and RAM is the temporary storage used by the CPU 0:05:44.654,0:05:47.800 to hold data and code that it's using right then just in[br]the course of doing computation. 0:05:47.800,0:05:55.233 So in the code when we said something like 'new SimpleImage ("flowers.jpg")' 0:05:55.233,0:06:02.333 and I would say, 'well, this kind of loads the data into the[br]computer' - really what was happening is the bytes of that data were being loaded into RAM, 0:06:02.333,0:06:06.016 and once they were in RAM then the CPU could do operations on them. 0:06:06.016,0:06:09.833 could do operations on them. So when you[br]wrote code like 'pixel.setRed(0)' - really that was 0:06:09.833,0:06:14.767 going into RAM and manipulating of the data; actually making a change. 0:06:14.767,0:06:18.300 So, that sort of active stuff happens in RAM. 0:06:18.300,0:06:24.824 The main thing about RAM is that it is not persistent. 0:06:24.824,0:06:27.000 What that means is - when the power is removed, it just goes blank. 0:06:27.000,0:06:31.744 So it just works well as fast, temporary[br]storage, but it's not long-term storage. 0:06:31.744,0:06:36.067 And you can kind of, I think you can have some[br]intuition about that if you think about when you're working on 0:06:36.067,0:06:42.500 some, you know, paper, and you're typing in a word processor and then suddenly your computer shuts down... 0:06:42.500,0:06:44.700 maybe it crashes or the power goes out or something. 0:06:44.700,0: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. 0:06:50.667,0:06:59.283 Those were just in RAM. And the version that you have is the version that you saved. 0:06:59.283,0:07:00.233 So in a word processor when you hit the 'save' command, really what you are doing is 0:07:00.233,0:07:05.506 you're taking the version that is in RAM - this kinda temporary version - and you're writing it to disk. 0:07:05.506,0:07:09.667 (mumbled) I'm just getting something, and we'll talk about it in a second. 0:07:09.667,0:07:14.300 So that kinda gives you the sense of what does it mean to be persistent - like disk, or volatile - like RAM. 0:07:14.300,0:07:19.577 Alright, that leads us to our third hardware component: persistent storage. 0:07:19.577,0:07:22.300 So, the main thing about persistent storage: 0:07:22.300,0:07:27.843 It's a big area of bytes, but when you remove the power the data stays there. 0:07:27.843,0:07:34.484 So for the longest time persistent storage in computers has been done with a hard drive. 0:07:34.484,0: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, 0:07:40.800,0:07:44.467 and it does that to record 0's and 1's, and store data. 0:07:44.467,0:07:48.767 And so when you... if you have a computer and you hear kind of a high-pitched 'whining' sound, 0:07:48.767,0:07:54.800 what you're probably hearing is the hard drive disk spinning in its little enclosure. 0:07:54.800,0:07:59.500 More recently there's been advances in what's called a flash drive. 0:07:59.500,0:08:04.200 And so a flash drive also stores 0's and 1's persistently, but it's solid state. 0:08:04.200,0: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. 0:08:11.868,0:08:14.667 So, flash chips are used to make those little USB thumb drives 0:08:14.667,0:08:19.667 or SD cards, that you might put into a camera or something like that. 0:08:19.667,0: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. 0:08:26.636,0:08:28.633 Sort of following the pattern of Moore's Law, 0:08:28.633,0:08:30.491 flash chips have been getting cheaper and cheaper. 0:08:30.491,0:08:34.531 And so it may be that the hard drive kinda dies out for day-to-day usage. 0:08:34.531,0:08:38.600 Like, we don't need it: we can just use these chips. So that remains to be seen. 0:08:38.600,0:08:41.833 So when you've got a hard drive or a flash chip 0:08:41.833,0: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. 0:08:49.500,0:08:54.825 Usually what happens is, the hard drive or flash drive is organised with what's called a file system. 0:08:54.825,0:08:59.400 And so the file system is just a way of organising this big area of bytes 0:08:59.400,0:09:04.700 and giving it that sort of familiar structure of files and folders. 0:09:04.700,0:09:07.178 And they each have names, and you can move them around and stuff. 0:09:07.178,0: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. 0:09:16.791,0:09:20.667 So saying, 'look, this is flowers.jpg'. And flowers.jpg, that name, refers to those 100,000 bytes. 0:09:20.667,0:09:23.033 And then the user can copy it, or move it around, or whatever. 0:09:23.033,0:09:28.900 So, the file system just facilitates for you, seeing what data you have on there 0:09:28.900,0:09:31.800 and moving it around and organising it. 0:09:31.800,0:09:34.810 So that's our quick introduction. 0:09:34.810,0:09:36.900 So actually what I'd like to do is show you just pictures of actual hardware. 0:09:36.900,0:09:37.400 So, this is a picture of a motherboard. 0:09:37.400,0:09:41.100 This is a computer, a Shuttle computer, I bought in I think 2008, and then it broke. 0:09:41.100,0:09:47.800 So it became my little demo computer. [br] 0:09:47.800,0:09:52.318 So this was a cheap computer, about $200 with all[br]the parts. 0:09:52.318,0:09:56.358 So this is the motherboard all the electronic components plug into. 0:09:56.358,0:09:58.467 And right here in the middle is maybe the most important component. That's the CPU. 0:09:58.467,0:10:04.996 So let's zoom in on that. 0:10:04.996,0:10:10.733 So, if you kinda zoom in and look at the CPU, this metal[br]package has the CPU chip in it. 0:10:10.733,0:10:16.200 And I'm gonna flip it over. If you flip it over you see there's all these gold pads here. 0:10:16.200,0:10:20.633 So the CPU is the most complicated chip on here and so it has a very large number of connections, 0:10:20.633,0:10:22.933 electrical connections to the motherboard. 0:10:22.933,0:10:28.727 And so then I can look again at my Wikimedia image, and now you can appreciate... 0:10:28.727,0:10:34.000 ...well, so there's these little tiny wires around the outside. So these connect to pads on the package 0:10:34.000,0:10:36.761 - the gold pads we were seeing - 0:10:36.761,0:10:41.033 and so inside the package they connect to little tiny spots[br]around the chip 0:10:41.033,0:10:43.200 in order to get the electricity into the transistors on the side[br]here. 0:10:43.200,0:10:49.667 The other thing I'll point out here is this copper thing. There's a second chip underneath here. 0:10:49.667,0:10:55.533 This is called a heatsink. So, the chip, because it has electricity running through it, it can heat up, 0:10:55.533,0:10:59.470 so there needs to be a way of dissipating that heat. 0:10:59.470,0:11:01.281 This is made of copper: copper's really good at[br]conducting heat, 0:11:01.281,0:11:06.715 and so just by bolting that on there, it keeps the chip cool enough to operate. 0:11:06.715,0: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. 0:11:12.167,0:11:20.967 All righty. So that's the CPU in the, uh, in this computer. So now let's look at the RAM. 0:11:20.967,0:11:24.700 So if you look at the side of the computer here, this is the RAM. 0:11:24.700,0:11:31.100 It's on a little separate card. And[br]in this picture I have removed the card. 0:11:31.100,0:11:33.533 So the card fits into the slot here, so that's RAM. 0:11:33.533,0:11:38.712 So that's about 512 megabytes of RAM. 0:11:38.712,0:11:41.533 This is some years ago. You probably couldn't buy a RAM card that small nowadays. 0:11:41.533,0:11:47.767 So, you can see there's two chips here and there's two more chips underneath the stickers. 0:11:47.767,0:11:55.300 So this was made with four chips. Probably by Moore's Law, when this card was manufactured a few years before, 0:11:55.300,0:11:56.967 it probably used to be eight chips. 0:11:56.967,0:12:00.567 And then, by Moore's law, they can fit more under each chip and so they can just save money. 0:12:00.567,0:12:05.693 So, for the same 512 megabytes they could use fewer chips, so it's cheaper. 0:12:05.693,0:12:10.900 So that's...what do we have...CPU and RAM. So the last thing we need is persistent storage. 0:12:10.900,0:12:14.833 So, for this computer, persistent storage was provided by this. This is a hard drive. 0:12:14.833,0:12:19.000 So this is a three and a half inch hard drive - very typical size for a desktoop computer. 0:12:19.000,0:12:23.619 So this is where there's the spinning magnetic disk in here. 0:12:23.619,0:12:31.700 And this connects to the motherboard by this little SATA cable, which is a standard thing. 0:12:31.700,0:12:35.508 So those are the three parts of a computer. 0:12:35.508,0:12:36.767 That was a $200 computer, and it sorta did everything you'd want a computer to do. 0:12:36.767,0:12:43.900 More recently now we've got this alternative to the hard drive. 0:12:43.900,0:12:49.904 So this is a USB flash drive, or sometimes called a thumb drive. 0:12:49.904,0:12:54.367 So it's, you know, it's tiny. And I took this one apart. 0:12:54.367,0:12:59.471 And so if you look inside of it, this is a flash chip. 0:12:59.471,0:13:04.600 So this is the chip that just stores persistent data, little 0's and 1's, as little groups of electrons. 0:13:04.600,0:13:08.852 So this is the thing that's competing with the hard drive. 0:13:08.852,0:13:15.800 So this is a one gigabit chip, so it stores one billion bits. 0:13:15.800,0:13:22.644 And later on we'll look at how many bytes that might be. So that's a thumb drive. 0:13:22.644,0:13:27.520 This is an SD card, which is just a similar, you know, just an alternative to the thumb drive. 0:13:27.520,0:13:31.003 It's really just the same technology; it's just a different shape basically. 0:13:31.003,0:13:33.300 So this is the sort of thing you would use inside of a camera. 0:13:33.300,0:13:37.830 So as a last example, looking at that big[br]computer... 0:13:37.830,0: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. 0:13:43.133,0:13:48.465 So a little computer on a chip is known as a microcontroller. 0:13:48.465,0:13:49.933 So the idea is, that instead of having all these separate chips 0:13:49.933,0:13:56.963 you can fit the CPU, the RAM, and the persistent storage[br]all onto one chip. 0:13:56.963,0: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. [br] 0:14:03.883,0:14:07.970 So microcontrollers, now, you can buy essentially the whole computer for under a dollar, 0:14:07.970,0:14:12.033 and it's just on the one chip. So these are the kinda computers - or I should say microcontrollers - 0:14:12.033,0:14:13.821 that you would find in a thermostat, 0:14:13.821,0:14:18.133 or they're probably scattered around your car doing[br]little computer functions. 0:14:18.133,0:14:27.167 So, a neat example of a micro-controller is this[br]guy. This is an Arduino board. 0:14:27.167,0:14:33.167 And this is a free and open source board, just offered[br]by artists or hobbyists, or just for kinda playing around. 0:14:33.167,0:14:37.267 So this here. This is the chip; this is the micro controller. 0:14:37.267,0:14:40.867 So, it has a little bit of RAM, a little bit of CPU, and a little bit of persistent storage 0:14:40.867,0:14:45.300 just all on there. And then it's put on this board with some other support chips:[br] 0:14:45.300,0:14:50.000 so, this is a USB chip, and it's got some power chips here to just make the whole thing work. 0:14:50.000,0:14:54.167 So, you can buy a version of this I think for about $20. 0:14:54.167,0:14:56.333 And the idea is, it's just a little computer, 0:14:56.333,0:14:59.633 so it can read sensors or switches, or control little lights or whatever. 0:14:59.633,0:15:05.323 So it's just a fun way to play around and make, like, an[br]art project, or something like that. 0:15:05.323,0:15:06.000 So if you like working with your hands and[br]you like wires, 0:15:06.000,9:59:59.000 then this is another form of computer that might be good to play with.