What makes computer code ‘work’

801 viewsEngineeringOther

By this I mean, when you write code, what exactly gives that the power to do anything is it more code? 0’s and 1’s? more so, what gives that thing the power to do anything? At some stage I can only deduce what must just be magic making it work because it’ll boil down to something metal and plastic ‘talking to’ an electric current, which doesn’t make sense at all

In: Engineering

17 Answers

Anonymous 0 Comments

It all boils down to basic binary math. 2 bits (1 or 0) and an operation. 1 and 1 is 1. 1 or 0 is 1. 1 nand (not and) 0 is 1. So you build your processor to do those things using basic electrical gates. Doing these operations in multiple steps, you can extrapolate into basic math, and then advanced math. The processor has multiple layers of memory, registers and cache, where it can store the result of an operation to use it again in a later operation. Then you start to layer on abstractions. A certain series of bits will represent “A”, a different series of bits will represent “B”, etc.

Then over decades you layer on more and more abstractions, and make your CPU faster and faster by putting the components closer to each other to limit how far electricity has to travel, and you find better materials for electricity to travel through, and add more layers of caching, etc. You add shortcuts for commonly used operations to make them faster. You can specialize certain processors for certain operations, essentially making them faster at certain operations at the expense of others. Pretty soon, it’s doing so much basic math so fast that it feels like magic.

This is why people sometimes say we electrocuted sand (silicon) and taught it to think.

You are viewing 1 out of 17 answers, click here to view all answers.