BT

Kernel Comparison of Three Widely Used OS

Posted by Dingze Zhu on Jul 17, 2009 |

The idea of writing this paper is evoked by Max Bruning's view on Solaris, BSD and Linux. The comparison of advantages and disadvantages among quasi-Unix systems is an oft-told tale. However, this article looks into the three kernel subsystems of the latest operating system release – OpenSolaris, Windows Vista and Linux kernel 2.6. The simple reason is that they are the most widely used and welcomed operating systems within business environment and developer communities.

There are lots of criteria to value a system, but undoubtedly, the fundamental role of an operating system in computer science remains unchanged. It can be thought of as having three objectives:

  • Efficiency: allowing system resources (especially hardware) to be used in an efficient manner.
  • Evolvement: The only thing that never changes is change. OS should be constructed in such a way as to permit the effective development and introduction of new system functions without interfering with original service.
  • User-friendliness: We need to face OS every day. A user-friendly interface is compulsory, otherwise you will be dropped not matter how well you follow the above two criteria.

Inevitability, OS needs functions like process/thread management, which allocates and calls threads under a particular dispatcher policy, memory management and file management. We will compare these subsystems head by head. (User friendliness will not be discussed here in this article, since we are focusing on kernel comparison.) There are some similar concepts between Linux and OpenSolaris, while concepts in Windows Vista are quite different.

Process and Thread Management

OpenSolaris

OpenSolaris implements multilevel thread support designed to provide considerable flexibility in exploiting processor resources. Four following new concepts are implemented in OpenSolaris.

  • Process: This is the normal UNIX process and includes the user’s address space, stack, and process control block.
  • User-level threads: Implemented through a threads library in the address space of a process, these threads are invisible to the OS.A user-level thread (ULT)10 is a user-created unit of execution within a process.
  • Lightweight processes: A lightweight process (LWP) can be viewed as a mapping between user level threads and kernel threads. Each LWP supports ULT and maps to one kernel thread. LWPs are scheduled by the kernel independently and may execute in parallel on multiprocessors.
  • Kernel threads: These are the fundamental entities that can be scheduled and dispatched to run on one of the system processors.

As is showed in Figure 0, ps -Lec command display system processes and threads.

Figure 0 Output from Solaris 10 update 6

Figure 1 below illustrates the relationship among these four entities.

Figure 1 opensolaris thread model1

The three-level thread structure (ULT, LWP, kernel thread) in OpenSolaris is intended to facilitate thread management by the OS and to provide a clean interface to applications.

The user thread interface can be a standard thread library. A defined ULT maps onto a LWP, which is managed by the OS and which has defined states of execution, defined subsequently. An LWP is bound to a kernel thread with a one-to-one correspondence in execution states. Thus, concurrency and execution is managed at the level of the kernel thread.

In addition, an application has access to hardware through an application program interface (API) consisting of system calls. The API allows the user to invoke kernel services to perform privileged tasks on behalf of the calling process, such as read or write a file, issue a control command to a device, create a new process or thread, and allocate memory for the process to use, and so on.

The change of thread model drivers the altering of process data structure. OpenSolaris retains this basic structure but replaces the processor state block with a list of structures containing one data block for each LWP.

The LWP data structure includes the following elements:

An LWP identifier

  • The priority of this LWP and hence the kernel thread that supports it
  • A signal mask that tells the kernel which signals will be accepted
  • Saved values of user-level registers (when the LWP is not running)
  • The kernel stack for this LWP, which includes system call arguments, results, and error codes for each call level
  • Resource usage and profiling data
  • Pointer to the corresponding kernel thread
  • Pointer to the process structure

Figure 2 Comparison of Solaris Process structure and traditional Unix Process structure

Windows Vista

Vista process design is driven by the need to provide support for a variety of OS environments. Accordingly, the native process structures and services provided by the Windows Kernel are relatively simple and general purpose, allowing each OS subsystem to emulate a particular process structure and functionality. Here are some of the important characteristics of Windows processes:

  • Windows processes are implemented as objects.
  • An executable process may contain one or more threads.
  • Both process and thread objects have built-in synchronization capabilities.

Figure 32 below illustrates the way in which a process relates to the resources it controls or uses. Each process is assigned a security access token, called the primary token of the process.

Figure 3 a windows process and its thread

When a user first logs on, Vista creates an access token that includes the security ID for the user. Every process that is created by or runs on behalf of this user has a copy of this access token. Windows uses the token to validate the user’s ability to access secured objects or to perform restricted functions on the system and on secured objects. The access token controls whether the process can change its own attributes. In this case, the process does not have a handle opened to its access token. If the process attempts to open such a handle, the security system determines whether this is permitted and therefore whether the process may change its own attributes.

Also related to the process is a series of blocks that define the virtual address space currently assigned to this process. The process cannot directly modify these structures but must rely on the virtual memory manager, which provides a memory allocation service for the process.

Finally, the process includes an object table, with handles to other objects known to this process. One handle exists for each thread contained in this object.

In addition, the process has access to a file object and to a section object that defines a section of shared memory.

