Programming code tells the computer to do something, but what makes the code actually mean anything to the computer?

1.25K views

Programming code tells the computer to do something, but what makes the code actually mean anything to the computer?

In: Engineering

36 Answers

Anonymous 0 Comments

At the end the compiler takes the english written computer code and turns it into assembly code. These are series of instructions that the core processing unit understands in a way that it can send out electrical signals to specific parts of the computer. 1 means 5V 0 means 0V. To handle the logic there are things called flip-flops (yes, funny name). These are actual electrical circuts that handle the basics of logic. Even you can easily build one as they are really simple. (Few wires, switches)
The thing is that you need to make these extremely small so that a small cpu can be powerful enough in such a small device.

Anonymous 0 Comments

The code you write is translated into 1s and 0s which represents on and off signals. The CPU is the primary component in your computer that determines what your computer does and the CPU consumes these 1 and 0 signals. It has input connections and output connections that takes signals in from one end and send out results from the other end. The input signals are instructions from the code and the the output signals tells your computer hardware (i.e. monitor, memory, gpu) what to do.

The CPU is one large network of switches (transistors) and they all take input signals and send out signals to other switches. Some CPU has about 1.5 billions such switches and they are all organized to produce the desired output signal when a set of input signals goes into the CPU.

Ultimately what makes the code actually mean anything to the computer is how the CPU manufacturer organizes the CPU switches (transistors). This is also the same for all other computer chips in your computer.

Anonymous 0 Comments

The computer, unfortunately, speaks only the electric language so to communicate with it, programmers needs a way to translate what they write (0 and 1) to electric current, which thank God is ready set up in the computer.

Since nobody likes to write a precise 1000 or more serie of 0 and 1 (swapping a 0 to a 1 completely changing the instruction the computer hears), we use what’s called “higher level programming language”. Those languages accept text (or even emoji sometimes, if you make aliases) and they range for simple instructions like “Put 5 in that space of memory” (in what’s called ASeMbly language) to complicated stuff like “sort that list”.

If you take the C++ language for instance, you write in English and in Math and then the computer runs the text you wrote to a program, the compilater, which will translate it into Assembly language, which will then be translated to 1 and 0 which will be then translated to electric current

Programming languages are always being translated to lower and lower levels until the machine can finally understand it

Anonymous 0 Comments

Most people are misinterpreting the question.

The code itself is made in a way that when fed into the cpu, the cpu will interpret everything into its own instructions.

Retrieve x from memory, retrieve y from memory, add x to y, ask the chipset for access to a resource, etc.

The cpu, gpu and igpu all take data that’s created to tell them what to do. The gpu will form images and send them to the monitor, the cpu will compute things.

Anonymous 0 Comments

Read this all in Jeff Goldblum’s voice, because I’m watching his stupid Disney documentary so that’s how I wrote all this. I think it will be the most fun but accurate to read without being overwhelming out of these answers. If English is not your first language, let me know and I can post it again but more simple and still fun.

Good lord, there seems to be a bunch of computer scientists in here. These answers are generally all right but I don’t think they get down far enough to the physical level of what you’re wondering. You’re asking for bottom up but you’re getting top down. Electrical guy here. I’m not a very good electrical engineer but I would be worth dogshit if I couldn’t explain how we get from atoms to Youtube videos. My electronics professor loved to say “digital is just a special case of analog”. So with that in mind:

The basic building block of all electrical circuits is the **transistor**. If you hear about “tubes” with old electronics, originally transistors used to be giant glass tubes with the air sucked out. Today we have **MOSFETs** — Metal Oxide Silicon Field Effect Transistor. You don’t need to know what it means, it’s just fun to know, like knowing what DNA stands for.

MOSFETs are tiny tiny tiny microscopic pieces of silicon and other stuff. Very very complex. Centuries of engineering and math and physics and chemistry and quantum mechanics and manufacturing and ingenuity have all led up to it. It has to do with molecules with too many electrons, and molecules with not enough electrons, and then building a sort of, I guess, cake out of them. Layers and pieces constructed just right to do what you want at a microscopic level so electrons move as you guide them.

The entire modern world is made of these, built on clever tricks by an Egyptian and Korean American scientist at AT&T’s Bell Labs in just 1959. Not that long ago really, Hayao Miyazaki and Bernie Sanders wouldve been 18 around then. What’s nice is that these guys (the scientists, not Miyazaki) had never worked with this stuff before but quickly gained a knack and somehow solved problems scientists could only dream of. Never underestimate a fresh pair of eyes. Look up Heaviside or Ramanujan when you get the chance.

A transistor is a switch, but instead of needing to press or flip it physically you apply a voltage, which is like water pressure for electricity. You use electricity to control electricity. Think of it like a stop light. It’s actually almost exactly like a stop light. You make the light red (low voltage), traffic stops. That’s a “0” (cutoff for the MOSFET). You make the light green (high voltage) and traffic goes. That’s a “1” (saturation for the MOSFET). Yellow light puts the MOSFET in linear mode, which has its use, but not for computers so we’ll skip it. Pretend they’re the cars from the Bee Movie, they stop and start perfectly. It’s a metaphor whatever.

Now it turns out, you can hook up a few transistors together and make some neat logic happen, what we call Boolean logic. Like okay, traffic can only go if this light is green AND this light is green. We’re not thinking in voltages and currents anymore, we’re thinking in 1’s and 0’s already.

Let’s go further, more abstract. If you get a 0 here, a 1 there, we want this to happen. Or a 0 here and then a 1 at the same light and then another 1 and another 1 but then a 0, we want this specific thing to happen.

You can use this idea to build simple blocks, like addition and subtraction. Soon multiplication, or shifting various things. You put all this functionality into something called an **ALU. Arithmetic Logic Unit**. You have to store the numbers for it to use somewhere so that we can do more than one calculation at a time. You build memory, which is transistors feeding themselves so they stay put. You devise a system so you say okay if this is 1 and this is 0, that means add the numbers. Which numbers? Oh well check these switches, if it’s 111, pull it from here, if it’s 110 pull it from here. That is called **machine language**.

We don’t want to keep saying 1’s and 0’s. What a pain. What if we could assign a mnemonic to each operation? Shorthand for what you want it to do, what you want it to be done to, and where to put it after? That is called **assembly**.

Soon machine language also became a pain. We’re still dealing with circuits and transistors without saying we are. We’re fooling ourselves. We’re babbling. Instead of instructing word by word, let’s make sentences. Why not? Or hell, pictures. We’ll make a dictionary for a language we speak (English of course because much of this is built on work by Americans and British, sorry), and a manual that says how to use the dictionary. That dictionary is a **programming language**, and that manual is a **compiler**. You build an **operating system** that handles stuff like talking to the CPU directly and moving memory around so you can focus on higher level apps like a video game.

And now, we are where you are. Writing programs in a language using words from that dictionary. But in the end you’re applying voltages to create conductive channels on a photolithography substrate. The words you type make trillions of molecules move *exactly* the way you specified at literally light speed without ever needing to think of them, so someone can send a funny joke to their friend.

Anonymous 0 Comments

Why did you remove your entry?