HOW COMPUTERS WORK – PART 9 – THE HARD DRIVE & SOLID STATE DRIVE [MEGA SERIES]

What HDDs and SSDs Do
For the sake of simplicity, I’ll refer to both the HDD and SSD as hard disks. They both have the same function, so why not give them both the same name in this document?

Your hard disk stores everything on your computer, from the operating system to the calendar with the proctologist appointment to every single video, photo, program, book, or virus. This isn’t something hard to understand, so I’ll just move on from the subject. Just don’t confuse the hard disk with your computer’s RAM, which stores all active and running program data. There is something the hard disk does that relates to RAM:

Page File/Swap File/Virtual Memory
The hard disk on every computer contains a file that has many names, depending on the context you use it in and the operating system you’re talking about. The consensual accepted term is “virtual memory,” but Linux might refer to it as a “swap file” and Windows occasionally calls it a “page file.” This part of your memory stores parts of open applications that don’t necessarily need the speed of RAM, but need to go somewhere anyway. Operating systems prioritize what goes where, and I’m not going to get too much into that, but programmers might recognize the MEM_PHYSICAL flag in VirtualAlloc().

How HDDs Work
OK, so now we’re going to split things up into HDD concepts and SSD concepts. An HDD is a device that magnetically records data on metal platters, much like how a video tape records images in its tape. The HDD isn’t like a video tape, though, since it doesn’t need to rewind or forward anywhere.

Think of the HDD as a sort of vinyl record player. You can move the needle anywhere you want on the record without having to rewind on the track. HDDs use something called a read/write head to perform the function of the needle. However, instead of touching the disk, an HDD’s read/write head glides over the surface just a tiny distance from the platter. A single speck of dust getting between the platter and the head can corrupt any data transfer. That’s why HDDs are enclosed in an airtight metal casing.

The heads on the disk move across the platter to read and write data, and the platter spins consistently at a high speed (anywhere between 5000 and 11000 RPM) to make data access easier.

The Problem
Hard drives are cute, but not cute enough. Their data rates started dragging all other components of the computer down after processors got faster, RAM started storing data at much higher rates, and applications started demanding more and more transfer speeds. If your computer’s slow, chances are that your hard drive’s causing the whole shebang to run like a tortoise. This is mostly owed to the fact that HDDs use moving parts and mechanical read/write methods.

While every other piece of hardware on the computer has been upgraded and looks much different compared to its predecessor, the hard drive today is still the same hard drive used back in the dinosaur IBM Aptiva era, only with faster platters and new data retrieval methods. These improvements couldn’t quite keep up with newer components, and the idea of having platters and heads was abandoned altogether giving way to a new kind of data storage medium.

Solid State Drives
OK. Forget about moving parts and medieval magic. Let’s talk transistors!

This is what people said when they came up with the idea for a solid state drive that would hold all your data much like RAM does. If you have no idea how RAM functions, you should read up on the previous part of this series. In fact, an SSD is only a more sophisticated version of RAM and, with no moving parts, it transfers data just as fast as a RAM module. SSDs can reach up to twice the speed of dinosaur HDDs.

If you want to pack a punch, buy one and see how lightning fast it eats up all the data on your computer. Everything works almost harmoniously. No moving parts also equate to no noise – something for you to think about if you have a home office and the sound of a hard drive churning butter all day bothers you.

Unlike RAM, an SSD stores information and keeps it there. This technology is better known as flash memory, and you use it every day whether you like it or not. The process of flash storage differs from RAM’s method in that it keeps the electric charge between two transistors consistent and stores it, even after the device no longer receives an electric current.

This is achieved through a series of gates and something known as Fowler-Nordheim tunneling, a process through which electrons are forced through a barrier using a high electric field. You don’t have to learn about this process if you don’t want to. It’s not like I’m going to cover it, and if I do, I will explain it in much simpler terms.

HOW COMPUTERS WORK – PART 8 – RAM [MEGA SERIES]

What is RAM?
RAM, also known as physical memory, is essentially what stores everything open in your computer. It contains a repository of operating system libraries, drivers, open applications, and in some cases, rendering data for open windows. All the buttons in your program, every tab you open, and every video of Justin Bieber you click “Dislike” on is stored in memory until you close the Window it’s contained inside of.

How RAM Works
Just like the CPU, RAM stores all its memory inside a collection of transistors and capacitors. Read the CPU article if you have no idea what a transistor is.

