[CS Dept logo]

Com Sci 230
Operating Systems

[back] Department of Computer Science
[] The University of Chicago

Last modified: Mon Feb 26 11:40:40 CST 2001

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. I haven't figured it out entirely myself, but I've noticed a few important points.

  • Guide to Reading the Source Code
  • 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
  • code/threads/synch.h-alt1 (ConditionVariables revised by Mike O'D)
  • code/threads/synch.cc-alt1 (ConditionVariables revised by Mike O'D)
  • code/threads/synch.cc-alt2 (Exchanger implemented with condition variables by Mike O'D.)
  • Synchronized list access
  • code/threads/synchlist.h
  • code/threads/synchlist.cc
  • code/threads/synchlist.cc-alt1 (ConditionVariables revised by Mike O'D)
  • 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
  • Test program: readers and writers with bounded buffer, by Mike O'D.
    This test is intended to be executed by the system from the main function in code/threads/main.cc. In order to run it that way, you must make a small and obvious change to main. In order to compile it with the gmake command, you must modify code/threads/Makefile and code/Makefile.common. Use the treatment of threadtest.o/threadtest.cc as a model, and do the same things to buffertest.o/buffertest.cc.
  • code/threads/buffertest.cc
  • Test program: communication channel, by Mike O'D.
    Analogous to the reader/writer test above.
  • code/threads/channeltest.cc
  • Test program: channel-buffer cycle, by Mike O'D.
    Analogous to the reader/writer test above.
  • code/threads/chanbuftest.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
  • These appear to be utilities for testing/debugging
  • User programs for testing
  • 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 (~odonnell/WWW/OData/Courses/CS230/NACHOS/code)