Sunday, April 03, 2005

Experiments of a techie mind...

Yey!

Got a spare 2G hard disk which I decided
to use for testing purposes. A very ambitious
idea is to make a minimal filesystem
implementation. Now I am frantically searching
for my OS book. To begin with, I decided to
write a generic free pool manager. Pretty
simple linked list implementation.

Half-Me: No wait! This might not be very efficient.

Other half: Okay, let me templatize this thing so
that it'll work with any sort of
linked list implementation.

Half-me: Sounds good. As one of the specializations,
Make a bitset implementation of the list.

Other half: Great idea. Man! Where were you all
these days?!

That was me conversing with myself :-)

So now I have a List template class. And 2
specializations. One is a normal PointerList
that makes use of pointers as iterators. Other
is a BitList using std::bitset to use memory
sparingly. And I wrote a test program to test
all the functions of both specialized classes.

Something seemed wrong! While debugging...

Me: Okay, until here its ok. Lets step into
this PointerList::getNumNodes() function.

Debugger: Hello Srinivas. You're now in
BitList::getNumNodes() function.

Me: Aye?! You must be mistaken. I've called
it from a PointerList object. Lets try
again...

Debugger: Hello Srinivas. You're now in
BitList::getNumNodes() function.


Me: What the !$#@%$^&%$@?!?!

Half-me: Wait dood! Remember what the MSDN
blog said. If two function are
similar, the compiler could have
generated only a single copy of it
and the debugger can show any of
the function names.

Other half: Ya. Thats right. You know, this
might be a design flaw. If both
functions are similar, I can move
it to the super class. Silly me!

Now the stuff is working as expected. Still
have not thought about what to tackle next.
Probably the allocation manager.

More later.

3 comments:

  1. **bows,kowtows and does similar things**
    loved ur last few posts....ooh and i can see the 'chnages' too. the template is a good vehicle to start off the change with...looks awesomer!
    take care...

    ReplyDelete
  2. @manu: coming next - a few photos here n there! and more technical posts... beware!!! :-))

    ReplyDelete
  3. shit! that rhymed!

    ... here n there
    ......... beware

    lol...

    ReplyDelete

What I want to say is: