Sunday, May 9, 2010

The Computer Architecture, The Engineers and The Programmer.

I was lucky to see computer when it was still growing in India. My GWBASIC course in school (sometimes i used to get a BASICA floppy) would happily run on Modi-Olivetti 8086 machines. And I started to call myself a programmer. With GWBAISC ( programming language ) I thought I could do anything with the machine. But in fact it would drive me crazy thinking how people could code prince of Persia, while i would struggle to get a "block" in graphic mode move (XORing, And I learned about Blitting later). Few years later while going through Ray Duncan ( Advance MSDOS programming ) book it hit me, I came to know about 4 screens in x86 Architecture, where you loop through and give an impression of movement.

Architecture... is this important ?

Few years rolled by and I was caught in the likes of Assembly, C & Linux File-system, while I used to encounter "sizeof(int)", but Architecture still got a step motherly treatment from me. Architecture for me was "morris mano" and it ended with collage.

One day, being confident in C and assembly language i decided to code my own OS. As a challenge to myself and as a test to myself that if I claim I know every bit of this computer system, lets write a minimal 32bit protected OS. After all I know C and assembly, how hard could this be.

I was wrong. Very wrong. My pride too a beating, my ego was thrashed. With all the C and assembly I could not budge an inch with my new OS. I understood programming language is just a vehicle to express my ideas to the CPU. I must be friend with the structure of the computer or the Architecture. Once I shelved my C & UNIX books and got hold of Intel/AMD developers guide. My OS since then has made huge strides.

Now I understood GDT's & IDT's, why LDT's are not used ( seldom used ) after x386. Now i can take bare cpu and bring it up. I completely understood the relationship between ring0-3 and DPL. The call-gates, and why if you do not set up interrupt while OS bring-up and that interrupt is generated ... it goes for a triple fault. For many more please refer Intel/AMD manual. ;-)

People working on board bring-up or device driver, or any OS, knowledge of CPU Architecture is compulsory and it completes the programmer. Any training institution or collage or university who does not stress upon training Architecture leaves its students incomplete. And I see many esteem one's doing this...unfortunately.

I'll conclude this by quoting Intel Architecture S/w Developer Manual Starting Note " ... Refer all four volumes when evaluating your design needs".

No comments:

Post a Comment