The Modern Operating Systems

posted by on 18th August 2010, at 4:59pm

Last month you’ll remember I gave a top down view of what your operating system consists of. I recommend that you go back and read What is an Operating System? before continuing further. This month we’re going to compare the three modern operating systems: Windows, Mac OS, and Linux. The adjective “modern” can be taken with a grain of salt. Modern in this article will refer to the most recent incarnations, that is, Windows 7, Mac OS X, and Linux 2.6. For each of these operating systems we will discuss their architectures as described last month.

Before we continue a few terms need to be defined.

  • Kernel – A very low level part of an operating system. Provides access to system hardware through device drivers. Also, provides memory management.
  • Monolithic Kernel – A kernel that is a single large interface to the computer hardware. It includes built in system calls and kernel modules.
  • Driver – A low level piece of software that accesses a piece of hardware (for example your graphics card.) The driver reports to the kernel.
  • Operating System Layout – Where system binaries and user applications reside.
  • User Preferences Model – How user preferences are stored for the operating system and applications.

For each operating system we will describe the type of kernel used, the driver model, the operating system layout, and user preferences model. We will begin with Windows as it’s the most widely used operating system.

Windows

Windows NT, which Windows 2000, Windows XP, Windows Vista, and Windows 7 are based on, creates a hybrid-kernel. The hybrid-kernel architecture allows the operating system to run device drivers as if the operating system ran on a monolithic kernel; however, user applications and less critical processes run isolated from the kernel. This means that if an application you are using crashes, your entire computer is not taken down. If anyone remembers using Windows 98 or Windows 95 (Windows 9x), they will know that if a device or application crashed there was a high chance that it would crash the entire computer forcing a reboot. This occurred because Windows 98 style operating systems used a monolithic kernel, not a hybrid-kernel. It is this change made in the Windows XP consumer operating system that made the later computers much more stable.

The Windows driver model has remained largely the same for the vast history of Windows 9x and Windows NT operating systems. Anyone who made a hardware device was allowed free access to the Windows driver model. This means that if a company that produced a video capture card wanted they could freely write a driver for their hardware. This is a good model but it opens the door to malicious software engineers to create fake drivers that cause harm to a system. Most of the time this hasn’t been a problem since hardware drivers often come packaged on a CD. Recently there has been a shift towards online driver distribution, this is where the model starts to become shaky. When Windows Vista was released a major change in the 64-bit version was that all device drivers had to be signed by Microsoft. This process is now the norm in Windows 7 64-bit.  This allows for Microsoft to ensure these drivers are doing what they are advertised to do and that they are working optimally. Another highlight of the Windows driver model is that if a driver, such as a graphics driver, crashes it will automatically be restarted. There is some debate as to whether or not Microsoft will take this stance a step further in Windows 8 by completely disallowing access to low level system functions. It’s a hot issue because it would break a lot of applications that were not patched to take this into account.

Windows NT is a massive operating system. When DOS was originally released it was not uncommon to meet someone who could tell you what each file on their computer was for; this is certainly not the case anymore. What we see now is a large bundle of files in the C:\Windows folder and all of its sub-folders. Windows’ functionality is provided through a collection of DLL files: dynamically linked libraries. These libraries are used by applications to access the Windows API which creates both the Windows operating system and the applications that you use on your computer from day to day.

User preferences can be stored in a variety of ways on Windows. Perhaps the most hated method is the registry. The registry is a database that stores preferences in a key value format. Some users find that the registry can become messy requiring it to be cleaned, which is probably true. The registry can also become corrupted resulting in inoperable programs or even worse, an inoperable operating system. Opinion of the registry varies from user to user; personally, I’m rather indifferent to it. Application developers may opt to just use a plain text file for preferences (ini file) or they may use a custom solution such as a SQLite database like Firefox uses. Which is the best? In the view that a user may want to transfer settings to a different computer, the plain file storage or SQLite database stored in your user folder (C:\Users\[your username]). This is optimal since there is no easy way to transfer applications and settings on Windows.

Mac OS X

