From: mfeldman@seas.gwu.edu (Michael Feldman)
Subject: A Modest Exercise in Ada Program Portability
Date: 26 Nov 90 17:05:17 GMT [thread overview]
Message-ID: <2373@sparko.gwu.edu> (raw)
(NOTE the source code for this is following as a shar archive in a second
posting. Try it on your favorite compilers.)
A Modest Exercise in Ada Program Portability
Michael B. Feldman
Dept. of Electrical Engineering and Computer Science
The George Washington University
Washington, DC 20052
202-994-5253
mfeldman@seas.gwu.edu
Here is an exercise in Ada program portability. It is an implementation
of the famous Dining Philosophers problem, first posed by E. Dijkstra in
1971. Five philosophers, sitting around a circular table, spend their lives
thinking and eating Chinese food. Between each pair of philosphers lies
a single chopstick; a philosopher must capture both chopsticks to eat.
This problem has been a classic in operating systems and concurrent programming
circles. To avoid deadlock, someone must ensure that all philosophers don't
grab their left chopsticks simultaneously, refusing to budge until they
have grabbed their right sticks. In this implementation, a Head_Waiter task,
exported from package Room, takes care of this.
Head_Waiter uses a simple window manager package to allow philosophers to
display their states in separate windows on a vt100-compatible terminal.
This exercise has been successfully compiled and executed, without needing to
change any source code, under the following compilers:
IBM-PC Meridian AdaZ
IBM-PC AETech IntegrAda (same compiler as Janus Ada)
HP9000/300 Verdix VADS (HP/UX)
HP9000/800 Irvine Compiler Corporation ICC Ada (HP/UX)
Sun-3 Verdix VADS (SunOS 4.0)
Sun-3 TeleSoft Telegen2 (SunOS 4.0)
Sun-3 Meridian AdaVantage (SunOS 4.0)
The exercise can be run on line-oriented terminals such as IBM 3270's
using an alternative package body for Room, given here as roombody.cms.
Using this alternative, which does not use the vt100 or windows packages,
the exercise has been compiled and run on
IBM 4381 TeleSoft Telegen2 (VM/CMS)
Please try this on your favorite compiler and let me know if your
experience differs from mine.
Here is the list of files in the distribution:
-rwxr--r-- 1 mfeldman 703 Nov 25 17:14 BUILD.DINERS
-rw-r--r-- 1 mfeldman 377 Nov 25 16:49 chopbody.ada
-rw-r--r-- 1 mfeldman 297 Nov 25 16:50 chopspec.ada
-rw-r--r-- 1 mfeldman 451 Nov 25 17:07 diners.ada
-rw-r--r-- 1 mfeldman 261 Nov 17 10:22 io_libs.ada
-rw-r--r-- 1 mfeldman 1577 Nov 25 16:56 philbody.ada
-rw-r--r-- 1 mfeldman 645 Nov 25 16:52 philspec.ada
-rw-r--r-- 1 mfeldman 1587 Nov 25 17:01 ranbody.ada
-rw-r--r-- 1 mfeldman 413 Nov 25 17:00 ranspec.ada
-rw-r--r-- 1 mfeldman 3767 Nov 25 17:09 roombody.ada
-rw-r--r-- 1 mfeldman 2568 Nov 25 17:05 roombody.cms
-rw-r--r-- 1 mfeldman 566 Nov 25 16:57 roomspec.ada
-rw-r--r-- 1 mfeldman 633 Nov 17 12:07 vtbody.ada
-rw-r--r-- 1 mfeldman 595 Nov 17 10:23 vtspec.ada
-rw-r--r-- 1 mfeldman 6007 Nov 25 17:03 winbody.ada
-rw-r--r-- 1 mfeldman 2692 Nov 25 17:02 winspec.ada
next reply other threads:[~1990-11-26 17:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1990-11-26 17:05 Michael Feldman [this message]
1990-11-27 23:11 ` A Modest Exercise in Ada Program Portability mackey
1990-11-28 22:01 ` Vladimir G. Ivanovic
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox