Monday, April 28, 2008

ISA for a RISC

I get the question, "so what do you do in computer science?" quite a bit. A truly simple question without a simple answer. My mind races when I get this question. Do I tell them about the mathematical logic, number theory, graph theory, numerical analysis, or inform them of automata, computability and computational complexity theories, or I could go the route of analysis of algorithms and data structures, or even go into the realm of system architecture which includes computer architecture, computer organization, and operating systems. But I'm leaving out the data mining, relational databases, artificial intelligence, automated reasoning, and machine learning that I could also talk about. I usually just say, "I program" and be over with it because lets be real, unless you're a fellow CECS student/major/graduate/enthusiast you are not going to want to hear about all that exciting stuff. But now I am going to give you an actual glimpse of some of the things that I work on.

Here is a project that I worked on last semester in my computer architecture class, so I hope that you enjoy it as much as I did working on it :)

fun times

Note: the file is around 2.5 MB so it might take 10+ seconds to load the page

Tuesday, April 22, 2008

those speedy little electrons!

If you're anything like me, you sometime wonder just how fast those little miracles known as electrons really go in everyday substances. With my small background in electricity and magnetism and a big case of wonder (and I know you wonder about this stuff too!) I made up some random scenarios (google helped a bit to which you'll see later) to see if I could actually calculate the speed of an electron.

I know that copper is a fairly typical conductor that is used, so I choose the length of 3.00m and the diameter, or width of 1.5mm of copper randomly to work with. Also, I had to give a current (I) that was being applied to the wire, I randomly choose 8.00 amps. With using copper, I asked google the resisitivity and concentration of copper. These are both important in determining if a substance, in our case copper, is a decent conductor.

Google didn't disappoint and came back with the answers of resisitivity (p) = 1.7*10^-8 (ohms)(meters) and the concentration (n) = 8.5*10^28 meters(negative cubed).

Armed with this information, I set out initially to find what is known as the "drift velocity" of a single electron in copper. A bit of background: millions of nano collisions are happening around us that make up the very things we interact with, same goes for a single electron with a current moving down a copper wire. The current essentially "guides" the electron a certain direction down the wire, but the electron can't go down the wire without bouncing off matter that makes up the copper wire. Thus we come to something known as the "drift velocity", or the average speed at which an electron goes before colliding with something else.*

The calculation of the drift velocity was fairly simple. I had to find the magnitude (J) of the current density in the copper wire. Related functions of current (I) = nq(drift)A
J = A/m^2 With A = cross section of the wire and m = mass of an electron
A = π r^2 = 3.14(0.0075)^2 = 1.8 *1 0^-4
m = (9.1*10^-31)^2 kg = 8.28100 * 10^-61
and it is known that the current density is proportional to the drift speed such that: J = n*e*(drift velocity). Simple algebra leads us to: drift = J/(n*e), or somewhere around 3.30 * 10 ^-4 m/s.

So what does this mean? It means that, on average, an electron will speed up to 3.30 * 10^-4 meters per second before bouncing into something...pretty neat, huh?


This of course got me to thinking how many actual (or close to actual) collisions that were going on in this copper wire every second.

For this I had to answer how many collisions per second does each electron undergo. With algebraic expression for the mean time between collisions equaling: time = mass/((electron's charge)^2 * n * p)
Which came out to be:
9.1 * 10^-31 / ((1.6*10^-19)^2 * (8.5 * 10^28) * (1.7 * 10^-8)) = 2.46 * 10^-14 s

1/(2.46 * 10^-14) = how many collision one electron encounters each second which is 4.07 * 10^13 !!!

Now multiply that times the volume of the wire (how many electrons the wire holds) which happens to be 4.5 * 10^23 and you get (drum roll please...)
1.83 * 10^37 collisions happening every single freakin' second. To try to grasp that number with greater awe, it is:
18300000000000000000000000000000000000 collisions every second!
Pretty damn amazing how much stuff is going on under your nose without you knowing it, huh? With my curiosity satisfied, it was time for an In 'n Out double double, or should be better known as 2(n) ;).

* I have thought about what you're probably thinking, is it possible that an electron travel down the wire without colliding into something? Well, if I were to take you out to the woods and blind fold you and told you to walk straight for a mile, you think that you would never hit a tree?