The Science of Everything Podcast - Episode 91: How Computers Work Part I - What is a Computer?

Episode Date: December 30, 2017

We begin our series discussing how computers work with an overview of the theory of computation, including a discussion of Turing machines and Turing completeness, and a brief history of early analog ...and digital computers. I also provide an introduction to the key components of a modern computer, and review the different levels in the hierarchy of computer organisation.

Transcript
Discussion (0)
Starting point is 00:00:34 You're listening to The Sides of Everything Podcast episode 91. How Computers Work Part 1. What is a computer? I'm your host, James Fodor. So, this is the first in what I anticipate will be a series of six episodes discussing the key principles behind how modern computers work. This is a series I've been working on for quite some time, and I'm really happy it's finally all come together. So in this series of episodes, we're going to be looking at how computers work from a reductionistic level building up to higher and higher levels of complexity.
Starting point is 00:01:10 So in this episode, I'll start by talking about the theory of computation and a little bit about the history of computers, what is a computer, and some of the key principles of computer organization. In the next episode, we'll look at how numbers are stored in a computer using binary coding, and we'll talk about the principles underlying semiconductors and how they're used to produce transistors. In the third episode, we'll look at how transistors are used to build logic gates, and how logic gates then are used to build various logic components,
Starting point is 00:01:40 which are able to carry out operations in Boolean algebra that are used in making computer operations. In part four, we'll look at the processor architecture and talk about the von Neumann architecture, how the processor is put together from underlying logic components, and we'll also talk about the instruction set architecture, which is a set of operations, that essentially defines the basic things that a computer can do. In part five, we'll talk about machine code and how that is assembled from a higher abstraction called assembly language. We'll talk about some performance improvements
Starting point is 00:02:16 that can be made to help processors run faster, and we'll talk a bit about the underlying principles of the operating system and how input and output works and how our memory is managed by the operating system. In the sixth and final part of the series, We'll talk about higher-level programming languages, a little bit about how compilation works, and give an example of how you might implement a simple game in a higher-level programming language to give you a sense of that.
Starting point is 00:02:42 And also we'll sort of summarize and put together everything that we've talked about in the six episodes. So hopefully you find this interesting and informative. And without further ado, let's make a start and talk about what is a computer by starting with the theory of computation. People use the word computer all of the time these days, but I think that most people don't have a really good idea about what actually a computer is. To start with understanding what actually makes something a computer, we need to talk about theory underlying computation. And to do that, we have to go back and think about formal systems. So humans over their history have defined various formal systems and operations that you can perform on symbols to produce useful outputs. So simple examples of this include addition, subtraction, multiplication and division,
Starting point is 00:03:31 and logical operations like or and if-then statements. The basic idea here is that you take some symbolic inputs and you perform some operations on them, relatively simple operations we're going to focus on, and you get some output. And there's some law-like systematic relationship between the inputs and the outputs. And of course you can define any old arbitrary relationships that you want, But some of these key most simple ones that are most often used, like basic arithmetic and logical operations, have proven to be very useful for lots of practical purposes. So performing large numbers of these simple operations quickly after their discovery had become very important for human administration, record keeping, decision making, and all sorts of applications like this. So a very common application of these sorts of operations throughout human history has been in keeping track of stocks.
Starting point is 00:04:23 in terms of like how much cattle you have or how much food or grain you have in a given storehouse and also trading of goods or money between persons. That's a very important example. Many of these sorts of devices have also been used in navigation, performing calculations to determine routes and bearings that you should take and so on, and other such applications like this. So the key point is that in order to achieve desired outcomes in these sorts of spheres, it's useful to be able to perform. form large numbers of these arithmetic or logical operations quickly. Any device that is capable of performing or a human to perform these formal operations automatically, or at least partly
Starting point is 00:05:06 automatically, is called a computer. So computers can be made out of anything, any materials, and computers can be designed in a wide variety of ways for different purposes. So an example of a computer is a slide rule. Probably most of my younger listeners haven't used a slide rule. rule before. I haven't actually used one myself, although I've read about them. A slide rule is a mechanical analog computer, though they were first developed in the 17th century. It's used mainly for performing multiplication and division, but you can also use it for calculating functions like exponents, logarithms, and trigonometric functions. The basic idea of a slide rule along with other mechanical analog computers is that the physical relationships between different components
Starting point is 00:05:48 along the dial as you slide them relative to each other maps systematically to or corresponds systematically to the mathematical relationships or formal relationships that you're interested in. So that's how an analog computer works. You physically manipulate some components relative to each other and read off their relative position or orientation or whatever it is on the dials of the machine, and that gives you an answer to some abstract formal relation or arithmetic operation or whatever it is that you're interested in. Another example of an analog computer is an abacus, which is used to aid in counting and adding. So you probably haven't thought of a slide rule or an abacus as a computer,
Starting point is 00:06:28 but understood in this way as a device that aids in the automatic performing of arithmetic and logical operations, these devices are clearly computers. Now, during the first half of the 20th century, many scientific computing needs, and also in business applications, were met increasingly by more and more sophisticated analog computers, which again used a direct mechanical or sometimes electrical model of the problem as the basis for computation. I even know in the field of economics and finance that some of these types of analog computers were used. In fact, famously there was a, I think in New Zealand,
Starting point is 00:07:03 it may have been an economist built a system that was trying to model flows of money in the economy using water flows in a complex system of pipes. So that's another example of an analog computer. However, the trouble with these early computers is that they weren't programmable. That is that they could generally only perform a set certain type of operational or computer certain type of function for a specific purpose that they were built. And so they lacked versatility and also they lacked the accuracy of modern digital computers. Around this time, around the early 20th century, mathematicians also began to wonder about the limits and the performance abilities of these early computers. And they tried to formalize the ability of these early computers to perform
Starting point is 00:07:48 operations and to compute functions. A function is just a mathematical. or relationship between inputs and outputs. So another way of describing computation is to explain it as calculating functions, mapping inputs to outputs. So, you know, just adding numbers together is a simple example, or it could be more complicated than that, like calculating a logarithm. So in 1936, Alan Turing, whom you've probably heard of, he was a famous British mathematician and computer scientist,
Starting point is 00:08:12 he presented an abstract model of computation, which is now called a Turing machine. So the basic idea of a Turing machine, again, the important thing to understand is that he's, an abstract description of what computation is or how you can understand computation. It's not supposed to be a real physical device, or you could build it and people have, but that's not really the point. It's an abstract description. So the idea is that there's an infinitely long tape.
Starting point is 00:08:38 If you don't like the idea of a tape that's infinitely long, you can think of a very long tape that is arbitrarily extendable. And on the tape are marked out squares. In the squares you can print any of a set finite number of symbols. So it doesn't really matter what the symbols are. You can think of them as numbers, letters, Chinese characters, whatever. But there has to be a finite number of them. And the machine has a head that sort of sits over the tape and is able to move the tape, a set number of squares
Starting point is 00:09:07 in either direction to the left or to the right. And the head also is able to read whatever symbol is currently on the square of the tape that's right underneath it. It can read the symbol, it can erase the symbol, and it can write any new symbol of the set of defined symbols that it works with onto that square. How you program a Turing machine is you have a table, a look-up table in a sense, which says that when the machine is in state A, and then when you read symbol 1, do this,
Starting point is 00:09:38 and the particular action could be moving to the right or moving to the left and moving into a different state and reading or writing or erasing a given symbol. So those are the possible actions. You can move one square to left, you can move one square to the right, or you can not move at all, and also you can write or erase any symbol that you see only on the current square. And the third type of thing you can do is change state. So the states are not, that doesn't refer to the position of the head over the tape. A state is an abstract description of the state of the machine, which essentially allows it to do different things in different contexts.
Starting point is 00:10:12 So there could be three states, there could be a million states. As long as there's a finite number, that's all allowable. So, for example, one state could just be the read state that we're in every near that. Whenever the machine is in that state, it just always reads whatever the symbol is on the square that it's over. A different state could be the right state where it always writes a certain symbol onto the square that it's underneath. And you could have more complicated states as well. Each state is just defined by the actions that the head takes when it sees each particular symbol. The complete program of the machine is just defined by a set of states, however many you've got.
Starting point is 00:10:46 Let's say there are ten states. In each of the states, you have to define the action that the head will take given any particular symbol that could appear on that square. So if there are 10 possible symbols and 10 possible states, your table will be 10 by 10, so 100. And the actions will be some combination of erasing, writing a possible symbol, moving to the left, or moving to the right, and changing states. So that might sound like a lot, but really there are only a few basic simple actions. Moving the head to the left, moving to the right, erasing a symbol, writing a new symbol, and changing states. and that's all determined just by the current state that the machine is in and the symbol that it sees on the current square of the tape.
Starting point is 00:11:23 That is, according to Turing, capable of computing any function that you could want to have computed. Or more specifically, actually, what Turing's hypothesized is now called the Church Turing thesis. Church was his sort of supervisor. The Church During thesis states that any effectively calculable function can be computed by some Turing machine. Remember, a Turing machine in the abstract is just a type of machine that has a ticker tape and a head that reads symbols.
Starting point is 00:11:52 The exact program that you put into the Turing machine determines specifically what Turing machine it is. So there's effectively an infinite number of possible Turing machines depending on how you program them. So what the Church Turing thesis says is that any effectively calculable function can be computed by some Turing machine, or if you prefer some appropriately programmed Turing machine. In other words, there's no calculable function that an appropriately set up during machine wouldn't be able to compute. You may be wondering, well, what is meant by this term effectively calculable? And that's sort of where the crux of this thesis is. The church-stering thesis is sometimes thought to be a theorem that is something that's been proved in mathematics or computer science.
Starting point is 00:12:34 But that's not correct. The church-during thesis is a hypothesis. And the reason it can't be proved, well, it hasn't been proved in fact can't be proved, is because the notion of effectively calculable cannot be formalized, or really it's a concept that eludes precise mathematical formulation. The basic idea that Turing had of the notion of effectively calculable is that it's something that a mathematician could sit down and with a pencil and paper and enough time and enough paper,
Starting point is 00:13:02 they'd be able to compute by hand by formal means, but relatively simple underlying procedures like ultimately arithmetic operations or other mathematical or logical manipulations. So that's sort of Turing's intuitive idea of effectively calculable. You can figure it out using pen and paper, given enough paper, and given enough time. At least in principle, of course, it may take 20 billion years to compute some particularly long and difficult functions. But the point is you would eventually get there, and you would eventually get there
Starting point is 00:13:31 through a sequence of logical operations. That's an intuitive informal notion, so you can't formally prove anything that you can do using that means is doable on a Turing machine. But it's thought that that is the case. That is it is thought that the Church's Turing thesis is probably true. That is anything that you can calculate using a pen and paper in enough time, you could compute on a Turing machine. And the reason that it is thought to be true is because Turing only presented one,
Starting point is 00:14:01 one abstract model or theory of computation. That's his Turing machine that we just talked about. But there are many others, many other people over decades, have presented different formal models of computation. The Lambda calculus and push-down automata are two famous examples. And I won't talk about what those are, but they're just very different formal models of what it means to compute something or to carry out a computation. Now the key point is that it's been proved,
Starting point is 00:14:28 I'm pretty sure that Turing proved, or perhaps it was church, but anyway, it has been proved that all of these different models of computation that have been presented are actually equivalent to each other. So that is anything that you can compute, using the Lambda calculus, for example, you can also compute using an appropriately programmed Turing machine, and likewise for push-down automata, and likewise for many other theories of computation that have been devised. So they've all been proven to be equivalent. So this is a theorem. This is something that's been proved mathematically because each has its own precise
Starting point is 00:14:57 mathematical definition, and you can prove essentially that what you can do on one, you can do on another if you just program it the right way. So all of these different formal models have been proven to be equivalent. And that leads people to suspect that there isn't anything else beyond these set of algorithms or computations that can be performed by these formal systems, the Turing machine, the Lambda Calculus and everything else. Because no one's been able to devise a formal system that can compute something that the other ones can't. So that lends us to think that the Church Turing thesis is probably true. So basically the church-turing thesis is essentially saying that anything that you can compute,
Starting point is 00:15:32 a Turing machine can compute. And one way of proving that wrong would be to devise a formal model of computation that can compute something that a Turing machine can't. But no one's been able to do that. Every time someone's tried, it's been proven that the Turing machine and appropriately programmed to Turing Machine can in fact compute that same thing.
Starting point is 00:15:49 Note that the Turing Machine is not making, what a Turing machine can compute is, that's not a statement about how long it's going to take or how efficient it's going to be at performing the computation. It might take a very long time indeed, and it might be very inefficient, and you might have to have a very complicated program.
Starting point is 00:16:05 But as long as it finishes in a finite number of steps, then that counts as having performed the computation. That's really the only requirement. It can't take infinitely many steps. So that's the basics of the church-sturing thesis. If some of the details were a bit confusing, the basic idea is, as far as we know, and most computer scientists now think that this is the case,
Starting point is 00:16:26 anything that you can compute, you can compute on an appropriately programmed teeturing machine. Now that just means that a touring machine, therefore, is a very useful abstraction for thinking about computation, for thinking about performing these logical operations. mathematical operations. Now I will note that there are functions that are known to be unable to be computed by a Turing machine. One example is the famous halting problem. Given an arbitrary program,
Starting point is 00:16:48 can you tell me whether a Turing machine running this program will eventually halt or not, or whether it will run forever? It turns out that it's impossible to compute that, basically because if a program would have run forever, then you'd never be able to tell that, because you could always say, well, what about if I take one more step, if I perform one more operation, maybe it'll halt then. And you can always say that effectively to infinity. So there's no way that you can, in a finite number of steps, verify that a program never stops. So there are some functions that are not touring computable. Furthermore, there are also abstract descriptions of some machines that can compute functions that are touring machine cannot. Basically, all of these abstract
Starting point is 00:17:29 machines or descriptions of these machines require things that, as far as we know, are impossible, like an Oracle that can sort of just magically determine whether a given program holds in a finite number of steps, or some device that can perform infinitely many steps in a finite period of time. Things like this. You might wonder why computer scientists bother about thinking about such absurd things. It's potentially useful for their abstract formalizing to imagine if we had such things. The point, though, is that no actual detailed design or constructed device has ever been shown to be capable of performing any computation that cannot also be computed on a Turing machine, nor has anyone been able to
Starting point is 00:18:09 devise a theory of computation that doesn't rely on these sort of magical ideas that is able to compute anything that an equivalent Turing machine couldn't. So the upshot of all this is that as far as we can tell, a machine that can simulate any Turing machine is capable, in principle at least, of carrying out any computation that can actually be performed in practice. This gives rise to the term of a machine being Turing Complete. This means that it is as powerful as we can reasonably ask it to be, or it can perform any computation that can in fact be performed in a finite number of steps. So a Turing Complete machine can do anything that any other machine can do, at least in principle.
Starting point is 00:18:49 Remember, this doesn't say anything about how long it will take. It may be impractically slow to perform these computations, and it may require huge amounts of memory, but at least in principle, it would finish in a finite number of steps, and so it is powerful enough to perform that. So what we're really interested in when we're talking about computers is not these various mechanical devices like an abacus and slide rules that can help us perform formal operations.
Starting point is 00:19:14 Those are interesting and useful. But what we're really interested in are Turing Complete computers, that is devices that can perform, at least in principle, any formal operation or compute any function that can be performed in a finite number of steps. Those are the really interesting devices, because they're the general-purpose computers that effectively you can do anything on, again, at least in principle.
Starting point is 00:19:35 Now, it's actually surprisingly easy to design a Turing Complete Computer, again, at least in general terms. There's another theorem from computer science called the Structured Program theorem. It was proved in the 60s. We won't go through the details of that, but the point of it is that the structured program theorem proves that a programming language can compute any computable function as long as it can combine together its operations
Starting point is 00:19:57 in all of three specific ways. These are called control structures. The three ways that it needs to be able to use in order to be true and complete are first, sequential operation. That is, it executes one operation and then it executes another. The second type of control structure that it needs
Starting point is 00:20:16 is selection. So that is, it determines which of two possible operations to perform according to the value of some expression. So if the value comes out zero, it performs one thing, and if the value comes out one it performs some other thing. That's essentially an if-then structure. The third type of control structure that it needs to be too incomplete is iteration, so that is performing some operation as long as some expression holds true.
Starting point is 00:20:43 This is a while construct, while something is the case, then keep doing this until it stops being the case and then stop. So if we have sequence selection, if then, an iteration, while until, If we have these three control structures, if a programming language is able to use those, then it will be Turing Complete. That is, it will be able to calculate any computable function. Obviously, that's not the exact formal version of the theorem. That's a sort of a layman's term summary, but it's good enough for our purposes. The key point of that theorem, and the reason I raise it, is that we want a Turing Complete machine. That's what we're interested in here, because it can do anything that any computer can, at least in principle.
Starting point is 00:21:22 And in order to get a Turing Complete machine, in fact, all we need are the Turing Complete machine, In fact, all we need are these three types of control structures. You don't actually need that much. So we just have to find a way of implementing sequential carrying out of operations, selections, so do this or do that, depending on some value, and iterations. So keep doing this over and over again until some expression fails to be true. So the basic idea, then, to get this during complete computer,
Starting point is 00:21:44 is define a relatively small set of basic simple instructions and then build more complicated ones out of that. and we have to find a way of constructing this in a real physical machine that carries out these simple instructions in a set specific order in accordance with these control structures that we have. If we can figure out a way of doing that, then we will have a real physical Turing Complete computer that can perform any formal operation or any function
Starting point is 00:22:10 that can be completed in a finite number of steps. So even when we're talking about Turing Complete Computers, sometimes more informally called programmable computers, some computers are programmable without being true incomplete. But the basic idea is that these computers are ones that you can input a program into and combine the basic instructions and operations together in such a way that you can compute in principle any function that you like, given enough time, of course. So these are the computers we're interested in. But even considering just these type of computers, there's still a bunch of different ways you can build one.
Starting point is 00:22:46 There was a British mathematician in the mid-19th century called Charles Babbage. And he designed, he didn't actually build, but he designed a series of machines that, at least the most advanced of which called the analytical engine, is thought to have been Turing complete. So, effectively, it's the type of computer that we've been looking for. But it was very different, or it would have been very different to any computers that we have today. It used a decimal number system instead of binary, which we'll get to in a moment, but it was also mechanical. It worked using gears and levers and other mechanical devices rather than circuits and transistors and switches and electrons flowing through wires, which underpin the operation of electronic computers today.
Starting point is 00:23:32 So really a completely different underlying design, but still Turing complete. Remember, he never actually built this, although sort of smaller versions of it have been built, essentially because the parts that he would have needed would have been too expensive to machine in the precision that was needed for the time. So this never went ahead, but he was certainly a visionary. Because of the need to be able to precisely manufacture
Starting point is 00:23:53 large numbers of small components and fit them together in the right way, and also the need for the underlying theory to be appropriately developed, computers didn't really, cheering complete computers that we're talking about, didn't really start to be constructed until the 1940s. Around the 1940s, a number of these early devices were built or started to be built in the UK, Germany and in the US. Most of these early devices were electromechanical, so that is they used a combination of
Starting point is 00:24:23 electric circuits and mechanical relays, which is a mechanical device that actually physically moves in order to turn a switch on and off. These days, however, when we talk about computers, we don't really think about, we certainly don't think about Charles Bammage's cogs and gears, and we also generally don't think about these electromechanical relays or vacuum tubes, which is another mechanism that was used to implement switches in these other computers. Rather, we think about electronic digital computers. The first fully programmed, so Turing Complete, digital, fully electronic computer was ENIAC, which stands for electronic, numerical, integrated and computer. It was built for the U.S.
Starting point is 00:25:04 military in 1946. It was about the size of a large room. It weighed 30 tons, and in today's money costs about $6 million. Its processing power was trivial. A small digital watch would have more computing power today than it did. But nevertheless, it was the first modern computer, modern in the sense of being Turing complete, digital, so it used discrete values rather than the continuous analogue values, like is used for example in a slide rule, and it was fully electronic, so there were no mechanical moving parts in the processes. So importantly, it didn't use mechanical relays. There were some earlier computers that did use relays, but that meant they were electromechanical and not fully electronic. Eniac, therefore, was
Starting point is 00:25:44 the start of, in a sense, the start of the digital age and from the sort of mid-40s onwards many more of these types of machines were built and increasingly refined. These early digital computers used vacuum tubes of switches. So they're electronically operated, so not mechanical, but still not the same technology as we use in our current computers. Later transistors were used, I'll talk about transistors in the next episode, these are smaller and cheaper and much more reliable. In 1971, the first integrated circuit microprocessor was produced. An integrated circuit is when you have many transistors incorporated on a single piece of silicon.
Starting point is 00:26:20 Integrated circuits are also called microchips or micro-processors, and that's what form the underpinning of essentially all electronic devices today. So the first of those was produced in 1971. That was the Intel 4704. This was the first in a long line of Intel processes that still power most of our personal computers today, the most recent iterations being the Intel core I3, I5, and the I7 series. So they stem in a fairly direct lineage from the 4-004 from 71.
Starting point is 00:26:51 The first personal computers that we think of as a computer, a box, a monitor, and a keyboard, these were developed in the late 1970s. The key components of a modern desktop computer are the CPU, the central processing unit. That's where, that's the real sort of guts of the computer, if you like, which we'll spend most of our time talking about. The main memory, or RAM, random access memory, a hard disk drive, the graphics card, the power, supply unit, which is a big box that supplies power to the rest of it, and various other
Starting point is 00:27:21 onboard connectors and peripheral devices that you plug in. All of these components connect to each other and are slotted into a big, well essentially big silicon wafer called the motherboard. So if you were to open up a computer box or open up your laptop as well, although laptops are a bit different because they have to be a lot more compact, but just a regular desktop PC that still has one of these boxes, if you were to open that up, you'll see that There's this big, essentially, silicon sheet in there. That's the motherboard. Attached to the motherboard will be a huge box that will have masses of wires coming out of it.
Starting point is 00:27:55 That is the power supply unit. That is what the cord that plugs into the wall and gets power to the device, will be plugged into that. Essentially converts the alternating current that comes in from the wall to the appropriate voltages, currents, and direct current format that's used for different parts of the. the computer. So that needs to be managed very carefully, otherwise you'll fry the components of the computer. So obviously that has to be, that's a very important part of the computer, but we won't be focusing on that because that's more the electrical side of it rather than the
Starting point is 00:28:28 actual computational side of it. Another thing that you'll see, if you were to open up your computer box, will be big fan that sits on this sort of square box thing. If you were to take off the fan underneath, you'll see this big sort of sheet of metal string. metal strips. That's a heat sink. The purpose of the fan is to cool down the heat sink, and the purpose of the heat sink is to try and have more surface area to release heat. If you take off that heat sink, well, you'll find a bunch of glue, which you can sort of try and clean off, that connects the heat sink to the processor. But that's what, that's essentially what's sitting under all of these, the fan and the heat sink, is the central processing
Starting point is 00:29:08 unit, or the CPU. That's the heart or the brain of the computer, if you like. That performs the key computations. And again, most of what we'll be talking about in this series of episodes is what that processor is doing. Because it runs at such a high clock speed, that is, it's ticking over billions of times every second, and there are so many transistors in there, it generates a lot of heat. I think about as much as 100 or 150 watt light globe. So if you know what that is, that's a lot of heat. That's a lot of energy being released there. So that's why you need the fan and the heat sink there. There are also, other devices that you can see on your motherboard. You'll see long slots with these sort of fairly
Starting point is 00:29:47 wide and thin cards stuck into them and they have sort of these switches on the ends. These are your RAM slots. That's where the main memory sits in. Probably you'll see that two of them are filled and two of them are empty. Usually desktops will have some extra expansion slots that you can put more RAM in, perhaps in your machine they'll already be filled. You'll also see some other slots that are a bit fatter and a bit further apart. These are your PCI or PCIE slots. These are for expansion cards and other things that you put in. You might have one taken up for your modem. Another one might have your graphics card in it. You may have other things there as well, possibly a sound card. These are essentially controllers that handle the input and output for extra peripheral devices, like again a modem
Starting point is 00:30:30 or a sound card or graphics units. There will also be a bunch of other connectors and devices on the computer, little chips that control access to devices. You'll see these. These are knob things, little cylinders that stick up. These are capacitors. Compacitors, an electric device that stores a charge. So they use for mediating flows of current around the motherboard. You'll see also a few of these rings that have sort of wires around them. These are inductors.
Starting point is 00:30:57 They are also used for managing the flow of current. There are a few other bits and bombs as well. But those are the essential details of the components that you'll see in a desktop computer system. So again, primarily what I'll be talking about in this series of episodes is the processor, a little bit also about the main memory, because that's an important sort of adjunct of the processor. Most of what you actually see when people talk about a computer, when they think of it as a device, as an object, is actually not the heart of the computer. It's actually the peripherals, so the keyboard, the mouse, the speakers, the monitor.
Starting point is 00:31:33 Those things are what we call peripherals or input and output devices. They help us interact with the computer, tell it what to do and receive feedback from it, but they don't actually do the computations themselves. That's really done in the processor, and also, to a certain extent these days in the graphics card, the GPU unit. The computer itself is really the processor and its connections to the RAM, not the peripherals that it connects to. You can, of course, have computers in many different types of devices, so not just desktop computers, but also laptops, touchscreen devices, so like iPads or smartphones. There are also other types of computers that we don't tend to interact with directly as much,
Starting point is 00:32:10 including embedded computer systems or microcontrollers. These are found in nearly all modern consumer devices, including microwaves, television sets, ATMs, all sorts of things. Cars these days have heaps of microcontrollers in them. You can't usually interact with these devices using input-output devices, or at least not in terms of what we think of it as an input-output device. So, like the buttons on a microwave, all you interact with the microcontroller in the microwave,
Starting point is 00:32:36 but we don't normally think of it as a computer in that sense. There's a computer in the microwave that helps it operate, and likewise for these other devices. They're usually quite specialised and programmed to perform just specific functions. At a larger level, there are things called mainframes, essentially servers. These are typically used. Either big companies might use them for performing key functions, like maybe managing a nuclear reactor,
Starting point is 00:32:59 or they're more often used these days as servers for, big websites that have to manage a lot of traffic. So essentially when you connect to a website, you send a signal to a server somewhere that's running the website, asking for a certain information from a certain address, you know, depending on what page you're going to. The server needs to process and information, find where that information is stored, and then send it back to you. And it has to do this for everyone who wants to connect to, or to load that page or to run that service, whatever it is. So the more traffic website gets, the more requests it needs to be able to serve, hence server, and so the bigger and more powerful servers it needs.
Starting point is 00:33:37 So a company like Google has just millions of computers all around the world that serves all of its search requests that it gets all the time. So there are lots of different types of computers, and they have different form factors, so different sizes and different particular arrangements. The underlying principles, however, to how they operate, are more or less the same. And so we'll be focusing more on the desktop side, personal computer desktop side, although, again, the fundamental principles are more or less the same. Now, as I mentioned before, modern digital computers use binary representation.
Starting point is 00:34:08 So all the information in a computer is represented as a sequence of zeros and ones, which are represented in the hardware in a manner that we'll discuss later. And so in order to make these digital computers Turing complete, what essentially we need is to construct hardware that's capable of manipulating these zeros and ones in accordance with those key control structures that I mentioned before, iteration, selection and sequences and sequencing. We need to figure out a way of doing that and also of accessing and storing information that we use for the program or the program outputs in memory. Obviously if we can't store the information that we're using, that's kind of
Starting point is 00:34:45 useless. So we need to figure out a way of incorporating that into hardware using these zeros and ones. And how we do that will be the subject of the next couple of episodes where we focus on the underlying hardware of modern digital computers. Before we finish out this first episode, a few words on computer organization. Now, as I mentioned, we've been building modern digital electronic computers for over 70 years now. So in that time, millions of programmers, engineers, scientists, computer enthusiasts, and huge corporations have spent countless hours and many billions of dollars building machines and also programming software that is more and more sophisticated, more complex, and capable of getting things done more quickly. So as a result of all
Starting point is 00:35:25 of this, the machines and software that we use today are exceedingly complicated. and intricate. So much so that no single person even comes close to understanding them in all of their full, gory detail. So no single person understands the exact circuit layout of the billions of transistors that are in a modern CPU chip. Likewise, no single person understands exactly the operation of the 50-some million lines of code that underpins Microsoft Windows. That's just too much. The way, rather the way that modern computer systems work is using a series of hierarchical abstractions. So the idea is that each layer in the hierarchy performs a different function or sort of set of functions. Each layer takes the layer that lies underneath it for granted. It abstracts the
Starting point is 00:36:11 details of that layer and only concerns itself with certain key principles. So, for example, in order to write a computer program, I don't need to know all of the layers that underpin that. I don't need to know details about the transistors in my computer or how they work. I don't need to know about the logic aids. I don't need to know about the micro-architecture of my computer. I don't even need to know about the instruction set architecture or how the compilers work that turn my high-level program into a machine language that the computer can actually run. Knowing about some of those things may help me write a better program potentially, but I don't really need to know about them because the key details are abstracted and sort of summarized
Starting point is 00:36:49 in a way so that the key components that are useful to me are incorporated into my level. So into the logical constructs in the programming language, for example, which is all I need to know about. How that's implemented at the lower level, I can sort of take for granted and ignore it, and just treat that as implementation of my higher level. So at the very highest level, you can use a computer, you can use Microsoft Word or Photoshop or an Internet browser without knowing anything about how to code how the programs are coded. And indeed, you can be a great programmer without necessarily being good at using a program like Excel or Photoshop. Conversely, you can be great at using the program, but not have a clue about how it's coded. So these are separate levels. They're different levels in the hierarchy, and they have their own different skill set. Likewise, you can be great at designing integrated logic circuits without necessarily knowing anything about the solid state physics about transistors,
Starting point is 00:37:37 or necessarily of being great at programming in higher level languages. In this discussion, I'm only going to focus on key concepts that are relevant to our task of understanding how modern, touring-complete, electronic digital computers work. many practical details and difficulties, implementational, precise aspects, and subtleties are going to be left out. So a lot of the stuff I say you have to take with a grain of salt in the sense that it's an approximation or a simplification. Though I have endeavored to make things as accurate as possible, but nevertheless, because of the huge complexity in machines that we actually use,
Starting point is 00:38:10 there's always going to be more details that we don't go into. So bear that in mind. I'm talking about a simplified version which preserves the key principles while obscuring and sort of ignoring a lot of subtleties and extra details. Also, I should emphasize that this discussion focuses on conceptual details to help you understand how a computer works. So the computer is not just a black box that works by magic. We're trying to understand the details of what goes on inside the computer
Starting point is 00:38:37 at the different layers in our hierarchy. I'm not attempting to explain how to build a computer or how to program a computer or how to design logic circuits. So this isn't a practical course in that sense. it may be useful having a sort of high-level overview if you want to pursue that as further study. Before we end out, I just want to go through some of the key layers of abstraction or levels of abstraction in the hierarchy of computer organization. Many books or courses that you look at on this are structured in more or less this way, because it's a way of breaking through the complexity
Starting point is 00:39:09 and trying to understand things one bit at a time, building up to more and more complex things. So at the most basic level are atoms and electrons, particularly silicon atoms because transistors are made in large part out of silicon. Why that is we'll look at in the next episode. The next level up are individual wires and also transistors, so transistors and the wires that connect them together. Obviously the properties of silicon and semiconductors, silicon is used because it's a semiconductor, the properties of these determine the properties of the transistors and the wires, and so we need to understand them in order to build transistors. that work properly. The next level up are logic gates. These perform logical operations using a combination of transistors and wires. So you need to know something about the properties of transistors and wires in order to implement the logic gates, but you don't
Starting point is 00:39:56 need to know all the details about them. The next level up again are logic components, like multiplexes, adders, and registers, which again we'll talk all about later. These are made up of logic gates. And so you put a bunch of logic gates together to make up a component, but you don't need to know all the details about how a gate is influenced. in order to make or use a component. The next level up again are functional units of the microarchitecture, so the CPU and the memory and input output devices. These are made up of logical components like multiplexes and registers, which in turn are made up of logic gates. The next level up and sort of bordering on the borderline between hardware and software is machine instructions or machine code.
Starting point is 00:40:34 This consists of a set of zeros and ones, which can be considered abstractly as a piece of software, or concretely as a piece of software, or concretely as a a series of bits encoded in hardware that tells the processor exactly what operations to perform. At the next level up from that is assembly language. Now we're in the realm of software. Assembly language is a symbolic sort of shorthand, if you like, for machine code. Next level up again, high-level languages like C and Java and Python, in which you program and are able to take advantage of shortcuts and easier ways of executing desired functions at a high level of abstraction than it's possible in assembly language. And ultimately, a high-level language will need to be compiled down into assembly language
Starting point is 00:41:16 and then assemble into machine language so that it can be executed on the functional units of the hardware using the components of multiplexes and registers, which in turn are made up of the logic gates and, in turn, made up of transistors. At the very highest level, we have applications, like Microsoft Word or Internet browsers, which are programmed in high-level languages. So, from applications, high-level language, assembly language, machine code or machine instructions, functional units like a processor architecture,
Starting point is 00:41:46 components like multiplexes and registers, logic gates, transistors, and down to individual atoms and semiconductors. These are the levels that we're going to be focusing on. I'll be focusing more so on the hardware than the software, largely because a lot of the software stuff is programming details that don't lend themselves too well to discussion in an audio podcast, though I will talk a bit about software level. I won't really say anything about applications, but pretty much all of the other levels that we discuss right from the level of properties of silicon semiconductor atoms all the way up to high-level programming languages, I will discuss giving the key principles of how they work
Starting point is 00:42:23 and how they fit together and how we sort of build on them from the bottom up in order to construct a modern Turing-complete electronic digital computer. So that's all for this episode. Hopefully that set the groundwork thinking about what a computer is, and the different levels in the hierarchy, which will be useful for then beginning in the next episode when I'll talk about how we go from silicon semiconductors to building transistors.
Starting point is 00:42:49 If you enjoyed this episode, please consider giving the podcast a favorable review on the aggregator of your choice. iTunes is still popular, but there are many others as well. You can also give me an email. Fods12 at gmail.com. FODS12 at gmail.com is my email address. feel free to send questions, suggestions, feedback, or anything else that you may wish.
Starting point is 00:43:13 I love hearing from my listeners. So, thanks for listening, and I'll talk to you next time.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.