Sunday, June 1, 2008

NachOS in Java

I have many problems with NachOS in Java. My primary problem with someone trying to make an operating system in a language like Java is that it is not designed for that purpose. C is. When you take something like NachOS from C to Java you inherently cripple it in the process and pervert the point of creating it in the first place. Why is this so? Let's explore.

First of all is the language differences; C/C++ is made for working at a low level, it contains the kind of literal and low level manipulation you need at that level such as stream manipulation, manual pointer manipulation, fast speed. This is why C is still a popular language when programming microcontrollers and micrprocessors. Java on the other hand has none of these constructs, and would be absolutely no use in writing an OS in the real world. For example, with nachos, you end up emulating pointers (in an abstract integer type form) just so it makes sense. You also have all these ready-made Java classes that make the development so much easier, which you wouldn't have with C. Now don't think i'm a massacist, i'm a big advocate of making everything as easy as possible for the user. The problem with simplifying and "dumbing down" something as complicated as building an OS (even in the name of making it teachable), is that it misses the point completely: you take out the C, the manual pointer manipulation and the lack of pre-made classes and structures to do everything for you, and you can learn some of the broader and more general structures, while missing out on any detail at all. So when Joe Bloggs goes to implement this in real life; he'll have to learn C, have to learn how to use pointers effectively, and learn to actually program basic structures himself. So in order to streamline their learning the university professors have costed the student another 6 months of time, in which they will have to learn C.

It almost makes me feel like in making courses that use NachOS, the academia don't actually intend students to put it to practical use. If they did, surely it would be taught in a practically realistic environment: i.e. C.
Of course there is a reason things are the way they are, and there is a reason why NachOS was converted to Java. Imagine having to teach students C, on top of teaching them OS structure. Now compress that into 6 months. Now you have the mindset of our dear lecturers.