Download the Windows kernel source code!

by Matt 30. November 2007 06:01

While doing a little bit of research into key loggers for work (don't worry - I'm looking at CardSpace), I came across a site that offered the Windows kernel as a source code download. Interesting, but probably dodgy as they come.

Turns out, it's legit. Microsoft have released the Windows Research Kernel as Shared Source. Check out the page, it contains loads of the core parts of the kernel OS, including thread scheduling and memory management. Pretty cool, huh? Perhaps Scott Hanselman should look at this for his next Weekly Source Code.

There's just the small issue of the licensing requiring academic affiliation, so you're not likely to get your hands on it here.


An unexpected UNIX

by Matt 30. November 2007 04:04

One of the 300+ features of the latest version of OSX caught my eye (do you really think that drivers for a rival OS are a feature of your operating system?). Apparently, OSX is now a fully certified UNIX environment.

Phew. Glad about that. What does it mean, again? Wikipedia explains both the Single UNIX Specification, and the POSIX standards, but to be honest, I'm not too sure how to translate this to the real world. Both specifications should allow for a high level of command line and source code compatibility, but then there's still the need for crazy AutoConf build scripts. At least these systems are now allowed to use the name UNIX (unlike BSD and Linux, surprisingly. They aren't certified).

Anyway. Good for Apple. It's (genuinely) a decent sales feature.

So would it be churlish of me to point out that Windows is a certified UNIX environment? And that it has been since 1998? Probably, but whoa - Windows. UNIX. What? Gosh.

Now this is an easy thing for Apple to do - OSX has always been UNIX-based (based on Mach, which is based on BSD?) But Windows quite clearly isn't UNIX. Or is it?

Well, this is the cool bit. What we're talking about is the POSIX subsystem for Windows NT, and it's one of those really nice little nuggets of technology most people haven't even heard of. Here comes the science.

Windows NT has a nifty feature in its design. As per most OS's it has kernel mode and user mode (where the kernel runs the OS, and user mode runs your programs). But on top of that, Windows NT splits user mode up into environment subsystems.

I can pretty much guarantee that you'll have never noticed this, because the default subsystem is Win32 - what you and I call Windows. Explorer and notepad are win32 applications, as are .net apps. The majority of the dlls on your hard disk are win32 - hence the "win32 API". Win32 even has the killer app - the window manager and the graphics display are part of the win32 subsystem. (Even win16 and DOS - and presumably win64 - are part of this subsystem.)

Windows NT has traditionally supported more subsystems, specifically, POSIX and OS/2. The latter was even going to be the default and primary subsystem, but languished once win32 was chosen. It was apparently only character based, and had no graphical support.

(The Gentoo Linux subsystem turned out to be an April Fool's joke, but the article is still worth a read.)

But the POSIX subsystem is still alive and kicking, and it provides an actual UNIX operating environment, translating the POSIX system calls to Windows NT kernel calls. All the familiar UNIX sights are there - a case sensitive file system (yeah, NTFS supports case sensitivity - purely for POSIX), a root based view of the file system, where everything lives under "/" - /bin, /usr. Your environment startup scripts live in /etc, and you've got access to a bunch of devices under /dev (including /dev/null). And those lovely, familiar, cryptic commands are all present too - ls, vi, grep, awk, sed. It's like a home away from home.

Of course, it's not all a bed of roses. You're now living in a separate subsystem to win32, and you can't call win32 APIs from the POSIX subsystem. And since the user interface lives in win32, you're stuck in that horrible console window (it's not cmd.exe - but it's the same window that cmd.exe uses). There are ways round this, though. And there's some pretty good voodoo to make all of this work as seamlessly as possible. You can run win32 commands from a POSIX app, and vice versa. POSIX apps display in the task manager, and can be killed (handy if you accidentally happen to cat /dev/random, for example. Ahem).

It's had a bit of an interesting history, too. It was originally implemented by Microsoft, apparently just providing enough functionality to satisfy government contracts. Softway Systems managed to get a source license, renamed in OpenNT, then Interix and developed it far enough that Microsoft bought it back and repackaged it as Services for UNIX. And now it's bundled with Vista and known as Subsystem for UNIX Applications.

Rodney Roddick, one of the key developers from the OpenNT days, maintains an Interix website, where you can find a potted history, and a "blog" that includes a slightly more personal remembrance (scroll down to the "10 Years of Interix" entry. There are no links).

I really like this approach to running and porting UNIX programs onto Windows. It has its advantages and disadvantages, but it's one of those lovely ideas that you like even if it's not perfect.


Kim Cameron's going to love this...

by Matt 20. November 2007 18:28

What do you reckon? Is losing the names, addresses, dates of birth, national insurance number and bank details of up to 25 million individuals, including children under 16 enough for Britain to wake up to the idea that a national identity card is a bad idea? Or that we have to be really, really careful about how we use and store biometric data?

A stunning example of how important the Laws of Identity are becoming. Perhaps more disturbingly, it's a stunning example of how the ramifications of basic computer security and privacy are just not understood, or perhaps even considered. And this is the Facebook generation...


Not that I'm questioning the value of Wikipedia. Oh no.

by Matt 12. November 2007 04:28

My two year old daughter watches a TV programme called Wonder Pets. She's the very example of their target audience.

And yet it has a wikipedia page.

Now I'm torn between the need to capture, document and collate the zeitgeist for future generations to study, and the thought that some people have too much time on their hands.


Happy Birthday Helvetica

by Matt 6. November 2007 18:19

Oh wow. Just sitting in front of the telly and on comes a documentary about Helvetica. Yep, the font. I have a minor obsession with typefaces; they're a secret that's staring people in the face, one which most are completely oblivious to. But I know that someone has agonised over every single curve and line. It's nice to step into their world, become a part of the secret, while idly looking at a sign or advert or logo. And now primetime(-ish) TV is indulging my geeky little pastime. This is why I pay my license fee.



Month List


Comment RSS