I uploaded some pictures from trips I took with my parents and friends around the Pacific Northwest (a fance name for Seattle's surroundings). Check them out:
http://keeda.stanford.edu/~radoshi/photos
I was just looking up previous blog entries and I realised that my blog has been relatively free of geeky material for a long time. Tch tch. So with profuse apologies to non-programmers happening to read this entry, here goes:
I recently read parts of a great survey paper by Paul Wilson on garbage collection techniques. It was a fantastic read and if you have not read it, a perusal is highly recommended. The paper starts out rather simple, explaining what GCs are and do and then gets pretty complicated as it gets into deeper GC algorithms, their analysis and how they work. This is not a summary, its just a quick note about garbage collection that I'd like to share. (Continue reading the extended...)
Garbage collectors are really cool. If you've ever programmed in Lisp, Java or C# (to name a few popular languages) chances are you've used a garbage collector. The basic premise is very simple - you use objects on the heap in whatever way you like and once the objects are no longer in use, the GC will reclaim the "garbage" objects.
I think GCs represent the next logical step in programming language evolution. Any language that does not support native garbage collectors (C/C++) is doomed. Doing manual memory management results in horrible code and the results of doing wrong memory management (very common) result in either a memory leak (did not delete) or a segfault (double delete). Ouch. Garbage collectors are made out to be inefficient and generally sucky. This blame is somewhat ill-deserved; very smart people have been researching these for a long time and modern GCs are very, very fast - certain GC variants can satisfy real-time guarantees as well.
So what does a GC do? As I mentioned above, a garbage collector collects.. garbage! Reclamation of garbage can be roughly split up into two tasks:
1. Figuring out what is garbage
2. Reclaiming this garbage (and making memory available for future use)
Caveat: In order to do either of these things, all garbage collectors must have a way to figure out the size of an object. Naturally, this makes writing a pluggable GC for (unmodified) C++ well nigh impossible. So lets ignore C++ for the moment (C++ garbage collectors have been implemented using templates and auto-pointers) and concentrate on languages such as C# and java which have type information embedded into each object. So now we know the exact size of each object as well as what fields within an object are references to other objects. Perfect.
How do we define garbage? First lets define what is not garbage - the stack, naturally. The globals. The stack and globals might have pointers to heap objects. So these heap objects aren't garbage either. The heap objects might have pointers to other heap objects and so on. Thus, starting from pointers on the stack and global variables, anything on the heap that is reachable through pointer traversal is a live object. Everything else, implicitly, is garbage.
The simplest (and perhaps most naive) algorithm we can think of is to reference count. Thus every object has a variable count; every pointer that references this object increments the count and as the pointer goes out of scope or gets destroyed, it decrements count. When the count of an object reaches zero, it can no longer be reached from anywhere and so can be safely deleted. Reference counting seems like a pretty fair algorithm - the two garbage collection stages described above are done at the same time. There is a fixed cost that is paid everytime a new pointer is initialized or a pointer goes out of scope.
If you'd like - think about what's wrong with reference counting. I'll go into that and some other techniques in a follow-up.
My TV is rather strange. There is something broken with its tuner so it can tune to either of two things: The Video Input or some random Chinese channel. Like all 99 "channels" self tune to one random Chinese channel. Without any intended offense to my chinese readers, this sucks.
Since by now the geeks who're reading this are going "Wait, wait, what.. how can this be" I'll explain a little. The TV in question is an old Sony 19" thingy. Its a self tuning kind, so there are no tuning knobs on the TV - in fact there is no control panel to speak of. Now for the interesting part - when the TV is cold, it starts up and tunes to everything just fine. After it warms up a bit - say 15 minutes or so, it detunes and retunes to 99 channels of Chinese. (At Stanford, this used to be 99 channels of weather). All this time, the Video channel is just fine. My diagnosis is that a capacitor or a coil on my tuning board is broken. But I can't be bothered to fix it. Or should I be. Hrm.
So I've gone back and forth multiple times on whether I need a new TV or not. I just can't seem to make up my mind. I think I do because this one only has one input, thus making it impossible for me to have my DVD player and XBOX hooked into it at the same time. Again, the geeks are thinking "waitaminute, xboxs can play DVDs!". True, but false. XBOXs have issues playing other region DVDs, video CDs and other things. So I bought another DVD player for like $30 that's much better.
I think I'm going to make a Fry's scouting trip today and see what's available. If you're a TV buff, and can recommend a decent TV in the 200-300 range, let me know. Plasma and other expensive stuff is not in consideration at this time.
I'm in LA over the weekend busy partying with my cousin after her graduation. I'm having a blast. Tonight I'm going to test if my alcohol tolerance has gone up. I have great hopes and truly believe that I can hold down more than one beer. I'll update you in a few hours about how that goes.
Party on!!
Splinter Cell used to be my favourite xbox game. No longer. Ninja Gaiden rocks. If you have an xbox handy, get the game today. That being said, I'm no longer playing it. I found that I don't have any time left for the rest of my life - it all gets sucked into that one game. I will return to it when I have copious amounts of free time once again (yes, that day will come soon).
Its not that there isn't anything interesting happening in my life. I have been rather overloaded with work and then have to do stuff with parents and such. Which leaves no time for life's other necessities (video games), which really sucks. I'm trying to get back to normality, so in the meanwhile, bear with me.