Of course, the capacitors and transistors inside your RAM are much smaller and much simpler. Each capacitor in a RAM module stores a bit, the smallest possible increment of data in a computer. If you’re lost, read about bits and bytes first. If a computer wants to write a zero to a capacitor, it simply stops the flow of electricity to that particular capacitor by switching the transistor off.

There’s just one problem with this pretty picture of RAM: Capacitors can only store energy for a very limited amount of time. To counteract this, the memory controller on your motherboard ”refreshes” the capacitors at a rate equivalent to the “memory clock,” which is very similar to a CPU clock.

The Big Picture
So, since you now understand the internal workings of RAM, you should also be aware that your computer writes anything you open to its capacitors. This stores only what’s running at the moment and cannot store anything permanently. When you install a program, it’s written to the hard drive. When you open the installed program, its contents and all data associated with it is written to memory so that the program runs.

Types of RAM
Once you understand how RAM works, and what RAM does, you’re ready to learn the most common types of RAM on computers:

FPM DRAM (Fast Page Mode Dynamic RAM) – This is probably one of the oldest types of RAM that existed in personal computers. It pinpointed every single bit of memory that the processor asked for, one at a time. Imagine how “fast” it would “page” things.

EDO DRAM (Extended Data-Out Dynamic RAM) – This type of RAM existed much later and used the same method of data retrieval as FPM DRAM, save for the fact that the module didn’t wait for each bit to be retrieved. It simply retrieved the next bit in the next clock cycle once the previous bit has been located.

SDRAM (Synchronous Dynamic RAM) – This type of RAM cycles through columns of data, assuming that the CPU will grab data in chunks instead of single bits, making it work faster than its predecessors. Most computers built during the late 90s implemented this type of doohickey.

DDR SDRAM (Double Data Rate Synchronous Dynamic RAM) – To understand this type of RAM, think of the memory clock as a heartbeat. Every time the memory clock “beats” it has a diastolic and systolic rhythm – upbeat and downbeat. SDRAM only took advantage of the “downbeat” to retrieve data. DDR SDRAM, however, takes advantage of both the downbeat and the upbeat, making it twice as fast. This was improved further to yield DDR2 and DDR3 RAM.

RDRAM (Rambus DRAM) – A company named Rambus created a new type of RAM which works with a high-speed “Rambus” channel that helps accelerate the processing of read/write operations. Although not necessarily “better” than DDR SDRAM, it is worth a mention because the modules look cute. Oh, and the RAM modules tend to overheat, which is why they each need heat spreaders to help get rid of extra heat produced by massive electrical resistance.

VRAM (Video Memory) – This type of RAM usually exists in dedicated graphics cards for the sole purpose of storing rendering data and other things your computer would otherwise waste its own memory on. Although there’s many different forms of this RAM I prefer not to discuss, the important thing is that it has two different access ports: One for the CPU and one for a dedicated graphics processor known as the (GPU). It makes graphically intense applications run much more smoothly.

How Computers Work – Part 7 – Bytes & Up [Mega Series]

Definition of a Byte
A byte is a sequence of eight bases 2 numericals called “bits.” We’ve already discussed this, so we’re moving on. I just wanted to remind you of the terrifying and evil Part 6 that haunts you every night. So… One byte is 8 bits. One bit is the smallest possible measurement of any piece of data.

So, What’s One Kilobyte?
If you guessed that a kilobyte (KB) is 1000 bytes, you’re absolutely right. One kilobyte is equivalent to 1000 bytes, or 10³ bytes. This is much easier to read for humans.

  • 1 KB = 1000 B
  • 1 MB = 1000 KB
  • 1 GB = 1000 MB (1000000 KB)
  • 1 TB = 1000 GB
  • 1 PB = 1000 TB
  • 1 EB = 1000 PB
  • 1 ZB = 1000 EB
  • 1 YB = 1000 ZB

If you don’t understand the acronyms:

  • KB = Kilobyte
  • MB = Megabyte
  • GB = Gigabyte
  • TB = Terrabyte
  • PB = Petabyte
  • EB = Exabyte
  • ZB = Zettabyte
  • YB = Yottabyte

That’s right… There’s such thing as a “yottabyte.”

Someone might have told you at some point that a Kilobyte is 1024 bytes. Go ahead. Tell them that they’re flat out wrong.

The “1024” concept comes from another unit of measurement called the Kibibyte (KiB). The International System of Units defines Kilo as 1000. Slap anyone who says that KB = 1024 B in the face for me, OK?

