At the most basic level a computer is memory to store data, memory to store a program, a CPU to manipulate the data using directions from the program and a collection of “peripherals” (e.g., graphics, keyboard, Ethernet, HDMI, etc.) that connect these components to the real world. More on the hardware later.
The program at its most basic is 1s and 0s, and that is how early computers were programmed. This was a very slow, error prone and tedious way to create the program. Over the years more and more abstract ways of programming have evolved: assembly code that really is just labels in text for each of the binary commands, “high-level” languages like FORTRAN, COBOL, JAVA, C, etc., etc., etc. Many of such languages exist and they have functions like “if, then, else”, “multiply”, “add”, “read” from memory, “write” to memory. These languages must be “compiled” into assembly code so the hardware knows what to do. Some compilers are static, that is they do the compilation once and that gets stored into program memory. Some compilers are “run-time” and they compile each time the program is activated.
Programming now keeps building on itself. For example, instead of writing programs that each have to communicate with the peripheral units, manage memory, etc., computers have an operating system that provides standard functions that all software can use. Likewise, graphics has drivers, that perform common graphics commands. In addition, software like Python have enormous libraries of common functions that programmers can use to speed up software development.
Back to the hardware. Memory originally was very simple. For data, it was a set of circuits that could store the ones and zeros of data and a connection to the CPU. For the program it was a separate system that might be the same circuits as the data but had to be manually loaded. Some computers used paper tape that was continuously read by the CPU. Other media existed for that too. Today memory is very involved. The program and data are stored together on a hard drive (or maybe the cloud). When the program is activated parts of it are loaded into DRAM (this is the memory sticks you buy when you get the computer). Then as the program runs, parts are loaded into caches on the silicon. The caches are hierarchical with large slower ones that hold program and data, to small-fast ones, that separately hold data and program. These are what the CPU directly accesses.
The CPU has circuits that typically implement arithmetic, Boolean, loads, stores, program flow (branches, jumps). In addition the CPU has a memory management unit to help the operating move data through the memory hierarchy as needed. It can use the load/store hardware to communicate with the peripheral elements.
The peripheral elements are also known as the I/O system. Graphics is its own beast. It has a large array of simple CPUs that work in parallel to go from commands to creating a “bitmap” of the image that you see on the screen. It has to do all calculations each time the screen is changed, which today is 120 Times per second. That’s a lot of math and is why graphics cards need a lot of power. Once the image is in memory the graphics unit spits out the image in a serial fashion to the HDMI port so your monitor can display it.
This is very superficial, but hopefully helpful. For you experts out there, I intentionally simplified things so DM me if you want an in depth debate about how things work.
Latest Answers