Hardware And Software

2020-06-24

Previous Post About How Computers Work

Binary And Data

When you look inside a computing device you see a bunch of circuits, chips, wires, speakers, plugs, and any number of other stuff. All of this is hardware.

What you don't see is software. Software is all of the computer programs running on this machine.

Software is anything from apps and games to webpages and data science software.

But how do hardware and software interact with each other?

The CPU

First, let's look at a computer's central processing unit or CPU.

The CPU is the main chip that controls all the other parts of the computer. A CPU needs to do many different things, so inside it has smaller, simpler parts that handle specific tasks.

There are circuits that do simple math and logic, other circuits to send and receive information to and from different parts of a computer, and more.

The real complexity of a CPU is how it knows which circuits to use and when to use them.

CPU Commands

The CPU receives simple commands that tell it which circuit to use to do a specific job.

For example, an add command tells the CPU to use its' adder circuit to calculate a new number. And a store command tells the CPU to use a different circuit to save the result of the add command into memory.

Just like numbers, all of these simple commands can be represented in binary ones and zeros, or on and off electrical signals.

These binary commands are stored in memory and the CPU fetches and executes them in sequence, on after the other.

This sequence of binary commands is in fact a very simple computer program or software.

Computer Programs or Software

Binary code is the most basic form of software and it controls all the hardware of a computer.

Today nobody writes software in binary because it would take forever.

Today we use programming languages to write software.

These programming languages look like this: Example JavaScript Code and this: Example Swift Code

Programming Languages

Programming languages like the example above let you type in commands in something that looks a lot like English.

To add two numbers together you just need a single command:

const sum = 40 + 2 // 42

This high-level command is converted into hundreds or thousands of simpler binary commands that the CPU understands.

Software tells the CPU what to do, but when you're listening to music, browsing the web, and chatting with a friend, your computer is running multiple pieces of software all at once.

How do all of these programs get on the computer in the first place, and how can the CPU run them all at once? To find that out we'll have to look at the operating system.

Operating System (OS)

The operating system of a computer is the main program that manages how software gets to use the hardware of the computer.

The operating system is a program with special abilities that let it control the other software on the computer.

The operating system lets you install new programs by loading them into the computer's memory. It decides when a program is run by the central processing unit (CPU), and whether that program can access the computer's input and output devices.

When you think your programming is running many programs at once, in reality, the operating system is quickly switching between programs, sharing the CPU for fractions of a second.

Inside every computer is an operating system managing software the controls the computer's hardware.

Software is a series of commands made of simple binary code, and that binary code is just electrical signals flowing through billions of tiny circuits.

Resources

https://www.youtube.com/watch?v=OAx_6-wdslM&list=PLzdnOPI1iJNcsRwJhvksEo1tJqjIqWbN-

GoTea - KoalaTea