Windows NT vs. Unix: A design comparison

👁 1548 بازدید ❤️ 11 واکنش 📤 17 فوروارد

Site: Substack

Source: https://blogsystem5.substack.com/p/windows-nt-vs-unix-design

⚠️ Article content is partial (Telegram Instant View delivered in segments).

317_article_cover.jpg

317_article_photo_1.jpg

💡آیا ویندوز NT واقعا سیستم‌عامل پیشرفته‌ای بود؟ نمونه مقایسه مهندسی، به جای هیجانات شخصی...

امروز داشتم بوکمارک‌‌تکونی می‌کردم، یهو پست وبلاگ Julio Merino که ماه‌ها پیش ذخیره کرده بودم تا در موردش بنویسم و فراموش کرده بودم رو دیدم.

آقای Julio Merino پیشتر در گوگل و مایکروسافت و الان هم در snowflake مشغول به کاره و روی سیستم‌های یونیکس‌بیس خیلی مسلطه (معماری و لایه‌های پایین‌تر سیستم عامل) و جز دولوپرهای FreeBSD و NetBSD بوده. توی این پست توضیح می‌ده که آیا تعریف و تمجیدهایی که از پیشرفته بودن سیستم‌عامل Windows NT در سال ۱۹۹۳ می‌شده در مقابل یونیکس‌سانان مثل BSD درست بوده یا نه؟!

شاید ما هرگز سیستم عامل توسعه ندیم یا تا لایه‌های خیلی پایین کرنل عمیق نشیم؛ ولی خوبه بدونیم مقایسه صحیح دو تا سیستم ولو اینکه به ۳۰ سال پیش برگردن، آداب و روشی داره که توی این مقاله به خوبی یاد می‌ده...

مقاله مفصلیه، و از حوصله پست تلگرامی خارج. ولی مثلا از hybrid microkernel یا Async I/O میگه که NT جلوتر از زمان خودش و پیشرفته از Unix بوده و بعد نظرش رو توضیح می‌ده که چطور linux و یونیکس‌سانان این سال‌ها گپ‌ها رو پر کردن و چالش‌های اصلی توسعه ویندوز چیاست از نظرش.

هدفم از اشتراک این مطلب اینه چقدر در بین مقایسه‌هایی که در مورد زبان‌ها، تکنولوژی‌ها، معماری‌ها و... می‌بینیم، روش و معیارهای فنی می‌بینیم، و چقدر بر اساس رسانه و هیجان و تصورات ذهنی‌مون قضاوت می‌کنیم...

NT is often touted as a "very advanced" operating system. Why is that? What made NT better than Unix, if anything? And is that still the case?

Over the years, I’ve repeatedly heard that Windows NT is a very advanced operating system and, being a Unix person myself, it has bothered me to not know why. I’ve been meaning to answer this question for years and I can do so now, which means I want to present you my findings.

My desire to know about NT’s internals started in 2006 when I applied to the Google Summer of Code program to develop Boost.Process. I needed such a library for ATF, but I also saw the project as a chance to learn something about the Win32 API. This journey then continued in 2020 with me choosing to join Microsoft after a long stint at Google and me buying the Windows Internals 5th edition book in 2021 (which I never fully read due to its incredible detail and length). None of these made me learn what I wanted though: the ways in which NT fundamentally differs from Unix, if at all.

317_article_photo_1.jpg

Then, at the end of 2023, the Showstopper book sparked this curiosity once again. And soon, a new thought came to mind: the Windows Internals 5th edition book was too obtuse but… what about the first edition? Surely it must have been easier to digest because the system was much simpler back in the early 1990s. So lo and behold, I searched for this edition, found it under the title Inside Windows NT, read it cover to cover, and took notes to evaluate NT vs. Unix.

Which brings me to this article—a collection of thoughts comparing the design of NT (July 1993) against contemporary Unix systems such as 4.4BSD (June 1994) or Linux 1.0 (March 1994). Beware that, due to my background, the text is written from the point of view of a Unix “expert” and an NT “clueless”, so it focuses on describing the things that NT does differently.

Mission

Unix’s history is long—much longer than NT’s. Unix’s development started in 1969 and its primary goal was to be a convenient platform for programmers. Unix was inspired by Multics, but compared to that other system, Unix focused on simplicity which is a trait that let it triumph over Multics. Portability and multitasking were not original goals of the Unix design though: these features were retrofitted in the many “forks” and reinventions of Unix years later.

On Microsoft’s side, the first release of MS-DOS launched in August 1981 and the first release of “legacy Windows” (the DOS-based editions) launched in November 1985. While MS-DOS was a widespread success, it wasn’t until Windows 3.0 in May 1990 that Windows started to really matter. Windows NT was conceived in 1989 and saw the light with the NT 3.1 release in July 1993.

This timeline gave Microsoft an edge: the design of NT started 20 years after Unix’s, and Microsoft already had a large user base thanks to MS-DOS and legacy Windows. The team at Microsoft designing NT had the hindsight of these developments, previous experience developing other operating systems, and access to more modern technology, so they could “shoot for the moon” with the creation of NT.

In particular, NT started with the following design goals as part of its mission, which are in stark contrast to Unix’s:

  1. portability,
  2. support for multiprocessing systems (SMP), and
  3. compatibility with DOS, legacy Windows, OS/2, and POSIX.

These were not goals to scoff at and meant that NT started with solid design principles from the get go. In other words: these features were all present from day one and not bolted on at a later stage like they were in many Unixes.

The kernel

Now that we know some of these design goals and constraints, let’s take a look at the specifics of how they are implemented.

Unix is, with few exceptions like Minix or GNU Hurd, implemented as a monolithic kernel that exposes a collection of system calls to interact with the facilities offered by the operating system. NT, on the other hand, is a hybrid between a monolithic kernel and a microkernel: the privileged component, known as the executive, presents itself as a collection of modular components to user-space subsystems. The user-space subsystems are special processes which “translate” the APIs that the applications consume (be it POSIX, OS/2, etc.) into executive system calls.

One important piece of the NT executive is the Hardware Abstraction Layer (HAL), a module that provides abstract primitives to access the machine’s hardware and that serves as the foundation for the rest of the kernel. This layer is the key that allows NT to run on various architectures, including i386, Alpha, and PowerPC. To put the importance of the HAL in perspective, contemporary Unixes were coupled to a specific architecture: yes, Unix-the-concept was portable because there existed many different variants for different machines, but the implementation was not. SunOS originally only supported the Motorola 68000; 386BSD was the first port of BSD to the Intel architecture; IRIX was the Unix variant for Silicon Graphic’s MIPS-based workstations; and so on. This explains why NetBSD’s main focus on portability via a minimal shim over the hardware was so interesting at the time: other operating systems, except NT, did not have this internal clean design, and NT had come years before.

← بازگشت به همه پست‌ها