Black Magic Computers

Black Magic Computers

Black Magic Computers

Currently Reading: Understanding Linux Network Internals, Kubernetes Up & Running, The Manga Guide to Electricity

(Warning: I’m not a chemist, physicist, or even in college. This is just my understanding of these tools, but if I’m wrong, let me know!)

This week I accidentally tripped into a bunch of “Crash Course Chemistry” videos when trying to understand semiconductors (which stemmed from trying to understand how computer’s work).

Check out crash course here: (

So, what is a semiconductor?:

A chemical or substance that conducts electricity, but only under certain circumstances. That’s where the “semi” comes from, because it only “semi” wants too.

Semiconductors either have a negative or positive charge based off what chemicals are bonding with Silicon (doping), if it has more free electrons, it’s negative, if the bond is looking for a free electron it’s positive.

For example, Boron has three outer electrons ( which would make the doping positive, however Phosphorus ( has five outer electrons which makes makes the doping negative.

There are P (positive) types and N (negative) types of bonding. A diode is half P type and half N Type which makes a diode neutral. Diode’s are easily summarized as a “one way street” for electricity to pass through, meaning it can go one way, but not the other. Based off how the electrical current (such as a battery) is flowing through the diode this conducts where the electrons go. The electrons always go the opposite way of the current.

If the negative is hooked up to the positive, and the positive to the negative, then the electrons will be attracted to the open holes and will quit (Reverse Bias). However, if you flip the battery around the extra electrons on the negative side will be pushed over to the positive side and the excess electrons will continue to flow (Forward Bias).

Perfectly summarized by my sister (who knew having a physicist as a sister would come in handy?) — “All electricity is, is electrons looking for a home where they’re wanted and loved.”

Now semiconductors are pretty dope (doping joke, harhar), and you can see they’re the reason we have computers today.

Fun tid-bit I learned, Digital components treat electricity as on or off, yes or no, true or false, which is why they mostly make up computers. Analog components treat electricity like a flowing stream, like how your car’s speedometer keeps track of you speeding.

A transistor is a more complicated diode that is either PNP or NPN, which can either turn the current on or off, or amplify the current. This makes a transistor both analog and digital. Now, transistors are very helpful in making logic gates (AND, OR, XOR) which is a physical representation of a boolean function.

That’s a bit confusing, but to put it simply it’s how you would actually show (this would be an AND gate):

In [1]: if 1 and 1:

…: print(True)



So, if the current is running through transistor A, it would return true, and if current is running through transistor B, it would return true, which would make our whole expression true.

Now, a computer uses something called a flip-flop ( which stores state information. I like to think of it as something that saves numbers, and if you put a bunch of flip-flops together that makes a register, and if you put a bunch of registers together, that makes a memory chip.

Here is a photo of my flip-flop, and what I based it off of.

So, basically we’re taking a thing that can make small numbers, and grouping them to make bigger numbers, and then grouping the things that make bigger numbers to make even bigger numbers.


With a memory chip there are incoming wires (Address Wires) and outgoing wires (Data Wires). An address comes in on the address wires and that selects a register, which outputs that information through the data wires. For running a program, you would use something like a program counter (or instruction pointer) . What a program counter does is keep the program sequence running by pointing to the next instruction to be executed.

That’s about as far as I’ve gotten with logic gates, and how a computer works. Switching gears into my other interest, networking and the black magic it uses. I started digging into Understanding Linux Networking Internals about halfway into Understanding the Linux Kernel. The big question I’ve been asking this week is not only how the packet is built on your machine, but how it is sent out.

It starts with routes, which stores the necessary information to forward traffic towards a destination. There are many different types of data structures used by the routing code for the Linux Kernel to make this as efficient as possible. If you have a bunch of routes, you then have a routing table. Once the routing table confirms your next hop, the packet is sent over ethernet interface.

The biggest question I’m having lately is, how do we use radio waves to transmit data (like data packets) and how do receivers even.. receive them?

Last stop is Kubernetes, and my current project, Spookernetes. I am currently following this guide (, CoreOS documentation, you were too out of date) to set up Kubernetes “the hard way” on GCE. It didn’t think the hard way meant wrestling with ETCD for four hours, but luckily this is teaching me how every part of Kubernetes works together. It’s kind of like solving a big Rubik’s cube in my mind! Also, choosing Container Linux instead of Ubuntu has taught me a lot about the restrictions in place on Container Linux. But why are these restrictions, such as making /usr/bin/ read only, helpful?

Spookernetes is on GitHub and currently is a work in progress, using Docker Compose, Kompose, Consul, Traefik, Nginx, and more. (