Hardware Basics

From Coder Merlin
Revision as of 01:23, 16 May 2021 by Uther-pendragon (talk | contribs) (Created page with "Although programmers generally work with creating software, understanding the hardware that runs that code is important. == CPU == The CPU, or '''C'''entral '''P'''rocessing...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

Although programmers generally work with creating software, understanding the hardware that runs that code is important.

CPU[edit]

The CPU, or Central Processing Unit, as its name suggests, is the component in your computer that actually does the processing. Modern CPUs are made up of billions of extremely small transistors, which act like switches in that they either let current through or they don't. The saying "the sum is greater than the parts" is a really apt way of describing transistors in a CPU; a single transistor can do just about nothing, while billions of them can do everything from serving a website to running a video game.

Modern CPUs are made up of multiple cores, each of which are capable of running their own processes. This allows for computers to multitask much more effectively, and can speed up execution of optimized programs. Most CPUs will also have a small cache, usually around a couple hundred kilobytes or a few megabytes. This cache is used to store data the CPU will likely need to access soon, and any data found in the cache will save the CPU from having to fetch data from RAM. Although RAM is also extremely fast, it is still physically further away from the CPU than an on-board cache, and will therefore take longer to get data from.

RAM[edit]

RAM, or Random Access Memory, also serves a really important role in your computer. RAM is used to store data and instructions that will eventually be used by the CPU. RAM is called random access because any piece of data stored anywhere within the RAM can be accessed near instantly. This is in contrast to a hard drive, for example, in which a physical platter needs to spin around to find the correct piece of data.

Because RAM is so much faster than hard drives, and even solid state drives, you might be wondering why the latter two even exist. To put it simply, RAM is volatile memory which means that it needs a constant supply of power to preserve its information. There are also cost limitations; $100 can buy around 16 gigabytes of RAM, while the same amount of money can buy four terabytes, or 4000 gigabytes of hard drive storage.

HDDs and SSDs[edit]

HDDs (Hard Disk Drives) and SSDs (Solid State Drives) are both types of nonvolatile storage. This means that even without power, any data on the drives will persist. Additionally, as previously mentioned, these forms of storage can hold significantly more data which makes them ideal for storing things such as your computer's operating system, and your programs and files. Whenever you launch a program or open a file, that data is loaded into RAM. This is why opening a browser can take a while on a computer with a hard drive, but once it's open it feels much faster. This is more noticeable with a hard drive because the hard drive has to physically move disks around to locate the data which takes time.

Input and Output Devices[edit]

A computer would be pretty useless if it just sat there with no way of receiving or outputting any sort of information. Because of this, computers have a plethora of input and output devices that make it easy to interact with them.

Input Devices[edit]

For lack of a better explanation, input devices are devices that send data to the computer. The most common example is a mouse and keyboard. Whenever you move a mouse or type on a keyboard, data is being sent from that device into your computer. Another good example of an input device is a webcam which provides visual information to the computer.

Output Devices[edit]

Output devices are any device through which your computer can output data. A common example of this is a monitor, which is used to visually display information, such as graphical user interfaces. However, output devices can also be much simpler and even non-visual. A speaker or pair of headphones, for example, is a way for a computer to output audio information. Turning LEDs on and off from a computer program is also a form of output.