Powered by glolg
Display Preferences Most Recent Entries Chatterbox Blog Links Site Statistics Category Tags About Me, Myself and Gilbert XML RSS Feed
Sunday, Sep 17, 2006 - 19:45 SGT
Posted By: Gilbert

- -
A Pain, Explained


Waited a week for my skin to peel off, wasn't able to sleep properly for three nights. Ladies and gentlemen, boys and girls, if you must go out at midday like mad dogs and Englishmen, don't be macho, don't be a cock; Please, please slather on the 80-proof SPF sunblock.

$120.80 from $100 from Pretend Betting Week Two, but still a negative cumulative total - $193.30/$200. Portsmouth did the main job, and I would have backed them again on Saturday and made another collection, if the Premiership's consensus Big Five weren't duking it out today.

How often can one see a fixture list that reads Chelski vs Liverpool followed straight afterwards by Man U vs Arsenal? Likely once in a neon-blue moon, like when Man City win the Champions League. I've always felt Arsenal was a Henry team, as Cashley Cole bluntly pointed out while backstabbing just about everyone but the groundsman's cat back at his old club. Rooney was invisible against Celtic and Giggs is a huge loss, but Man U are at full strength otherwise and shouldn't pass up the chance to mire their old rivals in the relegation zone.

Pool could do themselves and Man U a big favour by holding Chelski - heck, take the three points, it would be even better. Neither have been especially impressive in front of goal, and since both are built from the back, a 7x return for no goals is tempting. The final match is something of an afterthought, and hardly a sure thing given Fulham's horrendous away record last season. All in all, it looks like a narrow victory or draw for Spurs.

$30 on Man U to beat Arsenal (at 1.78) - Following both head and heart
$10 on two goals in the above game (3.50) - Two-nil, three-one, four-two?
$30 on Liverpool (+1.5) vs Chelski (1.35) - Never won, but never made it easy
$10 on a Chelski-Liverpool draw (3.35) - Why not?
$10 on zero goals in the above game (7.00) - Indeed. Why not?
$10 on Fulham (+1.5) vs Spurs (1.45) - Fulham doing okay, Spurs not so much

Hokay, that done, let's open the next MSN-in query to Ask-Bert-A-Question. Our latest caller is edchong from... ok, you all know who he is, the guy with the biggest social conscience (especially when it involves his money too) this side of 4O, which isn't saying much. If we had the USA yearbook polls tradition, he might have been voted most likely to be the next Chee Soon Juan. (In case any of his prospective employers are Googling this up, I'm just joking. Honestly.)

Anyway, that day's question was,

i ask u ah
in computer all the info is recorded as either 0 or 1 righ
right
that means on a chip got billions of switches on/off corresponding to 0 or 1
ok then how does a computer "know" that maybe 010101010101 represents a letter, say A on the screen
?
i mean how to you control a computer to do that
if is just electrical circuits

Idiot that I am, I couldn't just type

i dunno

or even a more personally endearing

u ask me i ask who (censored) luv you

My immediate reaction was that it is all so easy, and then I realised that my courses never actually covered that exactly in any detail. Perhaps it is more under Comp Engineering? Like why the sky is blue appears simple (Rayleigh scattering, anyone?), but even a made-for-kids answer covers several pages and straddles several subdisciplines.

Just to put an end to this sorry matter, a complete study of which begins to look like it could fill a whole module or even a postgrad research course, I offer my own mostly baseless interpretation. Caveat reader.

Start with a light switch. No-one has a problem with that? Everyone fully understands electrons, protons, charges, conductors, impedence, alternating currents, drift velocities, etc? (Not me) Great! I'll carry on.

And everyone also knows the higher level abstractions: You type a key -> keyboard -> data cable -> PS/2 port -> motherboard microcontroller -> OS -> application software -> monitor. So no need to go into detail.

What can be do with light switches? We can put two in a row, one after the other; Voila, an AND gate! We can, in a fit of inspiration, place them in parallel - an OR gate! We can define the initial state of all switches to be open, then declare that some switches begin closed, thereby creating NOT gates. With these three, we can construct any Boolean sequence we wish. Interestingly, the NAND gate is sufficient for the same purpose, easily proven because AND, OR and NOT gates can all be derived from it. CS1104 FTW.

So, with switches we can simulate all these gates. Now imagine a lot of them, very very tiny in size. Millions, indeed soon billions of them. And flip-flops, and multiplexers, and cheeky little messages.


If I had US$80 billion, I wouldn't mind
(From About.com)

So that's what a processor is. What's RAM? Similarly microscopic capacitors, all very physical. I'm sure how they are manufactured and later manipulated at such terrifying speeds must be fascinating, but the concept is the same.

So, how does a computer know? Short answer: It doesn't. No more than a switch knows that it's brightening up the room, or a vending machine knows that it should dispense a can of soya bean when coins are plunked in and a button is mashed. What makes a PC ostensibly cleverer than either of these is that it has far, far more possible states, but if you enter some input, it follows the same rules, and if the relevant portions of the machine are in the same state, you get the very same result. Big surprise there.

Take something as basic as a Turing machine - it consists of a practically infinite tape, a finite alphabet, and a finite transition function that defines how the machine will behave, subject to the restriction that its head can only move one cell on the tape each step.

Suffice to say that this seemingly laughable toy can do anything a supercomputer can do, if we ignore the time component. Of course, for something as simple as addition, of say two banks of marked cells on the tape separated by a predefined separator symbol, we have to go through the inconvenience of marking down a special "head" symbol at the beginning of the two banks, then continually moving one way, erasing each marked cell as it is encountered and then laboriously crawling back in the other direction to deposit a counting symbol on the other side of the head symbol.

For multiplication of two banks of marked cells, the provision has to be taken to delete the start of one bank as soon as encountered, and then copy the whole other bank one-for-one as in addition, so that after all n cells of the first bank have been removed, the m cells of the second bank have been copied n times, thereby giving n*m as the final result, which is what we wanted all along; But this is as far as I will go.

Quite obviously most humans would have little interest in programming a Turing machine at this level of logical detail, and therefore are generally willing to trade off some efficiency for far greater ease. Instead of reinventing an addition function, compiler makers would probably just use the ADD machine code function to add the contents of two registers and place it in a third. Then higher-level language users would use the "+" command to ask the compiler to use ADD, and the end user of say the Calculator accessory would click a button to trigger a "+" to trigger an ADD.

Oh, and they say the first test of any compiler is to compile itself. Stunning.

Clearly, from those zeroes and ones zipping around to some nub playing DotA, a lot of layers are involved. The chip and memory designers, the assembly coders of the first compilers (though it appears that few bother to delve here any more), the OS programmers (Windows is mostly written in C, with some assembly at kernel and device driver level), the application programmers, and finally the nub.

The beauty of all this is that the nub doesn't need to know a shred about computers in general. He just needs to know the WC3 interface; In the same vein, many application programmers could care less about lower-level stuff. One doesn't need to know how a browser works to write HTML. Each layer introduces its own abstractions, and I'm not gonna try to fool anyone here - it's mind-bogglingly complicated. Does anyone living know exactly how it all comes together? Let's just say that I would like to meet the guy.

And oh, I still dunno why the sky is blue.



comments (1) - email - share - print - direct link
trackbacks (0) - trackback url


Next: Less Than Magical


Related Posts:
Economics Thus Far
What I Do
The Washing Machine
On The Money
On Economics

Back to top




1 comment


c. wenhoo said...

yees yees, tahnk you vely much


September 18, 2006 - 00:41 SGT     


Copyright © 2006-2019 GLYS. All Rights Reserved.