UNDER CONSTRUCTION!

Concurrent Programming for Operating Systems Classes Using SR

In undergraduate operating systems classes, students learn about concurrent process synchronization, including such things as shared data, race conditions, critical sections, mutual exclusion, the test-and-set hardware instruction, semaphores, and monitors. They also study interprocess communication, message passing, the rendezvous, and remote procedure calls. Solutions to classical problems, such as the dining philosophers, bounded buffer producers and consumers, and readers and writers, are presented using the above concepts. However, students need to write programs in a language that provides facilities for concurrent programming in order to appreciate fully the above concepts. These notes describe the SR language, which is free, runs on UNIX platforms, and supports the above constructs, and discusses its successful use as an environment for concurrent programming in an undergraduate operating systems course.

Table of Contents

Introduction
Processes
The SR Programming Language
Laboratory
Race Conditions and Process Synchronization
Laboratory
Semaphores
Laboratory
Monitors
Laboratory
Message Passing
Laboratory
Rendezvous
Laboratory

SR

Runs on

OS: UNIX, Linux

hardware:
workstations, PCs (uniprocessors), e.g., DEC Alpha (OSF/1), DEC MIPS (Ultrix), HP PA-RISC (HP-UX), IBM RS/6000 (AIX), Intel 386/486/Pentium (Linux, NetBSD), Silicon Graphics (Irix), Sun 4/Sparc (SunOS 4, Solaris 2), Sun 3 (SunOS 4)

shared-memory processors, e.g., Sequent Symmetry (Dynix 3.2), SGI, Sun

distributed memory, e.g., LAN cluster of workstations, IBM SP2, Intel Paragon (OSF/1)

Available for free via anonymous ftp

From the README file:
SR (Synchronizing Resources) is a language for writing concurrent programs. The main language constructs are resources and operations. Resources encapsulate processes and variables they share; operations provide the primary mechanism for process interaction. SR provides a novel integration of the mechanisms for invoking and servicing operations. Consequently, all of local and remote procedure call, rendezvous, message passing, dynamic process creation, multicast, and semaphores are supported. SR also supports shared global variables and operations.

SR is described in The SR Programming Language: Concurrency in Practice, by Gregory R. Andrews and Ronald A. Olsson (Benjamin/Cummings, 1993, ISBN 0-8053-0088-0).

An SR program runs on one or more networked machines of the same architecture. True multiprocessing is supported on Silicon Graphics, Intel Paragon, and Sequent Symmetry systems, and on Sun systems running Solaris 2.3. Multiprocessing is simulated on other platforms, which include SunOS 4.x, HP RISC, DEC Alpha and Ultrix, IBM AIX, and Linux. To allow additional hands-on experience, three preprocessors convert notations for CCRs, monitors, and CSP into SR code. The latest implementation of SR is version 2.3, released in October, 1994.

a reflector mailing list

Can be used for

in OS classes: semaphores, monitors, message passing, rendezvous

parallel processing: multiple threads in shared memory, master/worker on a cluster

History of my book

turning class handouts and notes into a book 1992-94

Operating Systems Programming: The SR Programming Language, Oxford University Press, 1995, 236 pages, ISBN 0-19-5095790, MSLP $25. A laboratory manual for operating systems and concurrent programming classes.

Features of the SR language

draws from C, Pascal, C++

data encapsulation (objects) in a `resource'

multiple processes (threads) in a `process'

counting semaphores, send/receive, Ada rendezvous, monitors (using a preprocessor)

Unfortunately not used in the ``real world'' (industry) that I know

XTANGO

Algorithm animation software that can be used with SR (and any other programming language)

Available for free via anonymous ftp

From the XTANGO_DESC file:
XTANGO is a general purpose algorithm animation system that supports programmers developing color, real-time, 2 & 1/2 dimensional, smooth animations of their own algorithms and programs. The focus of the system is on ease-of-use. XTANGO utilizes the path-transition animation paradigm which helps move animation design to an abstract, high level. Programmers need not be graphics experts to develop their own animations.

The basic process of animation consists of implementing the algorithm in C (another language can be used, but it must just produce a trace file which is read by a C program driver) and then deciding on the important events to be portrayed during the execution of the algorithm. These events then activate animation routines implemented in a separate file using the XTANGO animation package to create and manipulate objects (circles, squares, lines, and so on). Transitions on objects include movement, color change, resizing, and filling, as well as others. For example, the animation for binary search consists of a series of rectangles, each representing one of the elements being searched. A bouncing circle hits the current dividing element, which changes color. The ball then bounces to the next dividing element and continues to do this until the desired element has been found. To learn more about XTANGO, see the September 1990 issue of IEEE Computer which has an article about the TANGO system, an ancestor of XTANGO.

This distribution now also includes a front-end to XTango, kind of an animation interpreter. It reads a simple ascii command file or stdin and it displays the corresponding animation.

XTANGO is implemented on top of UNIX and the X11 Window System. It can be run on either color or black-and-white monitors.... The distribution includes source, documentation, and a directory of over 60 sample animations. Over 1500 sites have retrieved the system since it was set out for anonymous ftp in early 1991. To be put on a mailing list about the system, to suggest new algorithms to be animated, or to just ask questions about XTANGO, please direct correspondence to John Stasko.


This work is supported by the National Science Foundation, Division of Undergraduate Education, Course and Curriculum Development Program, DUE-9455307.

© 1995 Stephen J. Hartley

SJH
shartley@mcs.drexel.edu