NACHOS Source Code
Most of what you learn in this class you will learn by reading and
modifying NACHOS source code. You need to become very
familiar with the structure of that code, as early as possible. Here
are some important points.
- The Makefiles are designed to help organize
the projects. They work with gmake, rather than
make. Use these Makefiles all the time: don't
even think of issuing your own compiler commands.
- In order for the Makefiles to work properly, you need
to use exactly the directory structure in which the source is
now stored. You may also
get at the source files directly through UNIX on the CS system,
outside of any WWW browser, at the path
/condor/cscfclt/jmontgo2/cs546/nachos-3.4.tar.gz/code.
- The code directories are organized, not according to
the structure of the operating system, but according to the
projects. Since these projects correspond fairly well to natural
modules of the OS, that's not too bad for readability. But, some
of the basic files are in the threads directory, not
because they deal especially with threads/processes, but because
the first project is concerned with threads.
- To complete your project work, you are allowed to change OS
code, but not MIPS simulator code. All of the latter
is in the directory code/machine. Do not
change any file in
code/machine. code/threads/switch.s and
code/threads/swtch.s contain machine-dependent code for
context-switching. For your own peace of mind, don't change
these either.
Source Code
System Utilities
- Debugging flags, ASSERT, miscellaneous arithmetic
-
- code/threads/utility.h
- code/threads/utility.cc
- List manipulation
-
- code/threads/list.h
- code/threads/list.cc
- Bitmap manipulation
- User address spaces are bitmaps.
- code/userprog/bitmap.h
- code/userprog/bitmap.cc
Basic System Code
- Bootstrap the kernel
-
- code/threads/main.cc
- Global system data, initialization, cleanup
-
- code/threads/system.h
- code/threads/system.cc
Threads
- Representation of thread, fork, finish, yield, sleep operations
-
- code/threads/thread.h
- code/threads/thread.cc
- Scheduler for threads
-
- code/threads/scheduler.h
- code/threads/scheduler.cc
- Context switch
-
- code/threads/switch.h
- code/threads/switch.s
(machine-dependent, do not modify)
- Synchronization primitives (semaphores, locks, condition
variables)
-
- code/threads/synch.h
- code/threads/synch.cc
- Synchronized list access
-
- code/threads/synchlist.h
- code/threads/synchlist.cc
- Test program: two threads alternating
This test is executed by the system from the
main function in
code/threads/main.cc. It is not a user program.
-
- code/threads/threadtest.cc
User programs
- Manage user address space
-
- code/userprog/addrspace.h
- code/userprog/addrspace.cc
- Enter System from User Program (system call, exception,
interrupt)
-
- code/userprog/syscall.h
- code/userprog/exception.cc
- Test programs: run user program or test console
- One of the test functions StartProcess or
ConsoleTest is executed by the system from the
main function in code/threads.main.cc.
- code/userprog/progtest.cc
File System
- General operations
-
- code/filesys/filesys.h
- code/filesys/filesys.cc
- Directory management
-
- code/filesys/directory.h
- code/filesys/directory.cc
- Open file management
-
- code/filesys/openfile.h
- code/filesys/openfile.cc
- Synchronous disk access
-
- code/filesys/synchdisk.h
- code/filesys/synchdisk.cc
- Disk file header
-
- code/filesys/filehdr.h
- code/filesys/filehdr.cc
- Test program for file system assignment
-
- code/filesys/fstest.cc
Networking
User programs for testing
Utilities (bin)
MIPS Simulator (do not modify)
Makefiles
code/Makefile
code/Makefile.common
code/Makefile.dep
code/threads/Makefile
code/userprog/Makefile
code/vm/Makefile
code/filesys/Makefile
code/network/Makefile
code/bin/Makefile
code/test/Makefile
Direct access to all the directories and files.
Back to CS 546 Homepage
Last modified: Thu Sep 12 13:22:42 1996
by <jmontgomery@cti.depaul.edu>