To PhD or not to PhD?

Every Master’s student in a research university would have had to face this question at some point during their stay. For some, it’s been a no-brainer. Not for me, it’s easily the most difficult decision I’ve ever faced in my life.

On one hand, there’s the opportunity to work for a corporation, draw a handsome salary and help millions of people today by writing great software. On the other hand, there’s the opportunity to spend the next 5 years of my life with just enough money to survive on ramen, working on a really hard problem no one knows the solution to and derive satisfaction from the fact that my work might help millions of people tomorrow.

Computer science is also one of those fields where getting a PhD doesn’t mean you have to become a professor. Not that I don’t enjoy teaching, as a matter of fact I love teaching, but it’s comforting to know that you can always go back to what you sacrificed. The fruits of research in computer science typically reach mass consumption much faster than other fields, and several silicon valley companies specifically target doctorates for recruiting. Not to mention, you could always dropout — aren’t a lot of great institutions founded that way? ;-)

All of this tilts the scale a bit towards PhD, but this decision requires many more months of thinking! What are your thoughts on the matter? Have you had to make such a decision? What did you choose and why?

Life in the Netherlands

Well, it’s been a whole month since I arrived in Amsterdam, time to reflect on life here so far.

It seems as if everyone here speaks English, so language hasn’t been a problem. Everyday things like buying groceries and asking for directions is not a problem – the only time I wished I knew Dutch was when reading instructions for cooking the noodles I had bought. Solved that problem by manually typing in the instructions on Google Translate :)

I bought an iPhone 3G recently (after a lot of paperwork – the Dutch really seem to like paperwork), so I’ve been trying to translate random dutch words I see just to get a feel of what the language is like. Not that it’s required – anyone can comfortably live in Amsterdam without knowing a single word. Speaking of the iPhone, the 3G network coverage in the city is great and speeds are quite good (unlike the AT&T coverage in the US, from what I hear). A group of international students took a trip to The Hague last week (Den Haag in Dutch, capital of  the Netherlands, pictures here) and I got good network coverage throughout the trip.

Eating out is, unfortunately, quite expensive (compared to India or even the USA). A medium size pizza costs around 10 Euros, so that’s a treat reserved for, say, once a week. That means I would have to cook, but I’ve so far managed to avoid doing that by getting as many ready-to-eat or easy-to-cook packaged foods as I can.

Movies release really late sometimes, so that can be irritating, as an example, ‘Wanted’ came out just last week. Well, atleast they play them in the native language (English), so that’s a consolation.

The weather is quite pleasant, though it rains a lot here, so cloudy days are pretty frequent (which I don’t like). The weather is also quite unpredicatble, you may start your day with sunshine but you’re taught to carry your umbrella/raincoat nevertheless. Waiting to see how cold the winter gets, I’ve heard it doesn’t go as cold as the rest of Europe which is good for me.

The public transportation system is simply fantastic. You buy a paper strip called a strippenkaart and you can use that for travel on all of the cities’ buses, trams and metro. All parts of the city are well connected, and there’s a night bus system for those late party nights (incidentally, Amsterdam’s nightlife is also just as excellent). People here are not as addicted to cars and gas as the Americans – Amsterdam is also known as the bicycle capital of the world. 95% of the streets have a dedicated bike lane and given the relatively small size of the city (atleast compared to what I’m used to) – you don’t need to look further than a bicycle for all your transportation needs in the city. Overall, a pretty active and healthy lifestyle.

Dutch cuisine is not quite famous for anything. This is the first time I’ve had fries with mayonaisse though, and I think I really like it. Stroopwafels are my favorite dutch snack and are ideal anytime of the day with a hot beverage. It’s not hard being a vegetarian here, most restaurants have a variety of options.

The internet speeds are amazing, I don’t think I’ve ever seen bandwidths like these anywhere before 8)

The people are friendly, though my view may be a bit warped because most of the people I interact with are students from the university (and a majority of them are international). It’s amazing though, I’ve met people from more than 30 countries covering all the continents (except for Antarctica, of course), Amsterdam is a really international city.