For the sake of “going with the crowd,” I sometimes abbreviate a Kibibyte as “KB” and even sometimes call it a “Kilobyte.” It’s more accepted and makes people less confused, but at least you know what’s actually correct. Note that the Kibibyte isn’t the only unit. Almost every unit has been morphed to a “bib” word:

  • Mebibyte (MiB) = 1024 KiB… and so on
  • Gibibyte (GiB)
  • Tebibyte (TiB)
  • Pebibyte (PiB)
  • Exbibyte (EiB)
  • Zebibyte (ZiB)
  • Yobibyte (YiB)

 

How Computers Work – Part 6 – Bits, Bytes, and Binary [Mega Series]

What Binary Is and Why Computers Use It
Binary is based on the base2 numerical system. You already know the base10 numeric system (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9), which you use to… uh… count? Well, let’s say you use a base3 numeric system. That would include only 0, 1, and 2. If you get where I’m going, you can conclude that base2 is only composed of 0 and 1.

The binary numeric system is used in computers especially because they have only two recognizable states: on and off. Every transistor in your computer has these two states, like a light switch, and the computer can only communicate by these means. Your computer turns off a transistor to represent a value of 0. Electricity flows into a transistor to turn it on, representing a value of 1. Here’s where binary gets creepy… You obviously need to do more complex calculations on your computer than “0+1″ or “1+0.” So what is “1+1?” In the computing world, it’s “10.”

Wait… What?!
Remember, you’re using a base2 numeric system, not base10. With base10, each digit represents a power of 10. Let’s take apart the number 263 in base10. This is what the number looks like totally taken apart:

200 + 60 + 3

If we take it to its most basic level, we end up with: (2 x 10²) + (6 x 10¹) + (3 x 10º).

Taking this into consideration, you can now probably realize why (10) base2 = (2) base10. If you don’t, let me draw it out for you: (1 x 2¹) + (0 x 2º) = (2 x 10º). Remember that anything to the power of zero is equal to one.

Can you guess what the base2 number of 111 is in base10? If you still can’t guess, let me draw it out for you:

(1 x 2²) + (1 x 2¹) + (1 x 2º) = x

If you guessed that x is equal to 7, you’re totally right! If you guessed another number, skim by this section a little longer. Maybe it would help you if you took into account that each subsequent digit in a number is equal to itself times the base number to the power of its position as a digit reading from right to left minus one. The statement might sound more confusing but analyze it carefully. It’s telling you that the “1” in the base10 number of “155” is equal to “1 x 10 ^ (3 – 1)” or “100.” The small carrot ( ^ ) symbolizes a rise in the value of the number behind it by the exponent in front of it.

Now that we’re through with the funky math, we can get to the more “computery” aspects of binary.

4-bit, 8-bit, 16-bit, You’re It!
Each of the base2 numbers described in the previous “math-ish” section is called a “bit” in the computing universe. Bits often fit into “atoms” or “bytes.” An atom, also known as a nibble, is a segment of data composed of 4 bits, hence the term “4-bit” and isn’t used much today. A long time ago, though, this was the big thing in the Intel 4004 microprocessor. You don’t need to worry about this, as you were probably having your first teeth when the processor was already obsolete.

A byte, however, is a segment of data commonly used in computing, which contains 8 bits. It’s a leftover of the old 8-bit processing model that newer processors have built upon. Every letter you read on this screen is composed of one byte, or eight bits. The uppercase letter “A,” separated into nibbles, is:

0100 0001

Can you guess what numeric value that has? Take a moment to calculate it, just so you get used to base2 mathematics. Some of what we discuss on this site might confuse you if you don’t know how to calculate a base2 number. In case you want to verify your answer, it’s 66. If you want to know, there are principal values bigger than bytes:

  • Word – 16 bits
  • DWord (Double Word) – 32 bits
  • QWord (Quadruple Word) – 64 bits

Each of these values are used in basic machine code commands and construct all the data you see on your computer. Now that you know this, you can either brag to your friends that you’ve just learned some pretty neat stuff about binary, or go sit in a fetal position waiting for the next part of How Computers Work, hoping it would be less confusing.

How Computers Work – Part 5 – The CPU [Mega Series]

What Does the CPU Do?
Every microprocessor is built to perform math and process information, hence the name “processor.” It does this with simple transistors and registers which are equipped to perform certain functions, like fetching memory, subtracting, adding, etc. As the decades passed, these chips became smarter and more efficient, while today’s chips can follow billions of instructions in one second.

