Introspection..

Another pebble in the river,
Unearthed in sands of time,
I feel fulfilled, satisfied when drunk
among friends who barely understand but withstand.

This psyche communicates better in code
than in a language foretold.
It is maybe the recursion, the patterns
that fit like solutions to a maze.

I stumble and bumble my way across,
stepping on foots of people misunderstood;
Numbers, alone, stay above, beyond criticism,
You get it or you just dont.

Amadeus, Pi, Matrix, Fight club, Inception,
Movies of infinite precision;
What I perceive, no one else does;
Childish yes but vast the possibility.

I have no regrets. I am what I am.
Folly is ye to interpret.

2

The Windows XP PC Boot Process

  Power supply switched on. rarrow The power supply performs a self-test – When all voltages and current levels are acceptable, the supply indicates that the power is stable and sends the Power Good signal to the processor. The time from switch-on to Power Good is usually between .1 and .5 seconds.
  darrow    
  The microprocessor timer chip receives the Power Good signal. rarrow With the arrival of the Power Good signal the timer chip stops sending reset signals to the processor allowing the CPU to begin operations.
  darrow    
  The CPU starts executing the ROM BIOS code. rarrow The CPU loads the ROM BIOS starting at ROM memory address FFFF:0000 which is only 16 bytes from the top of ROM memory. As such it contains only a JMP (jump) instruction that points to the actual address of the ROM BIOS code.
  darrow    
  The ROM BIOS performs a basic test of central hardware to verify basic functionality. rarrow Any errors that occur at this point in the boot process will be reported by means of ‘beep-codes’ because the video subsystem has not yet been initialized.
  darrow    
  The BIOS searches for adapters that may need to load their own ROM BIOS routines. rarrow Video adapters provide the most common source of adapter ROM BIOS. The start-up BIOS routines scan memory addresses C000:0000 through C780:0000 to find video ROM. An error loading any adapter ROM generates an error such as:

XXXX ROM Error

where XXXX represents the segment address of the failed module.

  darrow    
  The ROM BIOS checks to see if this is a ‘cold-start’ or a ‘warm-start’ rarrow To determine whether this is a warm-start or a cold start the ROM BIOS startup routines check the value of two bytes located at memory location 0000:0472. Any value other than 1234h indicates that this is a cold-start.
  darrow    
  If this is a cold-start the ROM BIOS executes a full POST (Power On Self Test). If this is a warm-start the memory test portion of the POST is switched off. rarrow The POST can be broken down into three components:
The Video Test initializes the video adapter, tests the video card and video memory, and displays configuration information or any errors.
The BIOS Identification displays the BIOS version, manufacturer, and date. The Memory Test tests the memory chips and displays a running sum of installed memory.
  darrow   Errors the occur during the POST can be classified as either ‘fatal’ or ‘non-fatal’. A non-fatal error will typically display an error message on screen and allow the system to continue the boot process. A fatal error, on the other hand, stops the process of booting the computer and is generally signaled by a series of beep-codes.
  The BIOS locates and reads the configuration information stored in CMOS. rarrow CMOS (which stands for Complementary Metal-Oxide Semiconductor) is a small area of memory (64 bytes) which is maintained by the current of a small battery attached to the motherboard. Most importantly for the ROM BIOS startup routines CMOS indicates the order in which drives should be examined for an operating systems – floppy first, CD-Rom first, or fixed disk first.
Fixed Disk darrow    
  If the first bootable disk is a fixed disk the BIOS examines the very first sector of the disk for a Master Boot Record (MBR). For a floppy the BIOS looks for a Boot Record in the very first sector. rarrow On a fixed disk the Master Boot Record occupies the very first sector at cylinder 0, head 0, sector 1. It is 512 bytes in size. If this sector is found it is loaded into memory at address 0000:7C00 and tested for a valid signature. A valid signature would be the value 55AAh in the last two bytes. Lacking an MBR or a valid signature the boot process halts with an error message which might read:

NO ROM BASIC – SYSTEM HALTED

A Master Boot Record is made up of two parts – the partition table which describes the layout of the fixed disk and the partition loader code which includes instructions for continuing the boot process.

  darrow    
MBR With a valid MBR loaded into memory the BIOS transfers control of the boot process to the partition loader code that takes up most of the 512 bytes of the MBR. rarrow The process of installing multiple operating systems on a single PC usually involves replacing the original partition loader code with a Boot Loader program that allows the user to select the specific fixed disk to load in the next step of the process
  darrow    
