Kernel corner: Don't be a hypocrite with the Linux kernel
sinuxs *
I hear you say, "what the heck is this article?". Yes, I'm pretty serious with the title of this article. Please don't be a hypocrite with the Linux kernel especially if you really don't (and not intended to) know how it's working inside.
When the kernel is open source and people are not serious to go along with the source code and playing with the beautiful beast inside it and enjoy the junkies of all these, it's of no use to play hypocrisy by simply saying that Linux is open-source and I gotta install it (or have?) N number of times or whatever.
It is really a hypocrisy (seriously) when you couldn't walkthrough the kernel even a single source file (or assembly) and claiming and endorsing that Linux kernel is open-source and it ought to be a serious threat to Microsoft and alike and dot dot dot etc.
Linux kernel is open and free especially for hackers (or people who've a tendency to learn it) and *NOT* for people who couldn't have the stamina to look into under its hoods. What use(and meaningful) is the word *OPEN* when you cannot actually open and see it inside! That is the definition of *CLOSE* instead (unfortunately :-().
The kernel is fanatically an interesting field where, once you're inside it, you never know where your code flow is coming from and going to. Oftentimes, people use to say UNIX is the masterpiece software of this century ever created by mankind.
I, personally, don't appreciate this and various ideas of UNIX philosophy like, 'Everything is a File' etc. Rather, I\'m interested with the ways the ideas are implemented beautifully by pushing you eventually inside the code like a Matrix code glowing you around with those interwinded algorithms and data structures.
Jesus! this is heaven. I truly believe, this is one way to reach the heaven. Let's try to see whether we reach heaven or hell. You're booting your system up. The _POWER_SIGNAL_ goes to the Motherboard (if you don't have any problem with your Power supply) and ignites the M! otherboa rd chips (like North bridge, South Bridge, CMOS/RTC, Timer chips, SCSI drives/adapters, Super I/O, USB controller etc) and finally loading the processor registers that actually points to the first address of BIOS.
The BIOS checks and validates your available necesary hardwares (Memory, Video, I/O devices), populates the IVT(Interrupt vector table storing various drivers handlers) and ultimately load your kernel. The kernel image is in compress image(BZImage) having the GZIP decompression alogorithm at the start of it. The real mode initialization of the kernel takes place and finally it decompresses its image by jumping into the GZIP algorithm part and start loading to the first 1MB of the physical memory.
Whew!!! this is getting the heck out of me. See... we're seeing what is going under the hood when you're booting the machine. This is a lifetime opportunity we're getting such an open source code that we walkthrough and see the lines of what it's doing. Microsoft never ever given such a golden opportunity! Bingo! I shoot at the feets of Microsoft!
Oh, yeah, the kernel code is in real mode. In real mode it will do all necessary preapration so that it will jump to the protected mode. This peroid involves the setting up of important Intel architecure data structures like GDT, IDT IDT etc. You need to fill up all the entries of IDT - Exceptions (Fault/Trap/Abort) and Interrupts, otherwise, a message 'Unknown Inteerupts' will be displayed out. Fine. Then the kernel will set up the paging directory and initial page tables.
When all protected mode preparation are done, it'll jump to the protected mode by setting bits on CR0 processor register. Once the kernel is in protected mode, it'll initialize all kernel data structures one by one. It will replace all the 16 bit drivers of BIOS with the 32 bit ones. All the necessary device drivers intialization entry points will be called so the the physical devices and their drivers will be registered with the kernel.
The device driver faciliates two important fu! nctions - provide interfaces with the application through system calls AND interfaces with the device controller through Interrupts handlers. If you want to scratch a new device driver with the Linus kenel tree, you need to shoot a mail to him becasue he has frozen all the good device driver numbers. ha ha ha.
Oh, I've missed one important thing - the heartbeat of the kernel, the Timer chip setting. The kernel will calibrate the timer frequency and accordingly will interrupt for every HZ defined on it. Then the kernel will eventually initialzes all the manager - the memory manager, the process manager, the file manager, the I/O manager, the network manager etc.
The intial phase of the memory manager is the bootmem allocator. It's a simple first-fit memory management algorithm. Before, the kernel starts your main Buddy allocator, the bootmem allocator will be started. It basicaly marks all the reserved pages (noted by the BIOS functions like int 0xe820, int 0xe8201, int 0x88h) and usable pages.
And once the main memory manager is started, it'll copied all the data from the bootmem allocator and kill it sadistically. And when all the managers are in wheel, the kernel will fork off the first process - the init process and the rest is the history. If you're tempted to know in detail the above situation, at the minimal (with no guarantee) following understanding are in order:-
- Intel x86 architecture
- GNU assembly language
- Extended GNU inline assembly
- PC hardware (RTC/CMOS, Timer, 8259A/IOAPIC, DMA controller, North bridge/southbridge, Disk geometry,Video RAM/ROM, BIOS etc)
- BIOS booting phase
- Linux Loader (GRUB) code.
- Real mode/ protected mode Kernel context.
- Bash Scripts
- what else???
If you do not want to know these and no intention to learn them, please stop endorsing about Linux kernel. Because when we speak of Linux, it basically refers to the kernel, per Linus, and hence saying and endorsing something without experiencing/knowing/ enjoying them is fanatically a humiliation to the creator and developers of it.
Linus will laugh flat to the floor at this kind of hypocrisy. The kernel is a heaven. The kernel patch is written for every hour. Enjoy the bliss of this beautiful beast before it\'s too bloated and difficult to control with. The 2.4 version, per me, is the right version to start with.
I suggest the 2.4 version because it\'s the history of the 2.6 current version. Unless we know the history of a thing, how would we appreciate the beauty of its creation? Welcome to the real paradise!!!
Sign off,
[A kernel junky]
* sinuxs (A pseudonym and a "kernel junky" ) contributes to e-pao.net regularly. The writer can be contacted at sinuxs(at)yahoo(dot)com
This article was webcasted on October 12th, 2009.
* Comments posted by users in this discussion thread and other parts of this site are opinions of the individuals posting them (whose user ID is displayed alongside) and not the views of e-pao.net. We strongly recommend that users exercise responsibility, sensitivity and caution over language while writing your opinions which will be seen and read by other users. Please read a complete Guideline on using comments on this website.