JBACI Concurrency Simulator
User’s Guide
Moti Ben-Ari
July 18, 2004
Copyright (c) 2003-4 by Mordechai (Moti) Ben-Ari.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU
Free Documentation License, Version 1.2 or any later version published by the Free Software
Foundation; with Invariant Section “History,” no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the file fdl.txt included in this archive.
1 History
Over twenty years ago I developed a concurrency simulator for teaching concurrent program-
ming.
1
The simulator was based upon Niklaus Wirth’s Pascal-P interpreter and was subsequently
published in its entirety in my textbook Principles of Concurrent Programming (Prentice-Hall In-
ternational, 1982). Later, I made many modifications to the simulator, in particular, I developed an
Integrated Development Environment (IDE) based upon the user interface features in Turbo Pas-
cal. The software has now become too fragile to maintain and the character interface is unattractive
to students.
In the intervening years other educators have developed concurrency simulators of their own. The
most comprehensive and widely used is BACI, and I am flattered that it was named after me
(Ben-Ari Concurrency Interpreter). BACI (http://www.mines.edu/fs_home/tcamp/baci)
was developed at William and Mary College by Bill Bynum and Tracy Camp. While versions
of BACI exist for several systems, a graphical user interface (GUI) exists only for Unix systems.
Recently, David Strite of Penn State Harrisburg developed a new interpreter for the BACI virtual
code that includes a GUI. The interpreter (http://cs.hbg.psu.edu/~null/baci) is written in
Java and thus portable over all platforms.
JBACI is an integration of the original BACI compilers and Strite’s interpreter into an IDE that
contains an editor, together with extensions to the GUI to simplify its use by novices. In addition,
I have modified the compilers and interpreter to include commands for drawing graphics on a
canvas; this enables the student to write concurrent programs that are more fun than character-
based programs. JBACI also supports Linda-like synchronization primitives.
1
Cheap concurrent programming, Software—Practice and Experience 11(1981), 1261–1264.
3
2 Installation and execution
The student distribution is in two zip files called jbaciN.zip and jbaciNdocs.zip where N
is a version number. The distribution contains the executable jar file and several directories:
compilers contains the exe files of the Pascal and C compilers; docs contains documentation
files and examples contains sample programs in both Pascal and C. The zip file jbaciNsrc.zip
contains the directory baci with the Java source code, as well as the directory compilers which
contains files for rebuilding the compiler to accept the graphics commands.
You must have Java (SDK or JRE) Version 1.4 installed in order to run JBACI. Open the distri-
bution jbaciN.zip into the directory \jbaci. To run JBACI, execute java -jar jbaci.jar.
You can also create a shortcut to the jar file and use the icon supplied. There are also batch files:
run.bat which runs the above command, and runp.bat and runc.bat which allow a source file
name without the extension pm or cm to be included.
This document describes the operation of the JBACI IDE and the graphics extensions only. For
documentation of the dialects of Pascal and C that are accepted, as well as of the synchronization
primitives, refer to the original BACI documentation which for convenience is included in the
directory doc.
Most aspects of the GUI are defined in the file Config.java and can be easily changed. Certain
options can also be changed by editing the configuration file config.cfg, which is written out
when JBACI is closed. Note that the configuration includes in the location of the executable
compiler files and the default source directory, so they must be changed if you do not install to the
default directory or need to use Unix file syntax.
4
3 The Integrated Development Environment
The JBACI IDE is similar to other IDEs. When you run the program you are presented with a
menu structure, as well as with a toolbar of buttons for common operations. Selection of menu
entries and buttons using mouse clicks (or keyboard mnemonics and shortcuts) will be familiar to
a user of GUIs. In the following description, button names like Save will be used even when a
menu entry like File/Save also exists.
The IDE can be in one of two states: the edit state and the run state. Edit and Run change from
one state to the other. Buttons and menu entries are enabled and disabled accordingly. In both
states you can select File/Exit and Help/About .
3.1 Editing and compiling
Figure 1 shows the JBACI window when you are editing a source file. The edit buffer contains the
Figure 1: JBACI edit mode
file conway.pm and the only buttons enabled are those relevant to editing and compiling, and the
Run button to change to the run state. The file and editing operations in the edit state are familiar:
Open , New , Save , Save as , Copy , Cut, Paste, Find , Find again . Files are displayed in a text area
and the usual editing keys can be used.
5