Welcome the homepage of
Last updated: 2007/5/16
Take me to the download area directly
What is Awk-Linux?
Awk-Linux is an instructional operating systems based on program instrumentation. In Awk-Linux, selected user programs are instrumented and combined into an executable program named awkos.exe, including necessary kernel features extracted from the real Linux kernel. When students run awkos.exe, they can observe user programs being executed concurrently in a time-sharing manner. However, there never exists a real kernel in awkos.exe. Briefly speaking, the concurrency of user programs in Awk-Linux is emulated by goto statements of C.
What makes Awk-Linux different from other educational operating systems?
Compared with similar systems such as Nachos, OSP, and XINU, Awk-Linux exhibits the following characteristics:
(a) Awk-Linux can be run partially, without the support of a kernel with minimal set of services. That is, OS components can be implemented on an as-need basis when designing course projects for students. For example, in the sys_sleep() project to be described below, the provided source code has only 222 lines of code, including comments. In contrast, other instructional operating systems need to implement a minimal set of basic kernel functions in order to be operative.
(b) There is no dependence of Awk-Linux on any particular hardware simulator or platform. Only Awk and GNU C compiler are needed. As such, maintenance and porting are much easier.
(c) Time and effort needed to craft Awk-Linux are greatly reduced for reasons mentioned in (a) and (b).
(d) The Linux kernel coding style is preserved since the provided source code is extracted and simplified from the real Linux kernel.
What is AWK?
Awk is a text manipulation tool under UNIX, which provides a script language for programming. Awk allows users to define string patterns to be matched, where string patterns are specified using regular expressions. It parses the input file line by line. When a match occurs between a string and one of the patterns, a block of Awk statements is executed. One can replace the string or rewrite the whole line. One common application of Awk is conversion of a file into the desired format. Awk is used in this study as a program instrumentation tool to simulate basic hardware functions.
What is Linux?
This problem should not be asked if you are a CS-related people. However, a link is here for you http://en.wikipedia.org/wiki/Linux. There are plenty of resources, including links to Linux kernel documentation.
Platforms, Requirements, and Compilation Instructions
Awk-Linux projects can be executed under Linux or Windows with Cygwin installed. Please also make sure the gawk, gcc, make are installed.
To compile a awk-linux kernel please invoke:
gawk -f makekernel.awk user1.c user2.c user3.c .....
This will generate a C file called
awklinuxos.c. AwkLinux.c is the main program which can combine
arbitrary number of user programs provided at the end of the command. A
Makefile is written for you to compile awklinuxos.c into an
execution file awkos.exe. When awkos.exe is
executed, awklinuxos.c will context switch all the user programs
according to a simple round robin scheduling algorithms.
Some notes from the author:
(1) We are willing to share the projects with all the operating systems tutors around the world. The projects listed here have been used in our undergraduate OS courses for three years, that is, these projects have been proved and validated. Please email me at email@example.com if you encounter any problems.
A. Scheduler: Implementation of sys_sleep()
handout: projects\sys_sleep-handout-english.doc (english version)
The purpose of this kernel project is to enhance studentsˇ¦ understanding of the functioning of the scheduler. For this project, the provided source code had to create an illusion of concurrency. The code included two user programs, test1.c and test2.c, and necessary kernel functions. A timer interrupt handler do_timer() and a simple round robin scheduler are included. The kernel provided to students was a two-state scheduler as shown in Fig. 7. The body of the system call sys_sleep() was left empty. With this project, students were asked to fill in details of sys_sleep() so that the output of test1.c and test2.c would interleave at a ratio between 1:3 and 1:5.
Fig. 7. A two-state scheduler.
To complete the assignment, students first needed to know that process control blocks in Linux kernel were maintained as a doubly-linked-list. They then had to modify the timer interrupt handler, added new fields and flags to the data structure of the process control block, created a waiting queue, and finally manipulated the linked-list when a sleep process was waken up. They also needed to modify the kernel into a three-state scheduler shown in Fig. 8. Some of the C macros in Linux kernel were provided for students to use. Once the implementation was completed, students could write their own programs to verify results. This project, though involving only such basic concepts as processes, process control block, process state transition, ready queue, and wait queue, was critical to studentsˇ¦ successful completion of later projects.
Fig. 8. A three-state scheduler.
B. Semaphores: Implementation of semget() and semop()
handout: projects\sys_sem-handout-english.doc (english version)
This project aims at reinforcing studentsˇ¦ understanding of inter-process communication, process synchronization, semaphores, and blocking process in the wait queue. Instrumentation for this project was the same as that for the previous project. Two user programs containing the calls to semget() and semop() were provided. Students were required to implement the system calls so that the two user programs would synchronize correctly. Specifically, students must perform the following activities in this project:
l setting up the data structure of a semaphore that included a wait queue,
l moving a process to the wait queue of a semaphore when a semaphore call should be blocked, and
l waking up the blocked process of a semaphore when a signal was invoked.
C: Virtual Memory: Implementation of do_page_fault()
handout: projects\do_page_fault-english.doc (english version)
This project required students to complete the page-fault interrupt handler (do_page_fault()). Students were provided with necessary functions and macros to allocate a frame and manipulate page table entries. The paging hardware was the two-level paging hardware described in the previous section. When user programs were executed and page faults occurred, students would notice that do_page_fault() was called and the logical address which had caused the page fault was passed as a parameter. The body of do_page_fault() was left empty. Students had to complete do_page_fault() correctly to have user programs run correctly. They needed to allocate frames for page tables, set up frame addresses in the page table entries, and set the valid bits. An incorrect implementation would result in a core dump.