You are on page 1of 4

2010 Second International Workshop on Education Technology and Computer Science

Construction of the Practical Teaching System on


Operating Systems Course
Hongwei Li, Changhong Yin, Yaping Xu, Qingjun Guo
School of Computer Science and Engineering
Jiangsu Teachers University of Technology
Changzhou, China
jstulhw@gmail.com

Abstract—Operating systems course is very important. It is not Students can analyze, modify and extend the functions of MOS
only the core of computer professional curriculum, but also the to train their system programming ability and make them
base of designing or developing computer system software and further understand the principles and the process of the co-
application software. However, the practical teaching of working of computer software and hardware.
operating systems course is difficult. In this article, we introduce
the construction of the practical teaching system on operating This article is organized as follows. The teaching practice
systems and design a positive experimental environment of operating systems is analyzed in the second section. The
according to the teaching content through comparing lots of construction of the practical teaching system is given in the
operating systems practical textbooks from the perspective of third section. Conclusions are presented in the last section.
teaching practice, at last we provide a MOS system for students,
they can analyze, modify and extend the functions of MOS to
II. ANALYSIS OF OPERATING SYSTEMS OF TEACHING
master operating systems concepts and theory.
PRACTICE.
Keywords-Practice Teaching; Operating Systems Course; At present, there are more than 400 textbooks that are
practical teaching platform related to operating systems through the professional system
inquiry, including more than 150 textbooks of operating
I. INTRODUCTION systems. We found that most of the textbooks focus on the
theory and concepts of operating systems after detailed
The so-called practical teaching system refers to the analysis of these textbooks. Even if the practical strong
application of systematic scientific theory and methods, to textbooks are targeted at algorithms or programs of processor
conduct an overall design using the composition of the various and process management, memory management, I/O
elements of practical teaching, to form the optimal structure management, file systems, and interrupt management. They are
and function of the practice of teaching system[1]. Its core is lack of systematic and integrity. In addition to operating
to build effective practical teaching modules and design systems with source code are very large, such as Linux kernel
practical teaching contents. has hundreds of thousands or even millions of lines of source
An operating system defines an abstraction of hardware code, Minix exceeds two million lines of source code. While
behavior with which programmers can control the hardware. It reading a mass of source code for an undergraduate is very
also manages resource sharing among the computer’s users[2]. difficult. on the other hand, these systems have implemented
Over the years, operating systems and their abstractions have all functions of operating systems, students can only make use
become complex relative to typical application software. of the system calls or APIs that are provided by the operating
system to create and destroy a process, to achieve interprocess
The teaching purpose of Operating Systems course is for synchronization and mutual exclusion, memory allocation and
students to know its basic concept, principle and method, to be free, and file management, and so on. Students as an observer's
familiar with its management, control function and interface identity can only feel and experience of operating system
function between users and computers, to know its function features and functions. They cannot design and code the
and position in computer system and its relation with hardware operating systems by themselves. This is not good to the
and other software, and to analyze, design and debug its related practical teaching of operating systems. In view of this,
algorithms and program modules. The most important task is to improving the practical teaching of operating systems is
train students’ innovation and practical application ability. imminent. In this article, we has explored the practical teaching
It is hard to teach operating systems because, in this field, of operating systems course to construct a practical platform
theory and practice mix probably more than in any other field. where students can design a multi-tasking MOS operating
However, considering operating systems now, most concepts in system and write its code by themselves. Let students attain
the field are of interest only if they make the resulting system specific operating system works and systems development
perform well. This means that practice is so related to theory process. Students can learn operating system theory and
that students are not likely to understand theory unless exposed systems development steps through the do-it–themselves
to a real system. So, MOS (Mini Operating System) is provided. practice.

978-0-7695-3987-4/10 $26.00 © 2010 IEEE 405


DOI 10.1109/ETCS.2010.184
III. CONSTRUCTION OF PRACTICAL TEACHING SYSTEM 1) MOS hierarchy structure : The practice of MOS system
Practice teaching is a systems integration process, it is development using hierarchical modular structure is shown in
necessary to have an adequate knowledge of basic theory as a Fig. 1. MOS-IOS (MOS Input/Output system) layer is
prerequisite, but also a reasonable arrangements for teaching dependent on the PC ROM-BIOS, which provides basic
contents and teaching system design. input/output functions, such as: read/write disk, read/write file
allocation table FAT, query the file cluster number. On top of
A. Established Courses System the MOS-IOS is a variety of MOS management modules,
A good development environment is the precondition of including process control, semaphore management, clock
the practical teaching. At least, students should be able to see management, memory management, file system, and I/O
how a decent system works, how to use it, and how to extend it. management. Applications use these functions provided by
To fix this problem, we have introduced MOS as the operating these managers through system call interface. MOS command
system of choice for the practical teaching. handler provides the interface for the user operating computer.
Students must master Assembly Language based Intel
80x86 CPU of real-mode, C Programming, Data Structure, etc, Application
before the practical teaching of operating systems. These
courses enable students to systematically understand the basic MOS command handler
programming methods, ideas, and algorithms. On this basis,
MOS system call interface
students learn Principles of Computer Organization,
Microcomputer Principle and Interface Technology based on process Semaphore Clock Memory File I/O
Intel 80x86 CPU, Operating System. Students with the Manager Manager Manager Manager Manager Manager
knowledge of the above have the ability to prepare do-it-
themselves Mini Operating System. MOS-IOS