What a Transistor Does
A transistor is basically a little piece of semiconductor material that switches electrical current and/or amplifies a signal. It’s easier to think of each transistor as an on/off switch, because that’s what your computer is: A gargantuan collection of on/off switches, each with their own function in the grand flow of data governed by Computer Science.

Each of these transistors are structured in a way that serves a particular purpose, such as fetching a memory address or writing to it. The CPU determines what it should do with its transistors based on the machine code sent into it, creating tasks. That’s basically what makes everything work when you click a mouse on a button and out pops a result.

Let’s say you close a window. The CPU fetches the graphical data of the window and tells the graphics adapter to close it. It then fetches the memory address associated with the window (in RAM or your hard drive’s virtual memory) and deletes all the memory located there, and then it continues to check for further mouse movement. This is a simplified version of what happens, but it’s a general idea you can easily understand.

What a CPU Does, Cont’d

CPUs perform the most elegant functions of the computer:

  • Arithmetic
  • Memory manipulation, and
  • Decisive tasking

It performs these functions with four simple components:

  • Arithmetic Logic Unit (ALU)
  • Address bus
  • Instruction registers, and
  • Cache

The CPU has an arithmetic logic unit (ALU) which performs all the adding, subtracting, division, and multiplication on your computer. Its address bus makes it possible for the processor to directly work with any memory on your computer, deleting and adding information. The cache, and all its levels, keep track of all tasks and memory addresses that are most actively used at the moment. Your CPU’s instruction registers carry out all the tasks on the computer, queueing them as they accumulate, and processing each as the processor becomes free.

The processor’s clock determines how fast it works. This clock usually is governed by a crystal that oscillates at a fixed rate per second. The amount of oscillations per second is then multiplied by a number set by the motherboard’s BIOS and turned into the CPU’s clock. Every time the CPU’s clock “ticks,” the CPU carries out one instruction. Hence, a CPU with a clock of 3.33 GHz executes 3.33 billion instructions per second. Be careful not to mispronounce “clock” when telling your friends about this. I’ve had my share of embarrassing moments!

Cores

A CPU doesn’t just operate on its own. Let’s say you were reading this article, watching a video of some guy falling off his bike, annoying your co-workers via instant messenger, and calling your ex on Skype in a drunken fit of rage. Wouldn’t all of that be easier if you had four processors?

Not necessarily… You see, CPU manufacturers came up with a new concept that blows the multi-processor idea out the window, and decided to include cores inside the processor. Each core is almost like an individual CPU, with its own address bus, ALU, and instruction register. While still sharing the cache between each other, cores make multitasking much faster where it originally would have taken four times as much muscle to do four non-productive things on your computer at the same time (except, of course, reading this article). If you have heard of the terms “quad-core” or “dual-core” before, this is what the terms refer to. Cores aren’t the only things that processors have been beefed up with, though.

Threads

Instead of adding multiple cores like a wild fox, Intel decided it’s time to invent a proprietary system in which two parallel instructions can be executed on one single core.

The Foster Xeon from Intel was the first microprocessor to execute instructions in a hyper-threaded environment. This was intended to make a processor double its multitasking capacity and further increase productivity. If you have a quad-core processor with hyper-threading capabilities, that means that you have the equivalent of a whopping 8 processors on your computer. You may now proceed with patting yourself in the back for understanding what I just said.

64- and 32-bit
One of the most common questions today: Is 64-bit better than 32-bit?

Most programs out there as of the time of this publication don’t need a 64-bit processor. The “64-bit” and “32-bit” denominations represent a bit width, which in laymens’ terms represents the amount of information the CPU can store in one register at one given time. To first understand the concept of these two bit widths, you need to be able to picture a register.

If you notice, the register itself is built upon the registers of predecessor processors. A long time ago, we had 8-bit processors. The 16-bit processor included just two 8-bit registers, and so on. The diagram isn’t completely accurate, as far as proportionate size is concerned, but the only thing I wanted to demonstrate was the hierarchy of a register.

A 32-bit program can run on a 64-bit processor because it still has the EAX register. A 64-bit program, however, cannot run on a 32-bit processor, because there is no RAX (64-bit) register on these processors. Even so, you still have to install a 64-bit operating system on the computer to benefit from the 64-bit register. Otherwise, it will only recognize EAX, and not RAX. Are you lost? Read it again, about 4500 times. It’ll catch on.

If you didn’t understand the above, all you need to know is that a 64-bit processor is “better” only if you run 64-bit programs. 32-bit programs won’t run better on a 64-bit processor, but they will run anyhow.