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.

Tags:

Comments (19) -

suv review
suv review
7/20/2011 10:32:50 PM #

Fantastic task I like your type! Would really like to right here your feedback on my website! I am also seeking for someone to help you me make websites!

Reply

hybrid vehicles 2011
hybrid vehicles 2011
7/21/2011 12:49:18 PM #

Is it ok if I quote your article in my monthly newsletter? I would think this article suits my topic perfectly. Well ya, thanks for posting this article.

Reply

best hybrid cars
best hybrid cars
7/22/2011 4:29:54 AM #

Hi, just required you to know I he added your website to my Google bookmarks due to your layout. But seriously, I consider your net web-site has 1 in the freshest theme I??ve came across. It extremely helps make studying your blogging site significantly easier.

Reply

iphone os 4
iphone os 4
7/23/2011 8:34:45 PM #

Is it ok if I quote your article in my monthly newsletter? I would think this article suits my topic perfectly. Well ya, thanks for posting this article.

Reply

iphone developer program
iphone developer program
7/24/2011 5:43:23 AM #

hi!,I like your writing so so much! proportion we communicate extra about your post on AOL? I require a specialist in this area to unravel my problem. May be that's you! Taking a look forward to see you.

Reply

philix
philix United States
11/19/2015 10:19:01 PM #

Great Web Site

Reply

philix
philix United States
11/21/2015 12:54:54 PM #

Wonderful Web Site

Reply

Jeannine Mischel
Jeannine Mischel United States
1/7/2016 2:29:08 AM #

Congrats! This is such a great website, I know it will translate well into book form. Which is AWESOME!

Reply

Hannah Barbarino
Hannah Barbarino United States
1/15/2016 4:56:56 AM #

AWESOME!Can't wait for that, will be something to want to accomplish day by day, to do something AWESOME!

Reply

Silvana Bellipanni
Silvana Bellipanni United States
1/15/2016 8:31:10 AM #

Congrats! This is such a great website, I know it will translate well into book form. Which is AWESOME!

Reply

Bea Sawin
Bea Sawin United States
1/15/2016 8:54:28 AM #

Congratulations on your success! You deserve it for brightening all of my work days with something to be excited about.

Reply

Kellie Arciba
Kellie Arciba United States
6/26/2016 1:52:35 AM #

Virtually all of the comments upon this blog dont make come to feel.

Reply

Terrance Kutchera
Terrance Kutchera United States
6/29/2016 4:39:37 PM #

Although I seriously like this create, I believe there was an spelling miscalculation near against the end with the 3rd section.

Reply

Terrence Wenstrand
Terrence Wenstrand United States
8/25/2016 4:16:35 AM #

Hola! This is my first visit to your blog! We are a group of volunteers and starting a new projects in a community in the same niche. Your post gives us valuable information to work on. You have done a marvelous job!

Reply

醫學美容 自體 cosmetic.wiki
醫學美容 自體 cosmetic.wiki United States
10/15/2018 1:40:03 PM #

王君馨「Un-photoshopped」展示真我,總比假素顔好! - STYLE-TIPS.COM  王君馨在國際婦女節當天上載了自己的素顔照,引起了網民的討論,當中有不少網民留言表...      

Reply

質感染
質感染 United States
10/16/2018 11:17:19 AM #

由舒顏萃、洢蓮絲談膠原蛋白、Collagen type I and III、真皮填充劑(dermal filler)、刺激劑、異物反應foreign body reaction、異物肉芽腫(Foreign body granuloma)

Reply

醫學美容 魔髮 cosmetic.wiki
醫學美容 魔髮 cosmetic.wiki United States
10/16/2018 11:18:53 AM #

The Body Shop 美體小舖 【限量粉紅麝香香氛系列】粉紅麝香身體芳香噴霧的商品介紹   The Body Shop 美體小舖,限量粉紅麝香香氛系列,粉紅麝香身體芳香噴霧       

Reply

手機藍光很傷皮膚?夏天想美白,防曬隔離產品少不了抗藍光 Harpersbazaar HK  想維持肌膚年輕,抗藍光成了低頭族近年保養的課題,由於電腦、手機等行動裝置,都會發出波長與紫外線接近的「藍光」,光線強度更是紫外線的十多倍,令不少女士驚覺就算不外出都有機會曬黑,而不斷有研究指出,藍光會導致肌膚產生如同 UVA UVB 的壞影響,所以要是有機會令皮膚衰老,知性的女士都會做好預防措施。夏天想美白做好防曬,除了挑選能阻隔紫外線、空氣污染的防曬產品及隔離霜,對女生來説,更重要更是抗藍光!      

Reply

醫學美容 矜貴 cosmetic.wiki
醫學美容 矜貴 cosmetic.wiki United States
10/19/2018 5:32:46 PM #

濕疹  濕疹是一種不具傳染性的皮膚炎,任何年齡均有機會患上。患者的皮膚會有機會對外在環境產生過敏反應,並通常於面部、頸部、手腕、手臂及兩腿內側等皮膚出現紅疹,患處表面會變得乾燥痕癢和出現紅疹,情況嚴重時甚至會發炎流膿。  濕疹的成因  濕疹可分為原發性及繼發性:原發性濕疹多與遺傳因素有關,常見的小兒濕疹正是屬於原發性濕疹,只要配合適當的治療,超過八成病童有機會於長大後便會痊癒;而繼發性濕疹則可能與外在因素,如天氣、濕度變化、汗或食物等致敏原有關。除此之外,雙手經常濕水或長期接觸化學用品的人士,亦較 ...      

Reply

Add comment

biuquote
  • Comment
  • Preview
Loading

Rel=Me

Month List

RecentComments

Comment RSS