MOSS Deadlock Simulator
Installation on Unix/Linux/Solaris/HP-UX Systems

Purpose

This document provides instructions for the installation of the MOSS Deadlock Simulator on Unix operating systems. This procedure should be the same or similar on Unix, Linux, Solaris, HP-UX and other Unix-compatible systems. The MOSS software is designed for use with Andrew S. Tanenbaum, Modern Operating Systems, 2nd Edition (Prentice Hall, 2001). The Deadlock Simulator and this installation guide were written by Ray Ontko (rayo@ontko.com).

This installation guide only provides information about installing the software and testing the configuration for Unix-like operating systems. To install on Windows operating systems, please read the Installation Guide for Win95/98/Me/NT/2000 Systems. For more detailed information about the simulator, please read the User Guide.

Requirements

The following software components are required to install and use the MOSS Deadlock Simulator.

Pre-Installation

Before installation, you should verify:

If you're using a standard command-line java compiler, the following instructions will help determine if your environment is configured correctly.

  1. Verify that you have java installed and configured in your environment.
    $ java -version
    
    You should see a message like this with possibly a different version number.
    java version "1.1.8"
    
    If you get a message like:
    java: Command not found.
    
    Then java may not be installed on your system, or may not be configured for your use.

    If you think that Java may already be installed on your system but may not be in your "path", you can find it by

    $ find /usr -name java -print
    
    On my system, for example, the following is returned.
    /usr/lib/netscape/477/communicator/java
    /usr/lib/netscape/477/netscape/java
    /usr/lib/jdk1.1/bin/java
    /usr/lib/jdk1.1/bin/ia32/green_threads/java
    /usr/share/java
    /usr/bin/java
    /usr/src/kernel-source-2.2.17/include/config/binfmt/java
    
    On my system, I also searched for "javac" and found that it exists in /usr/bin/java. I'll use this jdk for my installation.

    If Java isn't available on your system, you should check with your instructor or system administrator. If you administer your own system, then you should be able to find a copy of Java for your operating system.

    If you find that java is installed but not configured for your use, then perhaps you need to add it to your path. Consult your instructor or system administrator if you need help adding this to your path.

  2. Verify that the java compiler is installed and configured in your environment.
    $ javac
    
    If you're using a standard java command-line compiler, you should see a message similar to this.
    use: javac [-g][-O][-debug][-depend][-nowarn][-verbose][-classpath path][-nowrite][-deprecation][-d dir][-J] file.java...
    
    If you get a message like:
    javac: Command not found.
    
    then the java compiler may not be installed on your system, or may not be configured for your use. Consult your instructor or system administrator.

  3. Verify that that the current directory is in your classpath.
    $ echo $CLASSPATH
    
    You should see a list of directories separated by colons (":") or possibly just a blank line. If you don't see the directory "." (a single period, which stands for the current directory), then you should add it to the claspath.

    Determine which shell you're using:

    $ echo $SHELL
    

    If you're using sh, ksh, or bash:

    $ CLASSPATH=.:$CLASSPATH
    $ export CLASSPATH
    

    If you're using csh, or tcsh:

    % set CLASSPATH=.:$CLASSPATH
    

If you have a working java runtime environment, a working java compiler, and the current directory is in your path, then you're ready to proceed with the installation.

Installation

Installation of the software can be accomplished with these simple steps:
  1. Create a directory in which you wish to install the simulator (e.g., "moss/deadlock").
    $ cd
    $ mkdir moss
    $ cd moss
    $ mkdir deadlock
    $ cd deadlock
    

  2. Download the compressed tar archive (deadlock.tgz) into the directory. The latest release for this file can always be found at http://www.ontko.com/moss/deadlock/deadlock.tgz.

  3. Expand the compressed tar archive.
    $ tar -xzf deadlock.tgz
    
    or
    $ gunzip deadlock.tgz
    $ tar xf deadlock.tar
    

Files

The directory should now contain the following files:

