Hello and welcome back to Hardware Architecture. Now you might ask, why do I tell you about hardware architecture? Probably you're not going to build any hardware, although it's fun stuff to do and if you're going to become a computer scientist, which most of you won't want to be, it's a great thing to study and those who build our hardware are amazingly talented individuals and it's a really rewarding job.
The reason I like talking to you about hardware is because I want to be able to use words at some point and say, oh, secondary storage, or central processing unit, or random access memory, or peripherals, input devices. And I want to be able to say those words, and I want you to be able to understand them. And so I'll start with a little piece of hardware called the Raspberry Pi.
And the Raspberry Pi is a cute little single board computer. As we go forward, these things are smaller and smaller and smaller. And the interesting thing is that the architecture of these stays the same, but the number of components drops.
So I'm gonna start and give you a block diagram of sort of a generic computer and tell you the major parts of it. Now I'm gonna show you some really old hardware. some really new hardware, and then some hardware that is of medium age. And the medium age hardware is probably the easiest one to see.
The architecture is the same, okay? And so the basic block diagram is that the brains, if there are brains in computers, which there really aren't, the software is the closest thing computers have to brains, but in hardware the closest brain a computer has is this, called a microprocessing unit. or a central processor unit.
And this is designed, you know, three billion times a second, to ask the question, what do you want me to do next? And these little pins on the back are our instructions, like 32 or 64 of these pins, three billion times a second, we send an instruction into these things. Now, we can't sit there and talk to it, we can't, and so the instructions we store in what's called the main memory, and this memory is really fast, and the memory sort of feeds this. And so every time the CPU needs a new instruction, it asks the memory where that instruction is. And so the memory feeds the instruction to the CPU, the CPU does it, says give me another instruction, CPU does it, gives me another instruction, and that is the basic essence of programming.
This asks what's next, and this is where your program is stored, or a program you purchased or came with your hardware. where that's all stored, and those are your places. And so you end up inside, your programs end up inside this memory.
So then there's a... I mean, and so in software you tend to program the CPU. And if you had bought a desktop computer a number of years back, it would have this thing called the motherboard.
And the motherboard is called this because it kind of connects all the components together. And so if you buy memory by itself, it does nothing, but it has a place to plug into the motherboard. And if you buy a microprocessor, it has a place to plug into the motherboard. And if you buy a hard drive, this is a really old hard drive, it has a place to plug in on the motherboard. And so the motherboard sort of connects everything together.
The hard drive is secondary storage. Now, the way, how secondary storage is different than the main memory, which. There it is. I gotta unpile this stuff.
So this main memory is really fast, but as soon as you turn the power off of this memory, it sort of vanishes. And so to store files like word processing files or text files or whatever, you gotta store it on something that lasts a little bit longer. And so that's the purpose of the secondary storage. It's permanent.
When the power's off, it stores it. Now this one here is in such bad shape, that isn't probably storing anything, but it's got these little heads, and it spins around and goes in and out. And we'll have a video later that shows you one of these things that's not quite in as bad a shape.
If you look, this has four different platters that are all spinning around. And so this is just using magnetic material and electronics that sort of magnetize and demagnetize this stuff. And if you look at a disk, they're often rated Physical disks are rated in revolutions per minute, and that's how many times this thing spins around. And if you got an old desktop and you hear it spin up, this is the thing that's spinning. And it's the place that your operating system lives, your files live, your applications live, while they're stored and while the computer's turned off.
And then they're loaded into this while they're running. Then this CPU takes the data from the main memory and your program runs at three billion operations per second. So. Let's talk a little bit about something that this is probably from the 1960s or 70s.
This actually has, if you're an electrical person, it has capacitors. Those little silver things are capacitors. These little colored things are resistors, and that's more capacitors.
And then there's wires, and wires move everything. And so when you say this has millions of transistors, wait. that isn't a capacitor, that's a transistor. That's a transistor. When you say that this here has etched, and if you look closely at this, go look at a picture of a microprocessor online, you will see that it has millions of these.
And so the difference between 1960 and today is this circuitry of capacitors, resistors, and... Transistors has been microized and put onto this. It's using a photographic process, and they're tinier and tinier and putting more and more on.
And if you think going from millions of these to one of these is crazy. the thing that's happening now, and the reason we have whole computers inside our pocket, is that everything, all of this, this whole thing, CPU, memory, everything, all of it connected, and the storage, is being... made smaller and smaller.
And so this little single board computer, called a Raspberry Pi, has one thing in it. And it has the main memory, and it has the CPU, it has connections for things like peripherals, like keyboards and stuff. Now it doesn't yet have secondary storage on it. the secondary storage gets plugged in right here via USB.
And then if you take it one step farther to my phone, it's got the secondary storage built right in. And so, you know, this picture goes from the size of cabinets in the old days all the way down. to really tiny. But at the end of the day, inside it is a highly sophisticated piece of circuitry that asks for instructions one at a time and main memory that holds the instructions and feeds them, okay?
Central processor does the thinking. Let's take a look here. Central processor does the thinking.
It runs the program. It's asking what's next. It's not really smart, but it's really fast. And so we compensate for the lack of intelligence of this thing.
by us writing really good software that runs really fast. And so voice recognition on things like phones is possible because computers have so much storage and they run so fast and the algorithms that do voice recognition are finally starting to work. Input devices like... keyboards and mice and pens and whatever, they come in. Output devices are like the screens that we see.
The main memory is the fast part of the computer that stores all the programs. And the secondary memory is the permanent storage. Increasingly, secondary memory, do I have any USB sticks in here? I don't. Well, increasingly secondary memory is flash RAM or static RAM with no moving parts.
And so in a few years you'll not even be able to see secondary memory with moving parts. But that's okay, it's still secondary memory. It's still memory that lasts. And so you and where your place is in here is you live in the main memory. This is you.
You are here. And so, in a sense, when the CPU asks the question, what next? It is your job to answer that. And you answer that by writing Python.
And so your Python code, you'll write a file in Python code, blah, blah, blah, blah, blah, blah, blah. And then that Python code sort of gets loaded into main memory. There's a magic translation process that happens. And then your code is actually answering this question through the main memory. three billion times a second.
Three billion times a second, you're sitting there. But this is you. You're really out here, but you then write a file and the file's loaded in and then the file runs. And that's how things are at.
And that's your place in the world. Now, what's actually running is not Python code. There is, as I said, a translation process. You write a Python file, and then Python itself translates this into the actual language known by The microprocessor, which is a series of zeros and ones called machine language.
Someday I would love to teach you a class on machine language, but for now we're gonna teach you Python and we're gonna use Python as a crutch. We don't have to talk machine language, but you could if you really wanted to, you could know how to write machine language. But I assure you, Python is far easier to learn than machine language.
So Python acts as a translator, translates what you're doing into machine language, and then the machine language is what's sent back and forth. But still, even though it's translated to machine language, it's you. It is you answering those questions, and that's what a program is, is you pre-storing your response to the what next question over and over again.
So here's a couple of videos that you can look at on YouTube about a CPU. These CPUs, and it looks very much like this CPU that I've got with me, these CPUs run extremely... high heat, when you put this thing, your computer on your lap and it starts to heat up, that means it's thinking really, really hard. And so this is a small little old video from a long time ago that shows what happens when you take out the cooling capability of microprocessors and just how hot they can be.
And the other video that I have is a hard disk, something like this hard disk that I have. except that it works and they turn the power on. Some of them last for a few seconds, some of them last for a few minutes. It's never a... I must be allergic to this hard drive.
Or maybe it's because there's dust in this hard drive and I keep spinning it and I sneeze. But basically, some of them last for a few seconds, some of them last for a few minutes. It's not a good idea to open them up, but I'm glad somebody opened it up and then.
did what they did and then recorded it so we can all enjoy what it is that they're capable of doing, okay? So that's a quick introduction to hardware, mostly so that I can use those words going forward. Now what we're gonna talk about next is communicating in the language Python, that is writing code and putting it into the computer so that that can execute, okay?