OYS Project
OYS Project
CHAPTER 1
SYNOPSIS
Project Title
None
Prof.Falake G.N
CHAPTER 2
INTRODUCTION
The roots of Windows reach back to the late 1980s. Back then, many interesting
things were happening in the operating system design space { including SVR4, the
Mach microkernel, innovations in networking and windowing systems, and many
research projects on OS fundamentals. The desire to gain in-depth knowledge of
these exciting developments motivated many CS students to study operating
systems back then. With our OS projects we want help to re-spark interest in
operating systems again. Within this paper, we advocate a hands-on approach
towards teaching (and learning) OS concepts. We present our experiences from
teaching Windows-based OS courses during the last ten years. We suggest a three-
phase scheme, where students _rst learn to master user-mode system interfaces
(U) { often referred to as \system programming". Secondly, they need to master
principles and tools to monitor and measure OS behavior (M). And third, students
should be presented with central implementation details of the OS kernel (K).
Following the UMK Approach, even complex projects such as the modifying the
implementation of memory management inside the Windows kernel can be carried
out in an undergraduate OS curriculum. Undertakings, such as the Abstract
Memory Management (AMM) project, integrate well with our previously
developed courseware { the Microsoft Windows Internals Curriculum Resource
Kit (CRK) [6, 2]. Microsoft made the Windows kernel sources widely available
to academia in 2006 [3], replacing the earlier limited distribution that was available
only to select universities. Since then, we have expanded our earlier use of
Windows in OS courses by developing a number of projects and labs that rely on
modifying the Windows kernel. These projects focus on topics such as
scheduling/dispatching, synchronization, and memory management. Within this
paper, we present the Abstract Memory Management (AMM) experiment which is
comprised of a U section, where students practice relevant system APIs (such as
Windows API function VirtualAllocEx()), an M section, where we ask students to
familiarize themselves with measurement techniques and tools (such as the
Windows performance monitor { perf- mon.exe), and a K section where students
need to modify source code (e.g.; ntos/mm/wsmanage.c), compile, and run their
own version of Windows. During the course, projects are assigned to groups of
three students. In the remainder of the paper, we _rst present an overview 490
about the projects we created for the WRK. Then, we present the kernel (K) and
the measurement (M) part of the AMM project.
CHAPTER 3
ABSTRACT
When studying operating systems, students need to understand user-mode
system interfaces (U), they need to learn about tools to monitor and measure OS
behavior (M), and they _nally should understand central implementation details of
the OS kernel (K). Following the UMK approach, even complex projects such as
modifying the memory management inside the Windows kernel can be carried out
in an undergraduate OS curriculum. Here we concentrate on the kernel- and
measurement part and present the Abstract Memory Management (AMM) project.
AMM provides a framework for modifying the working set management in
Windows while still hiding many implementation details of the kernel. AMM has
been used in OS courses at U of Washington Bothell and HPI/U of Potsdam,
Germany, with very good results. The AMM lab { together with other labs { is
based on the Windows Research Kernel (WRK) as available in source from
Microsoft. These labs complement our previously developed Curriculum Resource
Kit (CRK) and are available for download.
CHAPTER 4
General Terms
Keywords
CHAPTER 5
WRK PROJECTS
The Windows Research Kernel (WRK) is based on the x86/x64 source code of
the Windows Server 2003 operating system kernel with Service Pack 1. Figure 1
gives a brief overview of the source code components that are shipped with the
WRK. Gray, rectangular boxes denote modules that are available as source code,
while the white rectangular boxes denote components that are either provided as
static library, like the power management module, or not at all, like device drivers
and all user mode components. Our operating system projects { such as the AMM
lab { are structured in such a way that they align well with the Curriculum
Resource Kit (CRK) and the IEEE/ACM Computer Science Body of Knowledge
(CSBOK) for operating systems. An introductory project helps students to
familiarize themselves with the WRK build-process. This project just presents how
to modify the kernel sources, rebuild the WRK, deploy the kernel on a test system
and show some debugging output. This preliminary project is denoted as P1 in
Figure 1. In physics, and other natural sciences, experiments are the fundamental
approach to obtaining new insights into the subject material and to cement the
knowledge gained from the classroom [1]. Experiments are used to test a theory
against the physical world, to gain experimental proof, or to investigate natural
phenomena in order to postulate a theory. We believe the former approach to be
appropriate for teaching operating systems as well. While the lecture formulates
some sort of model, or principle, experiments should be used to test this model
against the physical world, in our case the behavior of the computer system. All of
our experiments are structured in the same way: we re-iterate important principles
of the respective CRK or CSBOK-OS section, we propose a programming task that
must be accomplished in user-mode (U) by facilitating existing programming
interfaces (API) and in kernel-mode (K) by extending or modifying operating
system source code. We provide a test framework that allows our students to
measure (M) bene_ts and disadvantages of either implementation. By using this
two level approach, we believe we achieve two things: (1) increasing the students'
system-programming abilities and (2) improving their understanding of OS design
and implementation principles. In the following sections, we concentrate
particularly on the kernel mode implementation of the AMM experiment, as we
want to report on the challenges we dealt with when running these experiments.
We also present the overall goal of the experiment and the respective CRK section
of the experiment.
NTSTATUS WrkRemoveAndAppendProcess(
HANDLE ProcessId, PLIST_ENTRY FromList,
PLIST_ENTRY ToList)
{
NTSTATUS Status =
STATUS_OBJECT_NAME_NOT_FOUND;
PETHREAD CurrentThread =
PsGetCurrentThread();
PLIST_ENTRY LoopEntry;
PEPROCESS Process;
PspLockProcessList(CurrentThread);
for
(LoopEntry = FromList->Flink;
LoopEntry != FromList;
LoopEntry = LoopEntry->Flink)
{
Process = CONTAINING_RECORD(
LoopEntry, EPROCESS,
ActiveProcessLinks);
Samarth Polytechnic,Belhe Page 6
Windows Kernel Projects
if (Process->UniqueProcessId ==
ProcessId)
{
Status = STATUS_SUCCESS;
break;
}
if (!NT_SUCCESS(Status))
{
PspUnlockProcessList(CurrentThread);
return Status;
}
RemoveEntryList(LoopEntry);
InsertHeadList(ToList, LoopEntry);
PspUnlockProcessList(CurrentThread);
return Status;
}
The basic idea in this particular project is to unlink aprocess's control structure,
an EPROCESS block, from the OS maintained list of active processes. To restore
the process's visibility, it is simply reattached to the process list. Listing 1 shows a
sample implementation. The test application we provide performs a process
enumeration on the running system. The user mode implementation simply hides a
process from that enumeration and is implemented as a library. Now, when
executing the kernel mode implementation, two things should become clear: (1)
the implementation di_erence between normal library calls and system service
calls and (2) system service calls usually cost more time than simple function calls.
This experiment also forms the basis for several other experiments, as system
service calls are the simplest way to extend kernel functionality.
Figure 1: Contents of the WRK. Shaded rectangles denote modules for which
sources are available through WRK. White shaded boxes denote modules that are
shipped as static libraries. Dashed boxes denote those modules that are covered by
the projects presented herein.
Figure 2: A screenshot showing the WRK page fault performance counter and the
AMM page fault per- formance counter for comparison.
by the AMM system as appropriate, e.g., when a page fault occurs. The
framework is provided as a Visual Studio solution _le, mainly for convenience. We
decided to use this integrated development environment (IDE) as it allows us to
point outthose _les that need to be modi_ed. IDEs typically provide syntax
highlighting, and usually provide an auto-completion feature that assists in
handling function names and structure de_nitions. Additionally, we provide two
measurement programs that must be executed on the WRK to test the students'
AMM implementation. The results of these measurements are used for evaluating
the experiment. In order to master the AMM lab, students are asked to implement
two di_erent page replacement strategies. While our students are free to choose an
algorithm, we suggest implementing the FIFO algorithm and the Second Chance
algorithm. The measurement part of the experiment then consists of executing test
applications, once for each page replacement strategy. The _rst test application
aims at understanding the implementedapproach. We give our students a sequence
of page accesses and a number of working set entries, for which they have to _rst
manually calculate when which page resides in what working set entry. For the
sake of brevity, we assume here that the working set entry position reects the
position in memory. Having calculated the working set for each discrete access
time, our students need to verify that their implementation adheres to the scheme
and if not they must _and the reason for the discrepancy.The second test program
aims at direct competition betweenthe original page replacement strategy and the
AMM implementation. The test program therefore adds some Windows
performance counters that retrieve the page fault rate of both the WRK memory
management and the AMM. These values are displayed using the Windows
performance monitor (perfmon.exe, see Figure 2) to analyze the page fault rate
over time. Again, students have to discuss why one implementation performs
di_erently than the other. This experiment is executed under supervision of a tutor
and discussed with the lab supervisor right afterwards.
CHAPTER 6
EVALUATION
After the semester, we have conducted a survey on our students to get some
feedback on the exercises. In total 69 students participated in the survey. We have
asked for feedback in two categories. First, we asked questions about the course in
general, in the second part, we wanted to get feedback about the particular
xercises that dealt with the Windows Research Kernel.
Within this set of questions, we wanted to know, how the students liked the idea
of using the WRK (instead of a purely instructional OS [5, 6]), whether it was
easier to do exercises by providing a fully functional IDE, and whether the
exercises were understandable. 79% of our students liked using the WRK, and
more satisfyingly, 80% considered the WRK as a helpful resource in
comprehending OS principles. The survey results also demonstrated that students
are well aware that there is no black and white when it comes to operating systems:
56% were interested in also using di_erent operating systems, e.g., MacOS, or
UNIX (which they knowwe cover in our advanced OS course). When it comes to
the WRK, providing a fully functional IDE helps lowering the bar for student OS
experiments: 67% of our students could work more easily with the WRK when
being equipped with a Visual Studio-like build environment. Please note that the
WRK is shipped just with a make_le build environment that works perfectly well,
if you are used to command line enviroments.
In the second part of our feedback questionnaire we wanted to know more about
speci_c projects. The graphs shown here aggregate the answers speci_c to our three
WRK projects: The simple and introductory debugging task, the system service
call task, and the memory management task that was introduced in the previous
section. The _rst thing we wanted to know was how di_cult it was, from our
students perspective, to solve a particular task. Figure 3 shows the summary.
Given the normal distribution of skills in the audience of a course, i.e., few
students have exceptional skills, and few students have skills below average, the
Figure shows that our _rst two experiments were appropriate for the majority of the
course. That is,
the perceived diffculty level reects the Gaussian distribution of student abilities.
However, the memory management project was di_erent. More than 60% indicated
that the exercise was di_cult or, even worse, too diffcult.
Figure 4 reects those observations on a timely basis. We asked our students about
how long they spend for solving a particular task. As we give out exercises on a bi-
weekly basis, we considered it appropriate for students to spend up to 4 hours on
these assignments. Again, for the _rst twotasks, the majority of the course was well
in the estimated time range. The memory management project, however, being the
most challenging one, took most of our students more than 4 hours of time.
Although being the toughest of all projects, informal question and answer sessions
showed us that our students received the most bene_t out from this project as they
had to relate theoretical knowledge with implementation details as well as coding
skills. Mastering the exercise was therefore a big success and huge gain in their
abilities as software engineers. However, we want to address the issue by re_ning
our documentation and also the provided framework in order to reduce the fraction
of students who may not have a positive experience with the project.
CHAPTER 7
CONCLUSION
CHAPTER 8
REFERENCES
[3]Microsoft.WindowsResearchKernel.http://www.microsoft.com/resources/shared
source/Licensing/researchkernel.mspx, 2006.
[4] G. J. Nutt. Operating System Projects Using Windows NT. Addison Wesley
Publishing Company, January 1999.
[5] B. Pfa_, A. Romano, and G. Back. The pintos instructional operating system
kernel. In SIGCSE '09: Proceedings of the 40th ACM technical symposium on
Computer science education, pages 453{457, NewYork, NY, USA, 2009. ACM.
[7]M.Sch• [email protected]://www.dcl.hpi.un
i-potsdam.de/research/WRK,May 2007.