Files Description
deadlock.tgz Compressed tar archive which contains all the other files.
Command.java
CommandParser.java
ControlPanel.java
DatFilenameFilter.java
DeadlockManager.java
Kernel.java
OptionsDialog.java
Process.java
ProcessesDialog.java
ProcessesPanel.java
Resource.java
ResourcesDialog.java
ResourcesPanel.java
deadlock.java
Java source files (*.java)
Command.class
CommandParser.class
ControlPanel.class
DatFilenameFilter.class
DeadlockManager.class
Kernel.class
OptionsDialog.class
Process.class
ProcessesDialog.class
ProcessesPanel.class
Resource.class
ResourcesDialog.class
ResourcesPanel.class
deadlock.class
Compiled Java class files (*.class)
a0.dat
a1.dat
b0.dat
b1.dat
Sample input files
install_unix.html
install_windows.html
user_guide.html
user_guide_1.gif
Documentation and associated images
copying.txt Gnu General Public License: Terms and Conditions for Copying, Distribution, and Modification

Compilation

The distribution includes compiled class files as well as the source java files. You should not need to recompile unless you decide to change the code.

If you wish to compile the code, the following commands should work if you're using a Java compiler that accepts the normal "javac" command line.

$ javac -nowarn *.java

The -nowarn flag supresses warning messages, of which there may be several. For backward compatability we use only those features of Java which have been present from the beginning, some of which are deprecated and are usually reported by the compiler with warning messages.

Test

To test the installed program, enter the following command line.

$ java deadlock a 2 1 >a.log

The program will display a window allowing you to run the simulator. When the window presents itself, click on the "run" button. You should see the program "execute" cycles, about one per second. When the simulation completes, click the "exit" button.

The program simulated the creation of two processes and read commands for each process from the files "a0.dat" and "a1.dat". It also simulated creation of a resource with an available quantity of 1. During the execution of the simulator, a process executes, or requests or frees a resource. If there are no available instances of the resource, the process blocks. The simulation runs until all processes halt.

The input file "a0.dat" looks like this:

/*
a0.dat

The "a" collection of process data files is meant to simulate
two processes competing for a single resource.  If you run
the simulator with one resource available, one of the processes
will block until the other is done using the resource.
*/
C 10    // compute for 10 milliseconds
R 0     // request resource 0
C 10    // compute for 10 milliseconds
F 0     // free resource 0
H       // halt process

The input file "a1.dat" looks like this:

/*
a1.dat

The "a" collection of process data files is meant to simulate
two processes competing for a single resource.  If you run
the simulator with one resource available, one of the processes
will block until the other is done using the resource.
*/
C 10    // compute for 10 milliseconds
R 0     // request resource 0
C 10    // compute for 10 milliseconds
F 0     // free resource 0
H       // halt process

If things are working correctly, the "a.log" output file should look something like this:

time = 0 available = 1 blocked = 0
time = 1 available = 1 blocked = 0
time = 2 available = 1 blocked = 0
time = 3 available = 1 blocked = 0
time = 4 available = 1 blocked = 0
time = 5 available = 1 blocked = 0
time = 6 available = 1 blocked = 0
time = 7 available = 1 blocked = 0
time = 8 available = 1 blocked = 0
time = 9 available = 1 blocked = 0
time = 10 available = 0 blocked = 1
time = 11 available = 0 blocked = 1
time = 12 available = 0 blocked = 1
time = 13 available = 0 blocked = 1
time = 14 available = 0 blocked = 1
time = 15 available = 0 blocked = 1
time = 16 available = 0 blocked = 1
time = 17 available = 0 blocked = 1
time = 18 available = 0 blocked = 1
time = 19 available = 0 blocked = 1
time = 20 available = 0 blocked = 0
time = 21 available = 0 blocked = 0
time = 22 available = 0 blocked = 0
time = 23 available = 0 blocked = 0
time = 24 available = 0 blocked = 0
time = 25 available = 0 blocked = 0
time = 26 available = 0 blocked = 0
time = 27 available = 0 blocked = 0
time = 28 available = 0 blocked = 0
time = 29 available = 0 blocked = 0
time = 30 available = 1 blocked = 0

Note that both processes computed for 10 milliseconds, then one process was blocked while the other utilized the scarce resource for 10 milliseconds, then the block process was able to use the resource, then the simulation completed.

The program and its input and output files are described more fully in the MOSS Deadlock Simulator User Guide.

© Copyright 2001, Prentice-Hall, Inc. This program is free software; it is distributed under the terms of the Gnu General Public License. See copying.txt, included with this distribution.

Please send suggestions, corrections, and comments to Ray Ontko (rayo@ontko.com).

Last updated: July 29, 2001