Partition Table The partition loader (or Boot Loader) examines the partition table for a partition marked as active. The partition loader then searches the very first sector of that partition for a Boot Record. rarrow The Boot Record is also 512 bytes and contains a table that describes the characteristics of the partition (number of bytes per sectors, number of sectors per cluster, etc.) and also the jump code that locates the first of the operating system files (IO.SYS in DOS).
Operating System darrow    
Boot Record The active partition’s boot record is checked for a valid boot signature and if found the boot sector code is executed as a program. rarrow The loading of Windows XP is controlled by the file NTLDR which is a hidden, system file that resides in the root directory of the system partition. NTLDR will load XP in four stages:

1) Initial Boot Loader Phase
2) Operating System selection
3) Hardware Detection
4) Configuration Selection

  darrow    
NTLDR
Initial Phase
During the initial phase NTLDR switches the processor from real-mode to protected mode which places the processor in 32-bit memory mode and turns memory paging on. It then loads the appropriate mini-file system drivers to allow NTLDR to load files from a partition formatted with any of the files systems supported by XP. rarrow Windows XP supports partitions formatted with either the FAT-16, FAT-32, or NTFS file system.
  darrow    
NTLDR
OS Selection
BOOT.INI
If the file BOOT.INI is located in the root directory NTLDR will read it’s contents into
memory. If BOOT.INI contains entries for more than one operating system NTLDR will stop the boot sequence at this point, display a menu of choices, and wait for a specified period of time for the user to make a selection.
rarrow If the file BOOT.INI is not found in the root directory NTLDR will continue the boot
sequence and attempt to load XP from the first partition of the first disk, typically C:.
  darrow    
F8 Assuming that the operating system being loaded is Windows NT, 2000, or XP pressing F8 at this stage of the boot sequence to display various boot options including “Safe Mode” and “Last Known Good Configuration” rarrow After each successful boot sequence XP makes a copy of the current combination of driver and system settings and stores it as the Last Known Good Configuration. This collection of settings can be used to boot the system subsequently if the installation of some new device has caused a boot failure.
  darrow    
NTLDR
Hardware Detection
If the selected operating system is XP, NTLDR will continue the boot process by locating and loading the DOS based NTDETECT.COM program to perform hardware detection. rarrow NTDETECT.COM collects a list of currently installed hardware components and returns this list for later inclusion in the registry under the HKEY_LOCAL_MACHINEHARDWARE key.
  darrow    
NTLDR
Configuration Selection
If this computer has
more than one defined Hardware Profile the NTLDR program will stop at
this point and display the Hardware Profiles/Configuration Recovery
menu.
rarrow Lacking more than one Hardware Profile NTLDR will skip this step and not display this menu.
  darrow    
Kernel Load After selecting a hardware configuration (if necessary) NTLDR begins loading the XP kernel (NTOSKRNL.EXE). rarrow During the loading of the kernel (but before it is initialized) NTLDR remains in control of the computer. The screen is cleared and a series of white rectangles progress across the bottom of the screen. NTLDR also loads the Hardware Abstraction Layer (HAL.DLL) at this time which will insulate the kernel from hardware. Both files are located in the system32 directory.
  darrow    
NTLDR
Boot
Device Drivers
NTLDR now loads device drivers that are marked as boot devices. With the loading of these drivers NTLDR relinquishes control of the computer. rarrow Every driver has a registry subkey entry under HKEY_LOCAL_MACHINE
SYSTEMServices. Any driver that has a Start value of SERVICE_BOOT_START is considered a device to start at boot up. A period is printed to the screen for each loaded file (unless the /SOS switch is used in which case file names are printed.
  darrow    
Kernel Initialization NTOSKRNL goes through two phases in its boot process – phase 0 and phase 1. Phase 0 initializes just enough of the microkernel and Executive subsystems so that basic services required for the completion of initialization become available.. At this point, the system display a graphical screen with a status bar indicating load status. rarrow XP disables interrupts during phase 0 and enables them before phase 1. The HAL is called to prepare the interrupt controller; the Memory Manager, Object Manager, Security Reference Monitor, and Process Manager are initialized.

Phase 1 begins when the HAL is called to prepare the system to accept interrupts from devices. If more than one processor is present the additional processors are initialized at this point. All Executive subsystems are reinitialized in the following order:

1) Object Manager
2) Executive
3) Microkernel
4) Security Reference Monitor
5) Memory Manager
6) Cache Manager
7) LPCS
8) I/O Manager
9) Process Manager

  darrow    
I/O Manager The initialization of I/O Manager begins the process of loading all the systems driver files. Picking up where NTLDR left off, it first finishes the loading of boot
devices. Next it assembles a prioritized list of drivers and attempts to load each in turn.
rarrow The failure of a driver to load may prompt NT to reboot and try to start the system using the values stored in the Last Known Good Configuration.
  darrow    
SMSS The last task for phase 1 initialization of the kernel is to launch the Session Manager Subsystem (SMSS). SMSS is responsible for creating the user-mode environment that provides the visible interface to NT. rarrow SMSS runs in user-mode but unlike other user-mode applications SMSS is considered a trusted part of the operating system and is also a native application (it uses only core Executive functions). These two features allow SMSS to start the graphics subsystem and login processes.
  darrow    