The object-oriented structure of Windows facilitates the development of a general-purpose process facility. Windows Vista makes use of two types of process-related objects: processes and threads. As OpenSolaris, a process is an entity corresponding to a user job or application that owns resources, such as memory, and opens files. A thread is a dispatchable unit of work that executes sequentially and is interruptible, so that the processor can turn to another thread.

Windows Vista supports concurrency among processes because threads in different processes may execute concurrently. Moreover, multiple threads within the same process may be allocated to separate processors and execute simultaneously. A multithreaded process achieves concurrency without the overhead of using multiple processes. Threads within the same process can exchange information through their common address space and have access to the shared resources of the process. Threads in different processes can exchange information through shared memory that has been set up between the two processes.

An object-oriented multithreaded process is an efficient means of implementing a server application. For example, one server process can service a number of clients.

Linux Kernel 2.6

A process, or task, in Linux is represented by a task_struct data structure. The task_struct data structure contains information in a number of categories:

  1. Unlike Vista and opensolaris, processes in Linux are both containers and the schedulable entities; processes can share address space and system resources, making processes effectively usable as threads.
  2. Also unlike Vista and OpenSolaris, Most services are implemented in the kernel, with the exception of many networking functions. Thus Linux kernel is relative bigger in size comparing former two OS.

Linux provides a unique solution in that it does not recognize a distinction between threads and processes. Using a mechanism similar to the lightweight processes of OpenSolaris, user-level threads are mapped into kernel-level processes. Multiple user-level threads that constitute a single user-level process are mapped into Linux kernel-level processes that share the same group ID. This enables these processes to share resources such as files and memory and to avoid the need for a context switch when the scheduler switches among processes in the same group.

Conclusion

Solaris and Windows both exist for dozens of years while Linux is very young and still has long way to go. Obviously, three OS are implemented following popular operating system theories. The most awkward obstacle is the ability for us to access the kernel implementation and debugging. Limited to my knowledge, I have no way to debug or trace thread and process in Windows Vista while OpenSolaris supplies abundant tools to observe kernel thread.

In the next paper, we will continue to discuss memory management and file system.


1 Richard McDougall, Jim Mauro ,Solaris internals 2005 Pearson Education

2 Russinovich, M., and Solomon, D. Microsoft Windows Internals: Microsoft Windows Server(TM) 2003, Windows XP, and Windows 2000. Redmond, WA: Microsoft Press, 2005.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Classification of kernels/operating systems by Roger Wilco

While the comparison of the different kernels is quite interesting, I find the heading quite misleading.

Solaris is a UNIX operating system (see UNIX rosetta stone) and Linux was modeled after UNIX paradigms. But I fail to see how Windows in any incarnation is a Quasi-UNIX...

Maybe you can enlight me.

Re: Classification of kernels/operating systems by Werner Schuster

I also fail to see how Windows Vista can be called Unix in any meaningful way; Vista is based on Windows NT, the difference seems even greater, considering that it's designer was Dave Cutler who had his hands all over VMS.

Does Vista (or even Windows 7) have a fast fork() implementation? The existence of a proper fork() (not just emulated) seems to be a major difference between process-oriented Unix and thread-oriented Windows;

Re: Classification of kernels/operating systems by zhu dingze

Sorry for any ambiguity. Originally, The title was "Kernel comparison of OpenSolaris, Windows Vista and Linux 2.6". It might be some edits mistake.

Linux: fat kernel, thin details by Sean Kennedy

I did a double-take when I read the description of Linux tasks followed by the conclusion:
Solaris and Windows both exist for dozens of years while Linux is very young and still has long way to go.

Other than being a more monolithic than other monolithic kernels, no insight into the problems created by the choices made in Linux, no criticism of Linux, at all, is apparent in that section. Without such criticism it is a long jump to "Linux is very young and still has long way to go". (Also, is 15+ years really *young* ... indeed, Linux 1.0 was released in 1994, while the first Windows NT became available in 1993.)

It is possible that the conclusion is correct (if so, it would be *really* good to know why), but without further support, especially after the long sections on the Solaris and NT kernels, it comes across as biased and dismissive.

I look forward to more.

Thanks.

Um a comparação muito superficial by Luis Alvarenga

Um artigo muito superficial e um tanto tendencioso.
Primeiro: falar que o Windows Vista é um Quasi-Unix, em que sentido? Segundo: Considerar o Linux um sistema operacional muito jovem!

Além de que, as sessões sobre o OpenSolaris e o Windows Vista estão muito mais extensas do que a do Linux, por que?

quite biased... by Sergio Correia

I am wondering why you wrote like half paragraph on Linux, if it was lack of knowledge or merely intentional.

Maybe it would have been better if you had written only about OpenSolaris and Windows Vista, as you actually seem to know such systems.

"In the next paper, we will continue to discuss memory management and file system."


please, make a biggger effort on trying to make it less biased, at least, or just don't include Linux or whatever OS if you are not going to analyze it in the same depth you have done to others.

Re: Um a comparação muito superficial by Pablo Alcaraz

Porque le pagan. No veo otra explicación. Sobre todo porque los fuentes y la documentacion del kernel de linux está al alcance de todo el mundo...

Because he got paid for that. I can not see another reason. The source code and the documentation of the linux kernel is there...

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

7 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT