I threw myself into computer science a little over a year ago and have enjoyed experience very much. In conversing with people however, few understand that Computer Science has little to do with tech support and more to do with mathematical problem solving. This post is an attempt at an overview of a few of the principles of computer science, presented in a non-mathematical fashion.
At the most basic level, your computer does one thing very well, over and over: it loads an instruction, decodes it, then executes it. It does this approximately 2 million times every second -- that's where we get numbers like 2 GHz for our CPU speeds.
What is an instruction? An instruction is a command. A few of the more obvious ones are ADD, MULT, DIV, etc. A couple not-so-obvious ones are STO (store), and MOV (move), which are used to store and move data. Using commands like these, collectively called the 'instruction set', you can manipulate data. For example, if you using a calculator program to add two numbers, you would type '2 + 2', the calculator program would parse (separate) the expression into its basic parts, recognize that the '+' symbol translates to the ADD instruction, and send the data to the CPU. The CPU would load the ADD instruction, add the two numbers, then return the result to the calculator program.
Ok, so we know that the CPU executes instructions. Now what? It's at this point that I'd like to explain a bit about those instructions on the CPU (ADD, MULT, DIV, etc.). What is the ADD instruction and what specifically does the CPU do with your data to add two values together? For this, we turn to logic gates, alternatively known as truth tables.
Logic gates [wikipedia] are the building blocks of CPU's. They are a fundamental language used to deduce conclusions in an unambiguous way. There are a half-dozen or so basic truth tables, OR, AND, NOT, NOR, XOR, to name a few.
In truth tables, T = true, F = false. The first two values are inputs and the far right column is the output. In an AND truth table, you need two true inputs to get a true output. That is the definition of 'and' -- this thing AND that thing. It sometimes helps to say these out loud, so the first row reads, "true AND true equals true."
AND
True | True -> True
True | False -> False
False | True -> False
False | False -> False
In an OR table, at least one input needs to be true to produce a true output -- this thing OR that thing.
OR
True | True -> True
True | False -> True
False | True -> True
False | False -> False
So these tables exist in the CPU? Sort of, but in a different form. It turns out you can model these logic tables using electronic circuits so that one voltage corresponds to true, and another voltage corresponds to false. Moreover, when you arrange these logic gates in certain ways, you can create little routines that will do things like add or multiply two numbers. The add circuit in the electrical engineering world is called an adder [wikipedia]; the multiplier is called a binary multiplier [wikipedia].
And so we arrive at binary -- you knew it was coming. What is binary anyways? As just described, logic gates only understand two types of values: true and false. They can't process 3 or 93.57 ewithout first being converted into a differnt form, a form logic gates understand -- that form is binary. Binary is daunting at first...it scares people. So let me try to alleviate any fear.
Binary is a counting system, just like the counting system we normally use. Normally we count to 10, then start over and count to 10 again. Evolutionarily it makes sense since we have 10 immediate digits (fingers) to count with. Binary simply counts to 1, over and over again. Behold...
8 4 2 1
-----------
0 0 0 0 = 0
0 0 0 1 = 1
0 0 1 0 = 2
0 0 1 1 = 3
0 1 0 0 = 4
0 1 0 1 = 5
The '8 4 2 1' simple indicate the 'place' of the digits. Now we have a true/false system that logic gates can understand. If there is a 1 in that 'place', add it to the total -- that's the only rule.
0000 obviously equals 0 because there are no 1's (true's) in the number.
0001 equals 1 because there is a 1 (true) in the one's place
0010 equals 2 because there is a 1 (true) in the two's place
0011 equals 3 because there is a 1 (true) in the two's place and in the one's place. simply add.
0100 equals 4 because there is a 1 (true) in the four's place.
0101 equals 5 because there is a 1 (true) in the four's place and one's place. just add the two.
Using this system you can pass a series of 1's and 0's to an adder circuit on the CPU and add two numbers together. Revisiting the first example, if you wanted to evaluate 2+2 the calculator, the calculator would separate the parts of the expression, recognize the '+' sign as the ADD instruction, load the two values to be added, then run them through the adder circuit on the CPU. It's this sort of layering of complexity that has allowed computers to become so complex.
Hope that fills in a few of the holes concerning how computers work. As always, comments, requests, corrections, and questions are welcome. Check back in the following weeks for part 2.
Thursday, November 20, 2008
Computer Concepts Part 1
Wednesday, November 19, 2008
The Booming Music Industry
"The wha?! The music industry isn't booming Chris! The Interweb pirates is stealing all teh moneyzz!" At least that's what we're led to believe.
An insightful keynote speech on the shift of power taking place in the music industry. We're finally in an age where power has been placed back in the hands of the artist.
My two favorite chunks from the speech:
-A quote by Chuck D, "There is nothing wrong with the music business, there is a problem with the CD business."
-A few statistics, "Music consumption isn’t declining: iPod sales up 59% Y/Y (source: Apple), P2P filesharing volume up 35% Y/Y(source: NPD), audio streaming up 25% Y/Y (source: Accustream). And despite the endless discussions about the pirates there isn’t an unwillingness to pay for music, either: 1.6B decisions to buy music in 2007, up from 1.3B in 2006 (source: Neilsen Soundscan), 40% Y/Y increase in worldwide digital music sales (source: IFPI), 8% Y/Y increase in North American concert revenue — an all-time high (source: Forbes.com), 40% paid an average of $5 in Radiohead’s pay-what-you-want model, Nine Inch Nails self-release generates $1.6M in first week sales, includes sell out of $300 box set in first 48 hours (source: NIN.com)."
Wednesday, November 12, 2008
The Broken Republican Party
A particularly good article by Ron Paul reminds us of the values of true Republicans. In recent years the behavior and goals of the Republican party have drifted heavily, so much so that they cease to even look like Republicans -- something I've often thought to myself, but vocalized sparingly. We gave up privacy rights, handed war-declaring powers to the president, and banned certain research based on religious grounds effectively empowering government, not making it smaller.
Some highlights from the article:
"In the rise and fall of the recent Republican reign of power these past decades, the goal of the party had grown to be only that of gaining and maintaining power -- with total sacrifice of the original Republican belief in shrinking the size of government."
"Limiting government power and size with less spending and a balanced budget as the goal used to be a 'traditional' Republican value. This is what Goldwater and Reagan talked about. That is what the Contract with America stood for."
"Once the Republicans were in power, though, the promises faded, and all policies were directed at maintaining or increasing power by trying to whittle away at Democratic strength by acting like big-spending Democrats."
"The Republican Congress never once stood up against the Bush/Rove machine that demanded support for unconstitutional wars, attacks on civil liberties here at home, and an economic policy based on more spending, more debt, and more inflation -- while constantly preaching the flawed doctrine that deficits don't matter as long as taxes aren't raised."
"...what the Republican leadership didn't realize was that ALL spending is a tax on middle-class Americans through price inflation and that eventually the inevitable consequence is paying for the extravagance with a financial crisis."
"Party leaders concentrated only on political tricks in order to maintain power and neglected the limited-government principles on which they were elected. The only solution for this is for Republicans to once again reassess their core beliefs and show how the country (not the party) can be put back on the right track. The problem, though, is regaining credibility."
True Republican ideals aren't bad by any means. Unfortunately, my generation knows nothing except a misguided Republican party. Admittedly I shy away from voting Republican because I am suspicious of their intent. Republicans of this variety give friend and contributer to this blog, Evan, a bad name. Lower taxes? Excellent. War, bans on abortion/gay marriage, research funding cuts, and a President who thinks God wants us to invade other countries? No thanks.