win32k.sys SMSS loads the win32k.sys device driver which implements the Win32 graphics subsystem. rarrow Shortly after win32k.sys starts it switches the screen into graphics mode. The Services Subsystem now starts all services mark as Auto Start. Once all devices and services are started the boot is deemed successful and this configuration is saved as the Last Known Good Configuration.
  darrow    
Logon The XP boot process is not considered complete until a user has successfully logged onto the system. The process is begun by the WINLOGON.EXE file which is loaded as a service by the kernel and continued by the Local Security Authority (LSASS.EXE) which displays the logon dialog box. rarrow This dialog box appears at approximately the time that the Services Subsystem starts the network service.

My .NET blog is up again !

Well finally, after a long time, my .NET blog over at Dotnetjunkies is back up with an updated version of .TEXT. Not that i would have blogged non-stop with all the work i’ve been having all this time but right now, it really does make sense for me to blog again on some programming tips and tricks.

My bright side of my research, apart from the beautiful physics behind it all, is that it involves loads of programming. And i just recently decided to shift from MATLAB to .NET to get my research going. One of the main reasons behind that decision was ‘Speed’ ! Before you start shouting at me, yes, C++ would have been a more viable option, considering that i have lots of computation involving Matrices and Vectors but my benchmarks with some basic ported code from MATLAB did prove that the speed of C#.NET is good enough for now. I do not think that once the IL is converted into native image, with all the code and compiler optimizations inserted in at the right places, there will be a great difference in performance between C++ and C#.

So coming back to my point, i have learnt lots of algorithms, tips and bumped into some great software on the way while doing my research and believe that i can start writing again on my blog. Eventhough there were butt loads of comment spam before, i guess that the new version has a control over that and would now be a better place to write my programming experience from now on.

So watch out soon for my .NET post after almost exactly a year of hiatus.

Interesting Programming contest …

WARNING : This post has nothing related to .NET or any of the current technologies. I got this as a forwarded mail from a friend. It details about a programming contest once held in CMU and the results of it. Not sure whether it is true, but sure is a very interesting read. If you are still interested, then read on !…(read more)

Free .NET IDEs

There has been a lot of talk about how expensive our favorite IDE, VS.NET is right now. Charles assured in one of the replies to the post that the issue is being discussed internally and will be addressed soon. Cool ! Actually, i don’t know what stand to take on this issue. Is your productivity important or the one time benefit of buying VS.NET professional edition ? It really is very confusing …

Anyway, as our quest for a free .NET IDE continues, here’s one to quench that ! Check out Eclipse for .NET ! Infact, i think i picked up this link from one of the replies, but not sure though… Eclipse as most of you would have heard is an awesome product which was developed by IBM and then later opensourced. I have heard quite a lot from fellow Java devs that the IDE is powerful compared to IntelliJ‘s IDE. Well i’m not the judge in either case but i definitely think that the plugin will help all those cribbing for a good IDE with C# support.

Again, #develop as many of you already know, is a very flexible IDE completely written in C# which is opensource and freely available. There is rarely something extra needed apart from #develop and ASP.NET Webmatrix for developing WinForm and WebForm code in .NET. What more do you want ?

And apart from all that, for the most hardcore developer who doesn’t care for IDE features, there is one really cool app to write code in C#. Ofcourse it will not work at all for enterprise level apps but for smaller projects, definitely useful. Check out Textpad. FYI, its got syntax highlighting functionality for C# too .. Download the file here.

Code on …

I guess, this is a pretty decent list of free IDEs to work on .NET right now. I might have missed a lot of other ones here but these are the ones that stand out quite prominently, i should say 🙂

Update : Just found out that the Notepad2 free utility provided at Flo’s freeware site also supports syntax highlighting for C# ! And the best part is that the whole thing is customizable, just like Textpad’s syntax highlight feature 🙂 Cool.

GMail Gems

Gmail Gems – Yeah you guessed it right. It is related to Google’s new email service. What better way to teach people about GMail than to open up a weblog and evangelize it !

Read more on Gmail Gems or Secrets of the Gmail Wizards 

Cool HTML META tag trick !

I was recently browsing through some links and in the end reached this page. Maybe you’ve looked into such pages before but this was the first one for me !

The page looks very normal but the animation effects that happened when it loads in the screen was really way too cool ! I was wondering first that it might be some scripting trick and so dived into the source to have a closer look. But i didn’t find any such scripts in any of the pages. It was really scary because i knew that it will take pages of script to get that kind of thing working but this page didn’t have any such reference. And then, in the top, there was this magic META tag which did the trick silently ! Check this out.