B. The Establishment of the Practice Environment. Figure 1. MOS hierarchical structure


We have established the following development
environment: 2) Memory layout: MOS can manage the memory size of
x Software environment. Development platform with 1MB in the Intel 80x86 CPU real-mode, Fig 2 is its memory
supporting for 80x86 16-bit real-mode compiler layout. The entire memory space is divided into three parts, the
(Borland C++ 4.5); Virtual machine tool: Bochs V2.1 first part of the system space from 0x00000 to 0x31fff a total of
or above that simulates a computer; Disk image file 200KB; second part is the user space from 0x32000 to 0x9ffff
tools: WinImage that will write the programs or files to a total 440KB; third part of the PC, reserved space, from
the floppy disk or an image file; WriteBoot that writes 0xa0000 to 0xfffff a total of 384KB.
bootstrap to the boot sector of a floppy disk or an
image file; Assembly language compiler: NASM, it
will translate assembly language statements into the 0xfffff
target computer's machine code; Operating system: PC reserved (384KB)
Windows 98 or above. 0xa0000
User space (440KB)
x Hardware environment: the system is very small, a 0x32000
1.44-MB 3.5-inch floppy disk can hold all program. System space(200KB)
We can say that there is little computer hardware 0x00000
requirements, but considering the system code
development platform is to use the Visual Figure 2. MOS memory layout
programming tools(Borland C++ 4.5), so the hardware
is a PC that can install Windows 98 at least. 3) Implementation of process management: Process is the
most central concept in any operating system. Everything else
C. Design Practice Projects
hinges on this concept, and it is important that the operating
In order to make the practice teaching system to have rules system designer ( and students) have a thorough understanding
to follow, We have established the hierarchy of MOS frame of what a process is as early as possible. Implementation of
according to the contents of teaching and provided the
process manager is a key part of the practice, but also the
development guidance for teachers and students. In order to
reduce the complexity of the system, the system directly calls traditional teaching of one of the most difficult to grasp.
a variety of input and output functions which provided by Students develop an operating system that is no longer on top
ROM-BIOS, which can achieve keyboard input, display output, of the existing operating system through the system calls to
read/write disks and other operations. The concrete practice achieve the control of the process, but according to actual
modules are as follows: needs in themselves MOS to design creating, destroying and
managing process. It will not only stimulate the students
interest in learning, but also to avoid obscure teaching

