In: Computer Science
When you look inside a computing device you see a bunch of circuits, chips, wires, speakers, plugs, and all sorts of other stuff. This is the hardware.
But what you don't see is the software. Software is all of the
computer programs, or code, running on this machine.
Software can be anything from apps and games to web-pages and data
science software.
But how do the hardware and the software interact with one another?
Lets start at looking at a computer's central processing unit,
or CPU.
The CPU is the master chip that controls all the other parts of the
computer. A CPU needs to do different things, so inside it has
smaller, simpler parts that handle specific tasks. It has circuits
to do simple math and logic, it has other circuits to send and
receive information to and from different parts of the
computer.
The real magic of the CPU is how it knows which circuits to use and when to use them. The CPU receives simple commands that tell it which circuit to use to do a specific job.
For example, and add command tells the CPU to use its adder
circuit to calculate a new number. And then the store command tells
the CPU to use a different circuit to save that result into memory.
Just like numbers, all of these simple commands can be represented
in binary ones and zeros, or on and off electrical signals.
The binary commands are stored in memory and the CPU fetches and
executes them in sequence one after the other.
This sequence of commands is in fact the very simple computer
program.
Binary code is the most basic form of software and it controls all the hardware of a computer. These days nobody writes software in binary, it would take forever.
Today, the software we write looks more like this Python, Ruby, etc.. Programming languages like these let you type in commands in something that looks a lot like english.
To draw a rectangle on the screen you just need a single command
i.e. draw(100,100,200,300).
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 and browsing the web and chatting with a friend, your computer is running multiple pieces of software all at once.
So 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 out we'll have to take a look at the operating
system.
The operating system of a computer is the master program that
manages how software gets to use the hardware of the computer.
For example, I helped create the Windows operating system that
runs on most personal computers.
The operating system is a program with special abilities that let
it control the other software on the computer. It lets you install
new programs by loading them into your computers memory. It decides
when a program is run by the central processing unit, whether that
program can access the computer's input and output devices. And
when you think your computer is running many programs at once, in
reality, its the operating system that's quickly switching between
programs, sharing that CPU for fractions of a second.
Inside every computer is an operating system managing software
that controls the computer's hardware.
The software is as series of commands made of simple binary code,
and that binary code is just electrical signals flowing through
billions of tiny circuits.