If a computer is like a piano, then the term software refers to the code - what runs on it, like the music.
And the hardware is the physical parts of the thing.
So in this section, I'm going to talk about hardware, physical parts of the computer.
So probably one of the most important inventions of the twentieth century is the transistor.
And this is a little electronic component that can be used to build all sorts of different things.
The most common form of transistor today is built on what's called a chip.
And here's a picture of a chip, that I'm linking to from Wikimedia.
And so a chip is made of a little fingernail-sized piece of silicon.
And then different electronic components can be etched onto the silicon
and this allows you to essentially make the components very, very cheaply.
So the most likely, the most common component put on here is transistors. And you can make all sorts of stuff out of transistors.
So the things I'm gonna talk about later, CPUs and memory and whatnot, those all come down to chips that look like this.
Now a chip like this is said to be solid state
meaning there's no moving parts, there's no gears, there's no wheels.
And in a way, that makes it very reliable.
And as I said before, they can be made pretty cheaply.
And so this is one of the driving forces in the, computer revolution.
I should point out, this is the element silicon, which is like glass.
Not to be confused with silicone, which is like that kinda soft, rubbery stuff.
So, one of the most important forces driving silicon development is this thing called Moore's Law.
And so this was formulated by Gordon Moore. And it's just an observation about
how the manufacturing of chips with transistors on them tends to go.
And what the law says is that every 18 to 24 months, approximately,
the number of transistors which can be fit onto one of those chips doubles.
So, you could sorta take that two ways. It might mean that for each year when I make a chip
after it doubles, well, now I can make that same chip but I get twice as many transistors.
So, in some sense it... it's more powerful.
Or you can think of it as just that the transistors are just getting cheaper and cheaper.
Now Moore's Law is not some law of nature, like the law of gravity.
It's just an observation about how transistor manufacturing tends to go,
but it's been true for over twenty years, and it seems to be continuing to be true.
So. Moore's law is why you can have computers now that are getting cheaper and they're showing up in thermostats and microwaves.
Essentially it's the doubling quality of Moore's law,
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.
That is the effect of Moore's law when you think of doubling.
Well, just one doubling it's not that big.
If you have ten doublings that's a factor of a thousand.
So that's how you get from the room down to the sugar cube.
The other way you can think about this just in your own life,
is imagine buying... maybe six years ago buying a 50 dollar mp3 player.
had some amount of capacity. Maybe it had one gigabyte of capacity.
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.
And then a few years later, for the same $50, well now they all have eight gigabytes.
And what's going on is, well, basically there's a chip in the mp3 player that does the storage.
And by Moore's law, the manufacturing of that chip...
because there's more transistors that fit in there,
for pretty much the same price they can offer more and more capacity.
So that is the exponential quality of Moore's law.
So, to talk about computers, I'm gonna talk about the major parts that go into one.
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;
and then there's RAM, which is sort of the temporary scratch pad memory;
and finally, disk or flash for persistent structure.
So we'll talk about each one of those parts.
So, probably the most important part of the computer is the CPU, which stands for Central Processing Unit,
and it's inevitably described as kind of "the brains" of the computer. It actually does the computing.
So... the CPU has certain fairly simple operations that it can perform,
and so when you say that a computer runs at two billion operations per second,
really that's talking about the CPU: that means the CPU can do two billion things per second.
And that's a very typical number for 2012.
To say that it's the brains, we have to think about, well, the 'run' button in the earlier coding exercises,
where you had the code, and then something was executing the code.
Really, that was the CPU that was taking in that code and doing it.
So, before I talk about, RAM and disk and those things, I need to have a brief word about bytes.
So a byte is the, sort of, most common measure of information storage.
So one byte refers to approximately one letter that you might type,
like a T or an X or something. That fits in one byte.
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?
Those are measured in bytes. And later on, I'll go into more detail about the different sizes that you might have.
For now, I'll just say that one megabyte is a common size. That's about a million bytes.
And one gigabyte is about a billion bytes.
So,with that in mind, let's go to our second bit of technology here...
So RAM stands for Random Access Memory - or we might just say 'memory'-
and RAM is the temporary storage used by the CPU
to hold data and code that it's using right then just in the course of doing computation.
So in the code when we said something like 'new SimpleImage ("flowers.jpg")'
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,
and once they were in RAM then the CPU could do operations on them.
could do operations on them. So when you wrote code like 'pixel.setRed(0)' - really that was
going into RAM and manipulating of the data; actually making a change.
So, that sort of active stuff happens in RAM.
The main thing about RAM is that it is not persistent.
What that means is - when the power is removed, it just goes blank.
So it just works well as fast, temporary storage, but it's not long-term storage.
And you can kind of, I think you can have some intuition about that if you think about when you're working on
some, you know, paper, and you're typing in a word processor and then suddenly your computer shuts down...
maybe it crashes or the power goes out or something.
And so you have a sense that, well, whatever you were just... those last few bits you were typing. Those are gone.
Those were just in RAM. And the version that you have is the version that you saved.
So in a word processor when you hit the 'save' command, really what you are doing is
you're taking the version that is in RAM - this kinda temporary version - and you're writing it to disk.
(mumbled) I'm just getting something, and we'll talk about it in a second.
So that kinda gives you the sense of what does it mean to be persistent - like disk, or volatile - like RAM.
Alright, that leads us to our third hardware component: persistent storage.
So, the main thing about persistent storage:
It's a big area of bytes, but when you remove the power the data stays there.
So for the longest time persistent storage in computers has been done with a hard drive.
So a hard drive has a spinning disk in it. And there's a little head that writes magnetic patterns on the disk,
and it does that to record 0's and 1's, and store data.
And so when you... if you have a computer and you hear kind of a high-pitched 'whining' sound,
what you're probably hearing is the hard drive disk spinning in its little enclosure.
More recently there's been advances in what's called a flash drive.
And so a flash drive also stores 0's and 1's persistently, but it's solid state.
It just uses a chip - a so-called 'flash chip' - so there's no moving parts, it's very small, it's very reliable.
So, flash chips are used to make those little USB thumb drives
or SD cards, that you might put into a camera or something like that.
It used to be that per byte, flash was much more expensive than hard drives, and so hard drives were used for everything.
Sort of following the pattern of Moore's Law,
flash chips have been getting cheaper and cheaper.
And so it may be that the hard drive kinda dies out for day-to-day usage.
Like, we don't need it: we can just use these chips. So that remains to be seen.
So when you've got a hard drive or a flash chip
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.
Usually what happens is, the hard drive or flash drive is organised with what's called a file system.
And so the file system is just a way of organising this big area of bytes
and giving it that sort of familiar structure of files and folders.
And they each have names, and you can move them around and stuff.
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.
So saying, 'look, this is flowers.jpg'. And flowers.jpg, that name, refers to those 100,000 bytes.
And then the user can copy it, or move it around, or whatever.
So, the file system just facilitates for you, seeing what data you have on there
and moving it around and organising it.
So that's our quick introduction.
So actually what I'd like to do is show you just pictures of actual hardware.
So, this is a picture of a motherboard.
This is a computer, a Shuttle computer, I bought in I think 2008, and then it broke.
So it became my little demo computer.
So this was a cheap computer, about $200 with all the parts.
So this is the motherboard all the electronic components plug into.
And right here in the middle is maybe the most important component. That's the CPU.
So let's zoom in on that.
So, if you kinda zoom in and look at the CPU, this metal package has the CPU chip in it.
And I'm gonna flip it over. If you flip it over you see there's all these gold pads here.
So the CPU is the most complicated chip on here and so it has a very large number of connections,
electrical connections to the motherboard.
And so then I can look again at my Wikimedia image, and now you can appreciate...
...well, so there's these little tiny wires around the outside. So these connect to pads on the package
- the gold pads we were seeing -
and so inside the package they connect to little tiny spots around the chip
in order to get the electricity into the transistors on the side here.
The other thing I'll point out here is this copper thing. There's a second chip underneath here.
This is called a heatsink. So, the chip, because it has electricity running through it, it can heat up,
so there needs to be a way of dissipating that heat.
This is made of copper: copper's really good at conducting heat,
and so just by bolting that on there, it keeps the chip cool enough to operate.
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.
All righty. So that's the CPU in the, uh, in this computer. So now let's look at the RAM.
So if you look at the side of the computer here, this is the RAM.
It's on a little separate card. And in this picture I have removed the card.
So the card fits into the slot here, so that's RAM.
So that's about 512 megabytes of RAM.
This is some years ago. You probably couldn't buy a RAM card that small nowadays.
So, you can see there's two chips here and there's two more chips underneath the stickers.
So this was made with four chips. Probably by Moore's Law, when this card was manufactured a few years before,
it probably used to be eight chips.
And then, by Moore's law, they can fit more under each chip and so they can just save money.
So, for the same 512 megabytes they could use fewer chips, so it's cheaper.
So that's...what do we have...CPU and RAM. So the last thing we need is persistent storage.
So, for this computer, persistent storage was provided by this. This is a hard drive.
So this is a three and a half inch hard drive - very typical size for a desktoop computer.
So this is where there's the spinning magnetic disk in here.
And this connects to the motherboard by this little SATA cable, which is a standard thing.
So those are the three parts of a computer.
That was a $200 computer, and it sorta did everything you'd want a computer to do.
More recently now we've got this alternative to the hard drive.
So this is a USB flash drive, or sometimes called a thumb drive.
So it's, you know, it's tiny. And I took this one apart.
And so if you look inside of it, this is a flash chip.
So this is the chip that just stores persistent data, little 0's and 1's, as little groups of electrons.
So this is the thing that's competing with the hard drive.
So this is a one gigabit chip, so it stores one billion bits.
And later on we'll look at how many bytes that might be. So that's a thumb drive.
This is an SD card, which is just a similar, you know, just an alternative to the thumb drive.
It's really just the same technology; it's just a different shape basically.
So this is the sort of thing you would use inside of a camera.
So as a last example, looking at that big computer...
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.
So a little computer on a chip is known as a microcontroller.
So the idea is, that instead of having all these separate chips
you can fit the CPU, the RAM, and the persistent storage all onto one chip.
And it's not gonna have a lot of power, but it's gonna be cheap. And Moore's Law has made that possible.
So microcontrollers, now, you can buy essentially the whole computer for under a dollar,
and it's just on the one chip. So these are the kinda computers - or I should say microcontrollers -
that you would find in a thermostat,
or they're probably scattered around your car doing little computer functions.
So, a neat example of a micro-controller is this guy. This is an Arduino board.
And this is a free and open source board, just offered by artists or hobbyists, or just for kinda playing around.
So this here. This is the chip; this is the micro controller.
So, it has a little bit of RAM, a little bit of CPU, and a little bit of persistent storage
just all on there. And then it's put on this board with some other support chips:
so, this is a USB chip, and it's got some power chips here to just make the whole thing work.
So, you can buy a version of this I think for about $20.
And the idea is, it's just a little computer,
so it can read sensors or switches, or control little lights or whatever.
So it's just a fun way to play around and make, like, an art project, or something like that.
So if you like working with your hands and you like wires,
then this is another form of computer that might be good to play with.