406
effectively, to enhance the student hands-on capacity, to master Use the semaphore can implement process synchronization
operating system concept. The concrete practice steps are as and mutual exclusion to ensure the correctness of the system
follows: resource scheduling. The MOS provides a four system calls
associated with the semaphore:
a) Processes control
Scheduling policy of MOS is Priority based preemptive x Create a semaphore: SysCreateSem. This system call
real-time kernel. The process of MOS has three states, they are creates a semaphore object, and assigns the initial
ready, running and blocked. The transition of each process value to the semapore, it returns the semaphore object
among the states shows in Fig 3. When a process obtains the identifier.
processor, its state is the running. A process waiting for
x Delete a semaphore: SysDelSem. It deletes the
processor in the ready queue is the ready state. A running
specified semaphore.
process becomes the blocked state because waiting an event
occur. There are three system calls to implement processes x P operation: P. The P operation decrements the
semaphore value. If the value becomes negative, then
the process executing the P is blocked. Otherwise, the
process continues execution.
Running
x V operation: V. The V operation increments the
Wait an event semaphore value. If the value is less than or equal to
dispatch zero, then the process executing V operation wakes up
Preempted a process that is blocked by a P operation.
d) MOS command handler
Ready Blocked Command handler mainly accepts user's keyboard input
An event occurs
commands. if students write a command handler, they can
Figure 3. MOS states transition diagram further understand the process of the operating system handling
a command.
control in MOS system. At system startup, MOS command handler creates an IDLE
system process that has the lowest priority and is responsible
x Create a process: SysCreateProc. In order to simplify for receiving user keyboard input, and executes the appropriate
the process of management, all of the processes are command. Command is divided into internal command and
equitable in status except the priority, while a process external command, there is only one internal command: dir that
creates a new process, the process and the created displays the disk directory, external commands are stored as
process have the same status. The main task of files on disk, the executable file is a .EXE format file. When
SysCreateProc is to apply for a stack, an idle process the IDLE receives an external command, it looks up the
control block PCB for a new process, and to initialize external command in the disk, and then moves it to the memory,
the stack and fill out the PCB information, and then to creates a new process, and then let it run. As long as one user
insert the PCB into the ready list by the priority to wait processes exists, the IDLE is in circular wait until the user
for the process scheduler to select. process to end. Once the system does not have a user process,
IDLE again receives keyboard commands.
x Destroy a process: SysDelProc. A process at the
running state can be deleted by itself. e) Memory management
x Dalay a process: SysTimeDly. A process at the running Memory is an important resource that must be carefully
state can be delayed Several clocks. The clock interrupt managed. This practice will manage 64KB space that begins at
handler wakes up it when the delay time go over. 0x22000. MOS can use dynamic partitioning technique to
allocate memory, it will provide two system calls, they are
b) Scheduler SysMemAllocate and SysMemFree. SysMemAllocate allocates
As MOS uses priority scheduling algorithm, the processes memory, SysMemFree frees memory.
in the ready list are row by priority. The first process in the
ready list is the highest priority, its state is running. We can set f) File managment
up two global variables in MOS, one is MOSPCBCur, it is the File system is a method for storing and organizing
process that is running on the processor; one is MOSRDLPCB, computer files and the data they contain to make it easy to find
it is the first process of the ready list. Normally the value of and access them. MOS will provide the system calls to create
two variables is equal, if not equal, indicating a change in the file, open file, read, write and close file.
ready list, or a higher priority process into the ready list, or the
current running process left the ready list due to blocked. at this g) I/O management
time, the scheduler will select a new ready process to run. The device management involves numerous external
devices. Because a variety of devices for their management is
c) Semaphore management very complex, serial communications as an example of this
practice in order to design MOS's I/O management system,
providing four serial communication system calls. They are:

407
x Open the serial communications device: SysOpenIO. IV. CONCLUSIONS
The system call initializes the serial-port COM1 and We provide the source code of MOS system, its source
COM2, and allow the 8259A response interrupt from code is very small, about 2000 lines. The students may modify
them. Initialization settings of COM1 and COM2 are and extend the function of MOS. The practical teaching of the
the transport bit 8 bits, stop bits 1 bit, no parity, the operating system mentioned in this article is applied to real
baud rate 19200bps. teaching environment, have gotten good result in teaching, and
x Write the serial port˖ SysWriteIO. The first writes greatly enhances the effect of teaching. A good reference
information to the output buffer; Secondly, to allow model is provided by the practical teaching of operating
serial port to send the interrupt signal request generated. systems. Practices prove that through system programming,
students have deep understanding of the management
x Read serial port: SysReadIO. The system call reads a mechanism of operating systems and their programming ability
character from the input buffer and returns, if the input is improved a lot.
buffer is empty, it returns the 0xFF.
x Close the serial port: SysCloseIO. The system call is REFERENCES
very simple, it clears the interrupt of the serial port. [1] R. X. Ju, “The practice of higher vocational education
curriculum,”.Vocational and education, China, 2006,(24), pp.133.
h) user interface management [2] IEEE Computer Society, “Computer Science Curriculum 2008: An
To simplify the MOS system, The MOS only provides 18 Interim Revision of CS 2001”, http://www.computer.org/portal/
cms_docs_ieeecs/ieeecs/education/cc2001/ComputerScience2008.pdf.
system calls, their entry is the interrupt vector 0x80. We only 2008.
set the function number and input parameters to the specified [3] F. J. Ballesteros, S. Arevalo. “Using Inferno for an Advanced Operating
registers, then call INT 0x80 instruction to implement the Systems Course(2001)”, http://citeseerx.ist.psu.edu/viewdoc/similar?doi
function of the system call. Using system calls to design multi- =10.1.1.88.6535. 2001.
tasking programs, memory allocation programs, and file [4] W. Stallings, "Operating System - Internals and Design Principles",
system can help students further understand the principles of 2006: Publishing House of Electronics Industry.
operating systems. [5] Andrew S. Tanenbaum, “Modern Operating Systems (2nd. Edition)”.
China Machine Press, 2006.

408

You might also like