Like Windows NT, Mac OS X uses a hybrid-kernel. This has relatively the same ramifications, a stable operating system that’s immune from most application crashes taking down the entire system. Mac OS X shares a similar path of evolution to that of Windows, that is, Mac OS 9 was a monolithic kernel like Windows 9x. The Mac OS kernel contains parts of the Mach kernel which is a true microkernel meaning that it provides the absolute minimum required to run an operating system. The Mac OS kernel also contains parts of the BSD kernel which itself is a monolithic kernel, thus making the Mac OS kernel a hybrid-kernel.

The Mac OS driver model is open; any developer can write a driver. This isn’t all bad since the driver toolkit for Mac OS X is a limited subset of C++ meaning that a developer would not have full access to the kernel. Drivers for low level hardware such as video cards or audio cards are off limits seeing as all Apple computers are produced to a specific specification. Because of this limiting and the hybrid kernel, often if there is a flaw in one of Apple’s drivers, a kernel panic will be the result of a low level driver crash. Kernel panics may also happen if a USB based driver malfunctions, for example an audio device. It should be noted that driver signing is not required on Mac OS X.

Mac OS follows the typical Unix/Linux layout of having a root file system (/) and sub-folders. This means that the Unix binaries on Mac OS reside in /bin and system binaries will reside in /sbin. Mac OS also stores user data in a /Users folder which is another Unix convention. Along side this there are also the non-Unix parts of Mac OS which reside in /System and all other drivers and system preferences will reside in /Library (each user also has their own Library folder as well). Finally user applications reside in an aptly named /Applications folder.

For user preferences Mac OS X either use Plist files, short for “preference list” or flat text files as Unix/Linux would. The Plist files are also flat text files but they are XML based meaning they have nesting and key value pairs such as a RSS feed does. These preferences can either be system wide (in /Library) or user based in (/Users/[your user]/Library). The benefit of such a system is that if needed a preference for an application can be located easily and edited. The system is also more robust in that a corrupted preference file will not prevent an application from starting or worse.

Linux

Before we begin it should be noted that “Linux” is referring to the kernel and not the various distributions such as Ubuntu or Fedora. Unlike the previous two operating systems, Linux uses a monolithic kernel. All device drivers and kernel extensions run in kernel space. User applications do not run in kernel space. If you have been following along you will most likely gather that if a driver crashes in Linux it will undoubtedly result in a kernel panic unlike just restarting on a Windows NT based operating system. A monolithic kernel, such as the Linux kernel, if implemented without error, can be very stable. This of course will require device drivers to be stable, which we will talk about next. It’s not an understatement to say that many Linux systems can go years without a reboot attributed to their stability, which is due in part to the kernel.

The Linux driver model is free; any developer can write a driver for what they want. This is due to the core beliefs of Linux and the GNU public license. Suppose a new programmer had an insight into graphics drivers; this programmer could write his or her own graphics driver for his system. This also allows for hardware builders to have free access into a relatively pure system. This is one reason why Linux is often chosen as a platform to learn about operating systems. This open model has created a huge selection of drivers for a variety of devices and most of them run fine.

The layout of Linux operating systems is very similar to that of Mac OS X, in that the layout is very logical. For example, all system binaries are stored in /sbin and other binaries are found in /bin. There are directories that serve as destinations for user installed software. There are also directories for global system configuration files. Most importantly, however, is that each user has their own “home” folder. Home folders store documents and music libraries as one would expect but they also often contain custom user configuration files. With this being said, almost all Linux configuration is done by configuration files.

———————–

Each of these operating systems are mature in their own right. For a standard user it would go without saying that they should look at Windows or Mac OS since hardware support on Linux isn’t going to be as great as it would on Windows or Mac OS. I would go as far to say that Windows and Mac OS offer the same amount of stability. The only reason that Windows appears to have less stability is that many users are not conscious enough about security and malware to keep their systems clean.

From the standpoint of a developer, Windows is great because it’s what everyone uses but it also has the downside of having overly complicated and bloated programming interfaces. Mac OS is ideal, it has very clean programming interfaces and provides tools to get started quickly. Finally, a developer should choose Linux if they need access to the hardware.

At the end of the day it doesn’t matter if you use Mac OS or Windows as they both have applications that are free to perform the same tasks. If you have any questions about this article or have suggestions for future articles please don’t hesitate to send me a private message on the forums.


This article is filed under Tech. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.