News for hackers. Stuff that matters.
Re:Ask HN: What source code is worth studying? by sriramk on Tuesday October 13, 2009 @01:50PM (#879620)
I'm going to get downvoted for picking a non-open source option but...

The NT kernel is the most beautiful piece of code I've seen. Dave Cutler and team wrote some very, very elegant code that anyone (even if you're not a kernel hacker) can understand. If I need 'code inspiration', I spend some time looking through their code.

Now, the NT kernel itself doesn't have source out there but for folks who are students, you should be able to get your hands on the Windows Researh Kernel (http://www.microsoft.com/resources/sharedsource/windowsacade...). This has all the good stuff (and is much easier to build too)

Re:Ask HN: What source code is worth studying? by huhtenberg on Tuesday October 13, 2009 @05:03PM (#880076)
I spent several years writing drivers for NT and I don't know which part of the NT kernel you were looking at. The parts I saw were an utter mess lacking any sort of elegance whatsoever. If there were two ways to implement something, one simple and the other one contrived, you can bet your MCSD certificate NT will be using the latter.

The overall impression was that it was hacked together in the worst sense of the word. Like there were several teams developing it that did not communicate with each other. Pieces of the kernel are forced together rather than fit snugly by design. I cannot stress enough how mind-boggingly repulsive it was to work with it. And that's not even touching NDIS, the networking module, which can be used for scaring some serious shit out of young programmers.

If you put BSD or Linux code side by side with NT, look me in the eye and tell me that NT kernel is "the most beautiful piece of code you've seen", you will need to see a head doctor.

Re:Ask HN: What source code is worth studying? by wgj on Tuesday October 13, 2009 @09:32PM (#880476)
I'm not sure you can actually see the kernel outside the base OS team at Microsoft, or under a unique license. it is not included in MSDN or the DDK.

Having worked on that team and having seen it for myself, it is truly elegant, concise, and very well written. I myself never touched it, and that is for the best. I probably wrote some of the crappy drivers for which you hold so much contempt.

Re:Ask HN: What source code is worth studying? by sriramk on Wednesday October 14, 2009 @02:04AM (#880806)
You can get the Windows Research Kernel through the MSDNAA (which most major universities should be hooked up to). The WRK has all the good stuff
Re:Ask HN: What source code is worth studying? by wgj on Wednesday October 14, 2009 @11:42AM (#881505)
Agreed, but slamming Dave Cutler's work on the NT kernel, as huhtenberg did, sounds more like trolling than anything else to me. (Regardless of your opinion of Microsoft.)
Re:Ask HN: What source code is worth studying? by slackenerny on Tuesday October 13, 2009 @03:34PM (#879888)
The NT kernel is the most beautiful piece of code I've seen

Modulo Plan9 kernel. It's also lot smaller a read (ca. 50 KLoC and that's it).

NT kernel itself doesn't have source out but for folks who are students

And folks who are hackers should be able to look in certain places to find the leaked version ;>

Re:Ask HN: What source code is worth studying? by dtf on Tuesday October 13, 2009 @04:46PM (#880040)
All the more heartbreaking that it was forced to don the hideous mantel of the Win32 API (itself further scarred from numerous assaults such as C2 compliance!)
Re:Ask HN: What source code is worth studying? by anatoly on Tuesday October 13, 2009 @02:47PM (#879762)
I agree that it's very beautiful code. I wouldn't go as far as "the most beautiful I've seen", personally, but it's really, really good. Also, when you come to it, you're typically shell-shocked from reading lots of crappy Win32 code, and it's just such a nice change.