The university is great, and considerably different from the higher educational institutes in India. The curriculum is pretty flexible, the instructors are open and honest in their handling of the course. Attendance isn’t compulsory, and you can drink coffee in class if you like. Classes are also longer, lasting from 2 to 3 hours with 15 minute breaks in between. Laboratories are well-equipped and nicely maintained by a dedicated IT team. I did hear about all of this, but it’s nice to actually experience learning in an environment like this!

The other big change for me is that I’m meeting students from non-technology backgrounds. Having done my Bachelors in an Engineering college, I’ve grown used to a ‘geeky’ environment which I began taking for granted. It’s refreshing to actually talk to people from other backgrounds like Law, Literature, Finance, Management and Medicine (though I think I’m not very good at this ’socializing’ thingy). Also, the female-male ratio at the university is a LOT higher than what I’m used to – that’s great, right? ;)

Shops close at 6pm most days, except for Thursdays, which is the ’shopping night’. That’s weird though, because everyone has to work on Fridays, why didn’t they pick Friday night? The Dutch also have their parties and get-togethers (or Borrels, as they are called) on Thursday nights. Bah, why not pick a weekend like everyone else in the world :roll:

Well, that’s all I can think of right now. I’m going to try and make the most of my time here! Already have trips planned in October to Barcelona, Spain for MozCamp EU; and Volos, Greece for IWP9.

Until the next post!

Hallo uit Amsterdam!

After a (relatively) short flight, I landed at the Amsterdam Schiphol airport the day before yesterday. I was greeted by a student from the ESN-VUNiverse, who explained the excellent public transportation system of Amsterdam while making the trip back. Getting to Uilenstede (a student housing community in Amstelveen, where I have a room) was a breeze, we reached in just around half-an-hour.

The first thing I noticed about Amsterdam is how much like a city it doesn’t look. It looks more like a quaint little town – there are no huge skyscrapers or crowded streets – overall very pleasing to the eye. The weather is pleasant, but mostly rain and clouds – haven’t seen much sunshine since I got here :(

We arrived at my ‘corridor’, protected by a door of its own. Every corridor has 12 dutch students and 2 international students, sharing a common kitchen. I proceeded to my ‘unit’, which is basically my room – it is a lot bigger and cleaner than my previous room at MNIT.

Internet and Cable were ready to go from the very first day. I’m loving this place :)

Yesterday, we had the ‘Word of Welcome’. I wasted no time in buying a bicycle, the standard transport vehicle in Amsterdam, so my trip to the university was a quick 10 minute ride. Most of the streets in Amsterdam have their own dedicated bicycle paths, complete with their own traffic lights. Bicycle theft, however, is also very common; so common in fact, that some people call it the ‘national sport’!

Immediately after lunch, we had the introduction programme at the faculty of sciences where we got upto speed with all the practical stuff that needs to be done (opening a bank account, registration with the municipality and so on). Then, we got a tour of the faculty: very very impressive! In the evening, we had a small gathering with the staff for drinks: I finally met Prof. Andrew Tanenbaum and Prof. Maarten van Steen :D

Another thing I love about Amsterdam is that everyone speaks excellent English, and they’re not shy of showing off their bilingual skills. That makes it a lot easier for foriegners like us to settle down quickly. I am also trying to learn a few Dutch words though. I’m pretty sure I am going to have a fantastic time for the next two years: the course, the staff, the city, and the people are all top-class.

Classes start on September 1; but meanwhile, ESN-VUniverse has organized a few events that I’ll be attending. This weekend, we are touring Amsterdam, doing a canal cruise, some waterbiking and cycling. See you next post!

Turning Point

Yesterday, I wrote my last examination; and that would mean that I am a Bachelor of Technology now*. It reminds me of my last board examination in Class XII, a little over 4 years ago. That was the first major crossroad in my life, and here I am again at my second. Looking back on the last 4 years of college life, I can easily conclude that they played the most significant role in shaping me into the individual I am today – technically and socially – and I am confident that I made the right choices along the way.

