Home / IT & Computer Science / Coding & Programming / Programming for Everybody (Getting Started with Python) / Chapter 1.2 – Hardware Overview
Chapter 1.2 – Hardware Overview
Welcome back. Now we’re gonna talk a little bit about hardware architecture. You might ask yourself sorta why all these terms and words and central processing unit. What I want from this section is I just wanna define a few terms, so that I can use them in the rest of course. That’s really it. I want you to have some sense of the basic block diagram of things. Now in the old days, I’m gonna show you three generations of hardware. I’m gonna show you really old hardware from the 60s and 70s. I’m gonna show you sort of medium old hardware from the 90s and early 2000s. And then I’m gonna show you sort of super brand new hardware.
This is a Raspberry Pi and it’s the kind of highly integrated hardware that goes into things like the cellphone. So I’ll kind of be going back and forth between three complete generations of hardware. But the picture and the concepts that I want you to understand are these terms, central processing unit, main memory, secondary memory, and input output devices. So we’ll start with input output devices. They are the way that this computer accesses the outside world. So things like the mouse, the keyboard, right? I got a keyboard here. Keyboard, screen, all these things. I don’t wanna mess up the keyboard there.
And so these are the input output devices, that’s okay, I just mess up a little bit, no problem at all. Output devices, screens and that’s sort of how the humans in the outside world interact. Software, inside the computer we have the central processing unit, and the main memory, and then the secondary memory. And so it’s probably easier for me to take neither the oldest nor the newest to give you a sense of what’s going on here. And so if you had a desktop, and maybe you still have one of these junky old desktops at home. They’re the ones that are big and they make noise when they start up. They have in them a number of different parts.
And the closest thing that a computer has to intelligence is this, central processing unit, CPU is what we call them. And if you look at the back side of this CPU, it is actually a circuit. It’s a highly sophisticated circuit with millions of transistors on it. And you probably heard that, millions of transistors, it runs maybe three billion instructions per second. What does that mean? Well that means that an instruction is a set of electrical pulses, maybe 32 little wires or 64 little wires. And at three billion times a second, this is programmed to ask what’s next, and it pulls what’s next in these little electric wires. Well where does it get the answer to what’s next?
It gets the answer to what’s next out of the memory. And so your program, when you write a program, let me draw this. When you write a program, you create a file on the secondary member, like a Python file. And then at some point that is loaded into the main memory, translated, and then your program is here. And then when the CPU says what next, your program feeds its first instruction. And then when that’s done, the CPU says what’s next, it feeds the second instruction, third instruction, fourth instruction. It’s called the fetch execute cycle. And these two parts, the CPU and the main memory are what participate. And the main memory is where you kind live.
Somewhere in there a little tiny version of yourself is in there answering the questions that this is asking. Now you might say how smart is this? It’s not really very smart at all. It’s a really fast hand calculator with lots of storage. It’s the best way to think about it. And going back to the 60s and the 70s, this is a piece of hardware from a computer that was the size of a room with probably 20 refrigerators, all with modules that make this up. And in here, well, you probably can’t see it. You’ve got resistors, transistors, and capacitors, and then wires. The wires are all printed on this printed circuit board, otherwise known as PCB.
And so the closest thing this has to intelligence are these transistors. And at their simplest, what they can do is they can sort of make really simple yes, no decisions. And then they also can be used if you hook them together the right way to store a little bit of information. And so, when we say there are millions of transistors packed into this little tiny square right here, it’s kinda pretty. I mean, if you look at it, it looks almost like a jewel. It’s so pretty. And each one of those is a real tiny photo imprinted transistor, and so there are millions of this.
And so the difference between 1960 and today is this part gets smaller and smaller and smaller to the point where literally thousands of these things are all squeezed in to that little square. And coming back to sort of the mid grade one. So this one here is the mother board. This part here is the mother board cuz it’s the mother of all boards and it connects everything together. All of these components plug in and that’s how they’re connected together, and there’s a whole bunch of wires that go back and forth on this, and so this is how your program in a sense is transported from the memory to the CPU. And so this motherboard connects them.
Another thing that’s connected to the motherboard is secondary storage. Now, the reason we have to have secondary memory or secondary storage is this is designed to be really fast. The main memory is super fast and what happens is when the computer turns off, your program is erased from here. And so I originally said that you write your program and you put a file in here, a py file. And this is the same place that your Word files are and PowerPoints are. And then, the py file is kinda loaded and translated into the main memory. And then, when the computer shuts off, all this data goes away. Secondary memory is permanent, this does not get shut off.
And so, in the old days, this old day stuff. We use to store on our programs and our files on a hard drive. And you may even have a computer at home where there’s an actual physical spinning platter of magnetic media and a little head that goes in and out to read and write the data. And so, it actually records magnetically when you put a file in, it records it, and then when the power’s off the magnetic recording stays here. And so these things, physical disk drives are kinda becoming extinct because all the data is in little USB sticks like this, and that’s a perfectly good version of secondary memory.
But at least for us, we can look at these beautiful antique mechanical gadgets that we use to store data magnetically when the power goes off. Now this one here is pretty broken, and it’s in pretty bad shape so it’s probably not storing much of anything. So in a summary of this picture, the thing I really want you to get out of this picture is a series of definitions. The central processing unit is very simple. It’s the closest thing computers have to brains. But it wants to answer the question what to do next, but we have to feed through memory the answers, which is your programs.
And then we have input devices, output devices, the main memory, and then the larger permanent storage in the secondary memory. So where you live inside of a computer is basically in the main memory. When you write a program, you type it in the computer. You outside the computer are typing on your keyboard and you’re typing Python commands into a file. Like if x is less than three print, right? And then that gets loaded into the main memory. And so you, this is a creative version of yourself, it’s your instructions that are gonna be run, and that program ends up in the main memory and then it’s run.
So this is sort of where you live inside the computer, let’s think of it that way. You’re living in main memory when your program is actually executing. Now it turns out that the instructions that this central processor uses are a series of zeroes and ones. And when I said like 32 zeroes and ones or 64 zeroes and ones, simultaneously, are fed into this for each of the instructions. We use a language called machine language. And I would love someday to teach you machine language. But we don’t have time right now, and that’s more moving towards being a computer scientist, when you start learning machine language. But basically, we don’t have to worry about that too much.
We write Python, and we write in Python and then something effectively translates it into machine language, and then machine language is the thing, that runs and runs and runs. Someday you might take a look for that, but that’s more of a computer science thing. And the software that does this translation, which is either called a compiler or an interpreter. We could talk more about that when you become more of a computer scientist. But for now, we’re gonna worry about how to write this code and the rest of this sort of is going to fall by the wayside as we go forward. So, I got a couple of videos here. This one video, hopefully the YouTube URL is still good.
If not, we’ll try to find another way to get you a link to a good copy of it. But basically these, as I said, there are millions of transistors in one of these things and there’s a lot of electricity going through these things. And when your computer heats up on your lap, it’s this little part here that’s working really hard doing things three billion times a second. So someone has made a video, not a very good video, but it’s from a long time ago, where you take the cooling part off and you watch what happens to these CPUs when they’re doing all this work three billion times a second using all this electricity and they’re not properly cooled.
Another cool video that we have is a video of hard drives and how they actually spin in reality. This one is totally messed up because I’ve been beating on it for years and playing with it, using it in all my classes for years. So it’s in really bad shape. But this video shows you how that works and how it actually spins in reality. And you’ll hear noises that if you have or had a desktop computer, you’ll kind of recognize the noise and then you’ll have an idea of what’s going on inside that computer as that secondary storage is moving around.
And like I said, secondary storage is becoming less and less relevant as we moved to solid state storage like the kinda storage that’s in a USB stick. So up next we’re gonna talk about how we write that Python. I talked a little bit about the hardware now, and now we’re gonna get started writing some Python.
Share this post
Share this post
This article is from the online course:
Programming for Everybody (Getting Started with Python)
This article is from the free online
Programming for Everybody (Getting Started with Python)
Reach your personal and professional goals
Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.
Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.
Register to receive updates
Create an account to receive our newsletter, course recommendations and promotions.Register for free