Teaching Linux Based Operating System
Teaching Linux Based Operating System
5. FINDINGS
Using the Pocket-Linux guide to compile a kernel was more
than just a step-by-step process. The main problem was getting
hold of all the correct source code, and then ironing out all the
compile time errors. The guide recommends stripping all the
Figure 2 non-essential parts of the kernel so as to keep the size down, but
in our case some of these non-essential components could be
1. Some code in the kernel calls anyone of those methods used to better understand the kernel functionality. There are also
2. The method calls the system call getSchedConfig() to some components that are completely removed in the guide that
check whether the original or the hacked version should be would aid in learning, such as access to hard disks, to access
called. benchmark files, or creating logs that could be viewed at a later
stage in a stable environment.
3. getSchedConfig() returns an answer.
The modularization of the VM sub-system proved to be too
4. If a hacked version is needed then {method}_mod() system much of a challenge, as it is too extensively linked into other
call is called. core components of the kernel. Some progress was made in
5. The module in SchedMod.c will intercept this call, as it deciphering the little documentation that is available, and
has already replaced the {method}_mod() address on the comments were added to the source code in order to easy the
sys_call_table with an address of its own. understanding of the functionality, and the purpose of the
methods.
The 2.4 series of kernels were easier to understand, especially mounted file system) and for setting up the superblock structure
the earlier ones, as the paging algorithm was still implemented and most importantly the superblock field, write various
in software, and this aided the understanding of the later kernels super_operations functions, write various inode_operations
in the 2.4 series, as well as the 2.6 series. The differences functions and finally write various file_operations functions
between the two major versions is that the 2.6 kernels have more [15].
than one swap-out daemon (one daemon per memory node),
Due to the fact that the current implementation of Linux allows
which is not all that much of a change. All that is required is that
you to use loadable modules, adding a new file system to the
the previously global variables be moved so that there would be
kernel is made relatively easy. The kernel does not need to be
one copy of each in each zone of the nodes
recompiled every time a change is made. The new file system
In order to compile a module the path of the Linux kernel source can be written and compiled separately and then loaded into the
code is required, and since the compressed source is already kernel if and when it is needed.
35MB and 120MB when decompressed, it is pretty unlikely that
we can provide the a modifiable teaching tool based on just 6. CONCLUSION
floppy disk. Alternatively we can, mount a USB flash drive, and
direct the path of the Linux source code there. To give students a more practical course in operating systems
requires a stable OS that also allows some form of
Majority of all the kernel source code were written in C, the rest configurability. Previous work found that the Windows CE
in assembler, and this might pose a great challenge for students, platform was not suitable for this application. The Linux kernel
as the C language is not part of their syllabus. Even for someone does conform to these requirements, and can also be
who is proficient in C, there are many macros and extern implemented in a minimalist manner which is also desirable in
methods that are defined outside the current .c file that one terms of ease of testing.
might be looking at.
The Linux kernel is available for free, unlike some proprietary
The implementation of the scheduler module requires a pretty systems, and there is a community of knowledge available in the
in-depth knowledge in C, and it also requires a very skillful and form of online guides, numerous books as well as message
advance programmer. When someone is writing a normal main() boards. Although these seem like a plentiful source of
program, a syntax error means a quick shout from your gcc knowledge, there are some sections of the kernel that are only
compiler and a logic error means a core dump or segmentation fully understood by a small number of individuals that are
fault. But since kernel module runs in kernel space, your little involved in the development of kernels, and this could be seen
syntax error will probably only be discovered halfway through as a detracting factor.
your kernel recompilation which takes about 10 minutes. Any
logical error in the module will either freeze the entire system or As we have shown, the Pocket Linux Guide is easy to follow
reboots the system without a warning, neither is desirable. and the end product is a form of throw-away testing which
would not influence the uptime of laboratory workstations due
The following summarizes the major findings when attempting to buggy code. The “pocket-linux” also provides a fast method
to modularize the process scheduler. by which kernel compilations can be tested. There would still be
The new O(1) Scheduler is a hybrid of the two a need for some form of Linux specific laboratory for the
tradition scheduling policy RR(round robin) and FIFO students to do their development, but the need for testing
(first in first out). specific machines is eliminated.
Understanding the current O(1) scheduler is already One negative that became apparent during the project was the
an appealing educational exercise. lack of knowledge of the C programming language. Although
there are many similarities between C and C++, some of the
Writing the methods that will replace the default ones
conventions needed to be investigated to be fully understood. If
will require the student to be skillful in C and to have
the operating systems course were to go ahead, an introductory
good knowledge of Linux internals.
into the C programming language would be needed before a
While writing a module and system-calls to abstract student could progress onto working with the source code.
out the scheduler is a good idea, it is not a strategy
that I recommend to encapsulate ALL parts of the The Linux kernel is after all monolithic and hence heavy
operating system. coupling, even after the scheduler was abstracted as a module
and modifications were made, it would be extreme difficult to
Pocket Linux alone will not be able to produce a tell what went wrong should an error occurs. By just knowing
developing environment for kernel editing, modifying one part of the OS, it is often difficult to see what other parts are
and testing. connected or indirectly connected to it, therefore it would be
Using default system calls can also change the current wiser to look at a simpler and earlier version of Linux in the
behavior of the scheduler to a certain degree. future but with specify documentation or books already
obtained.
If the 2.4 version were used, either Bossa or DWCS
can be used to modularize the scheduler. With the increasing popularity of the Linux operating system,
choosing it to be used as a base from which to teach a practical
Writing a file system requires following a few basic steps,
operating systems course would not only benefit the students in
namely: Register the file system, write a function for reading the
the future, but also the open source community, as there could
superblock (the data structure that holds information about each
conceivably be more individuals with experience in the inner [6]. Andrew S. Tanenbaum. Modern Operating Systems, 2nd
workings of the operating system. Edition. Upper Saddle River, NJ: Prentice-Hall, 2001.
[7]. Scott Rhine, Hewlitt-Packard Company,
7. ACKNOWLEDGMENTS http://linux.ittoolbox.com/documents/document.asp?i=111
Our thanks to: 7, 3 Mar 2000
[8]. Rich West, http://www.cs.bu.edu/fac/richwest/dwcs.html,
Matthew West, System Administrator in UCT Computer Jun 2004
Science Department, for helping us in providing background [9]. Panagiotis Christias, http://unixhelp.ed.ac.uk/CGI/man-
information about Linux kernel. cgi?sched_setscheduler+2, Jun 2002
Prof. Ken MacGregor, our supervisor, for guiding us along the [10]. Worcester olytechnic Institute,
way and providing background materials. http://fossil.wpi.edu/docs/howto_add_systemcall.html, Jun
2004
[11]. Jay Salzman, http://www.tldp.org/LDP/lkmpg/2.6/html/,
8. REFERENCES May 2004
[1]. David Horton. Pocket Linux Guide. [12]. Robert Love,
http://my.core.com/~dhorton/linux/pocket/ 2004 http://www.samspublishing.com/articles/article.asp?p=101
[2]. Mel Gorman. Understanding the Linux Virtual Memory 760, Nov 2003
Manager. Prentice-Hall,2004. [13]. Freeos.com, http://www.freeos.com/articles/3838/, March
2001
[3]. Abhishek Nayani. Memory management in Linux –
[14]. A. Rubini, The“Virtual File System” in Linux, May 1997,
Desktop companion to the Linux source code, 1994.
http://www.linux.it/kerneldocs/vfs/vfs.html
[4]. Gary Nutt. Operating systems second Edition. Addison [15]. Writing a Linux FileSystem Module, July 2001,
Wesley, 2002. http://www.cise.ufl.edu/~ppadala/publications/fs/slide001.h
[5]. Rodney R. Oldehoeft, Maekawa Mamoru and Arthur E. tml
Oldehoeft. Operating Systems, Advanced Concepts.
Benjamin/Cummings Publishing, 1987.
This document was created with Win2PDF available at http://www.daneprairie.com.
The unregistered version of Win2PDF is for evaluation or non-commercial use only.