<meta http-equiv=”Page-Enter” content=”revealTrans(Duration=1.0,Transition=23)”>
<meta http-equiv=”Page-Exit” content=”revealTrans(Duration=1.0,Transition=23)”>

Awesome !!! The page really has a very creative effect eventhough the author of the page didn’t have to spend more than probably 2 mins to whip it up and include it in the page. If you were to do this in ASP.NET 2.0, we could probably include this in a Master page for the site and be done with it !

Speaking of META tags, check out this site which has a complete list of all the valid META tags.

Also check out Shital Shah’s NotepadX. It does really look cool, not to mention the source is also included ! Very cool.

Impressions on Devdays India 2004

‘DevDays’ – my first MS event in my short software career till now. I definitely was excited about it and after reading through the agenda covering Whidbey and Yukon, I had expectated quite a bit of mental workout. I got a pass for Devdays Bangalore after a lot of nail-biting suspenses and finally on May 5, i hoped all that was expected was about to happen.

The opening keynote was very normal, not something i had expected after reading through some of the opening notes that have been delivered recently in many conferences. hmm.. Well after that, another developer who spoke, promised us to show the nitty-gritties of programming because this is ‘DevDays’ ! Ha, there’s something assuring, i thought.

Then we moved on to the technical sessions … the interesting bits eh !!

The first one was about ASP.NET 2.0. They spoke about Master pages, personalisation, Role based authentication as all inbuilt features in the upcoming ASP.NET versions. Thats cool. But haven’t i already read all that online. Show me something else interesting, something thought provoking, some complex application where it could be used, saving valuable developer time. But ahem, to my dissapointment, the session ended very soon without any surprises. Even the question and answer session at the end of it was very short 🙁

Then was the session on Winforms and CLR 2.0. The speaker detailed about Generics, partial types and Iterators. Wow cool ! Again, can’t anyone read the online entries from innumerable people talking about these basics. This is not what i want or expected. What happened to the anonymous delegates, and details on all that was mentioned and all the other really neat stuff that the MS devs have spent hours to include in the upcoming release ?! Not a word. Very dissapointing really … About Winforms, there was something new, some new controls but not anything other than that they have shown in the Winforms site.

Ok. Now comes the hands on session. How cool ! Am gonna do some cool code in Whidbey finally. I do not have to toil anymore with collections that are loosely typed with Objects. We can create strongly typed Generic classes over which we could apply constraints and manage to create a robust collection !!! With all that hope we entered the hall, only to find that there weren’t enough seats left. Ugh. Share the computer with a fellow programmer. Ok. Not bad. We could do something like XP here, aha. Or so i thought. The instructor got onto the podium and started dictating exactly what to do. Hello ! These are not kids here for God’s sake. Do give us the requirements, and we will code it out. If we need help, we will look into Google, MSDN or ask help from someone who knows this stuff. Don’t and Never dictate. After 10 mins, i lost all the vigor with which i entered into the place. So much for hands-on sessions …

After the lunch there was the Yukon session. There were quite a bit of surprisingly new things. But probably IMHO there was quite a bit of focus of the Reporting services, which could have been dealt with in later sessions. But anyway this one was good ! Ah at last. Then came the hands-on for Yukon. Oh God will these people never change their ways … More dictation again …

It was in the back of my mind that we have the ‘Ask the experts’ session anyway to clear all our doubts. No problem. Since this was scheduled for more than an hour, we were expecting to see some interesting questions and some thought provoking answers here. But, it was dissapointing again ! Not on the part of the experts, but on the developer’s side.

Certain things dawned upon me then. Ofcourse I was not the only guy who was bugged by this contentless showcase but then we have all been following blogs and all the discussion that has been happening in the past year. May be that is the reason why these sessions weren’t interesting at all. As someone said in the Keynote, I was expecting to see some hardcore nitty-gritties of programming in Whidbey and Yukon but instead it just turned out to be an overview of the basics. There could have also been an indepth session on the CLR 2.0 which covers behind the scenes on the exact kind of things that the CLR does for each of the new constructs and how it is being handled. That would have been very interesting. Also, I would have certainly liked it a lot if the speakers didn’t treat the developers like kids and start popularising the absolute ‘drag-drop-build an application’ philosophy.

Well, at the end of the day, for all the money’s worth, we got a bunch of 4 CDs containing Whidbey, ASP.NET Resource Kit and an Infopath SDK ! Cool ! But wait, where’s my Yukon ??! Hey, please give me a copy … Why did you forget that ?!

There goes my perfect sessions. What a start 🙁

Scoble, is there any reason or background why the DevDays sessions were like this in India ?! I’m sure i am not the only one with this opinion. Mahesh, Babu shared my opinion about the event and so did many others who had come over. Any thoughts or comments anyone ?