* (Conditions Apply)

What now? A graduate in my position has two choices: a) To work, or, b) To study further. Now, this one is a difficult choice to make, and there’s no saying what’s best for you. I haven’t thought about it all that much, but I am definitely more inclined towards earning a Masters degree at a minimum. To that effect, I had applied to several colleges in California (you know why), in addition to the Vrije Universiteit and EPFL. I got acceptances from UC Irvine and VU – I think I will fit better at VU because the course (Masters in Parallel and Distributed Computer Systems) looks really interesting to me – and also because Amsterdam is a better city than Irvine :p

I also have plans for the summer: I’m really excited to be a part of the Mozilla Interns program this year. My VISA was granted a few weeks earlier after a (to my surprise) really brief interview at the US Embassy in New Delhi. I’ll be joining the team at Mozilla Labs to hack on Weave, beginning May 19. This summer is going to be really fun, because apart from the awesomeness of being paid to write open source code at one of the best organizations in the world, this will also be my first trip to the land of opportunities. Hooray :)

Well, I still have 7 days more to spend at college. The parting is going to be bittersweet – while I’m going to be sad to leave my friends and college life (which is way more cooler than normal life, if you didn’t know), I’m also really enthusiastic and curious about where my future is going to take me.

Adventuring with a.out

The first step in the Glendix project was to write a binary loader for the Plan 9 a.out format. Linux has a clean interface for registering new binary format handlers from a module. Basically, you define a structure of type linux_binfmt and call register_binfmt during initialization of the module. Now all that’s left to do is implement the three functions that you pointed to in your structure: load_binary, load_shlib and core_dump.

Luckily for me, all Plan 9 executables are statically linked so I can just leave load_shlib as NULL. core_dump is also not that important during the development stages, although the final product must definitely implement it. To get a feel of what I needed to do in load_binary, I decided to take a peek into some of the other binary format handlers. I tried to comprehend the code for ELF with not much luck. I then turned to UTLK, which helped me understand what was going on. I highly recommend the book for anyone interested in kernel programming.

Anyway, here is when I found out that all ELF executables have sections that are actually page aligned! That means every ELF executable contains a bunch of zeroes after the TEXT section, so that the DATA section starts at the next page address. That’s how the executable is supposed to be laid out in memory, but I had no idea someone would actually think of doing it in the file. I guess they have their reasons, all the binary format loader does is mmap the file. Maybe for ELF2 they could put in zeros for the BSS section in the file too :p

Plan 9 executables on the other hand, are just normal files with no padding. This gives me a headache because I can no longer use mmap. Recall that all addressees passed to mmap have to be page-aligned. But the DATA section in Plan 9′s a.out will start at a non-page-aligned address most of the time.

One of the first things I tried to do was to mmap the file into a high address, copy portions into the appropriate locations and then free the mapping. That didn’t work so well because:

  • memcpy works only on physical addresses. Logical addresses from the virtual process address space can’t be easily translated to physical ones because Linux delays physical memory allocation for as long as possible. Now we know why all the loaders use mmap, it is fundamental to the “Linux way” of memory management.
  • There is no generic copy_in_user implementation. There are specific ones that use assembly code for PPC, SPARC and even x86_64, but none for x86. The alternative was to use copy_from_user to move data into kernel addresses and then bring them back using copy_to_user. That didn’t work out well either – copy_to_user kept failing for some reason.

I ended up writing a userspace program called ‘pad’ that page-aligns a Plan 9 a.out executable. The loader just mmap‘s the file, like all other loaders. The solution is suboptimal, if someone knows a clean way of doing all of this in kernel-space, I’ll be grateful for the help. The ultimate goal is to run Plan 9 executables on Linux, unmodified.

The code for the loader and the pad program can be found on git here.

Follow

Get every new post delivered to your Inbox.