Reference

Windows Research Kernel @ HPI

Browse Through the WRK Sources

In a recent post, we introduced PXR, a cross-referencing source code documentation compiler. If you are interested in how the results look like and how it feels to interactively browse through the sources, the generated HTML files are now available on Microsoft's Faculty Connection. We decided to publish these files in that way because we need to make sure that only eligible persons access the source code. Faculty Connection already provides this kind of service.

In the meantime, we are working on a release of the PXR sources, so that you can start building a documentation of your own projects.

Numbered Queued Spinlocks in the WRK

In a recent post, we covered the implementation of in-stack queued spinlocks, the recommended method to use queued spinlocks in drivers. In this article, we would like to extend the discussion to a second class of queued spinlocks: numbered queued spinlocks. These well-known locks use per processor, pre-allocated memory to store the processor's queue item. In this article, we will give a short overview over the existing queued spinlocks in the WRK, how they are initialized and how they are used.

Read more

Queued Spinlocks in the WRK

A few days ago, we came up with a discussion on the advantages of queued spinlocks over normal spinlocks. The biggest advantage in our oppinion is that queued spinlocks guarantee a FIFO ordering among competing processors while normal spinlocks don't. In this article, we show the implementation of queued spinlocks in the WRK. We present the source code of the 64-bit version for two reasons: first, the 64-bit version contains the implementation in plain C and not in the Assembly language, and second, in the 32-bit version, queued spinlocks are implemented in the HAL, which is not available as source code. The rational behind the implementation remains however the same.

Read more

NtCreateThread - memory allocations in kernel mode

In this post we try to determine how much kernel memory is required when creating a new thread. This amount of memory is relevant for the upper bound of the number of possible threads in the system as investigated in detail by Mark Russinovich.

For a starting point we looked at the system service call implementation of NtCreateThread and followed every possible code path down to memory allocation functions such as ExAllocatePoolWithTag.

Read more

(SINGLE_)LIST_ENTRY & CONTAINING_RECORD

Lists are a basic data structure in any operating system kernel, e.g. used for thread queue management. The WRK provides a set of struct definitions and list related functions/macros. In this post a short survey of these elements is given.

Read more

A Tale of Four Kernels

In a recently published study by Diomidis Spinellis, four operating system kernels are compared in terms of code quality and code structure. The compared kernels are FreeBSD, GNU/Linux, Solaris, and the Windows Research Kernel.

The development process of the different kernels seems to have a strong impact on code structure and style:

Linux excels in various code structure metrics, but lags in code style. This could be attributed to the work of brilliant motivated programmers who aren't however efficiently managed to pay attention to the details of style. In contrast, the high marks of WRK in code style and low marks in code structure could be attributed to the opposite effect: programmers who are efficiently micro-managed to care about the details of style, but are not given sufficient creative freedom to structure their code in an appropriate manner.

KevUtilAddressToFileHeader

To resolve an arbitrary address to get the module (program or driver) this address belongs to, you could traverse the PsLoadedModuleList by hand. Or you use KevUtilAddressToFileHeader (defined in base/ntos/ke/kevutil.c).

Read more

Windows Server 2008

Some weeks ago, the new Windows Server 2008 was released by Microsoft. The "Enterprise Platforms Support Windows Server Performance team"(!) wrote several posts about changes and improvements in the new server operating system.

From a kernel perspective, especially the following articels are interesting:

Different aspects of Windows Server 2008 will be presented in April at the Server Computing Summit at the Hasso-Plattner-Institute. For students of the Universities located in Potsdam and Berlin, attendance is free.

System Service Call Implementations in the WRK

The kernel of a Windows Server 2003 Enterprise Edition system provides 296 system service calls. A complete list which allows comparison between Windows versions can be found here.

Not all system service call implementations are contained in the Windows Research Kernel source code. The following table shows the available system service implementations (Nt*-functions) with reference to the corresponding source code file.

As the WRK readme.txt states …

The kernel sources excluded from the kit are primarily in the areas of plug-and-play, power management, the device verifier, kernel debugger interface, and virtual dos machine.

… the most of the missing system service implementations are related to power management, plug-and-play, and device drivers.

Read more

WRK Documentation

The source code documentation generator tool Doxygen can be used to generate a collection of HTML pages which allow easy navigation through large amount of source code files.

We created a WRK documentation using doxygen to allow a better exploration of the Windows Research Kernel source code.

screenshot of WRK documenation generated by Doxygen

Read more