Thursday, April 28, 2022

Linda Meets Unix

Notes on "Linda Meets Unix",  Wm Leler, IEEE Computer, February 1990

This article is behind a paywall. I have a copy but cannot share it publicly. I'll provide some notes here and link to open access articles that fill in some of the details. I can dig in deeper if you leave a note in the comments.

Some people may know Wm from his PhD research on implementing constraints in the Bertrand programming language. (Published as "Constraint Programming Languages: Their Specification and Generation", Addison-Wesley, 1988) Wm later worked a couple miles down the street from me at Tektronix. More recently he worked on Flutter and Dart at Google. Now he's somewhere between Portland and the Puget Sound area. https://leler.com/wm/

When Wm authored this article he was at a Portland startup called Cogent Research. The product was a Transputer-based network of workstations. See more about the hardware. The article "Linda Meets Unix" describes the operating system, especially the use of "Kernel Linda" which is a pared-down implementation of Linda and tuple spaces. The aim of Kernel Linda is to be applicable to systems programming.

The article describes shared-memory multiprocessing, message-passing multiprocessing, and the Linda coordination model which is considered "generative" and can be used to approximate either shared-memory or message-passing, as well as a range of coordination patterns.

The operating system described in this article is QIX ("quicks").

To the user, QIX appears almost identical to Unix but, below the surface, it is considerably different. In terms of existing versions of Unix, QIX is most like Mach, except that Mach is based on a message-passing model, while QIX uses Kernel Linda. Like Mach, QIX has a small operating system kernel that is replicated on each processor.

Each process in QIX has a tuple space that provides the "global" environment for that process. That tuple space is the only means of communication between the process and the rest of the system. A QIX process can be lightweight with few entries in the environment tuple space. A Unix-compatible process has a more complete Unix environment in its tuple space.

All processes communicate by reading a "Services" entry from the tuple space. The value is another tuple space of all the external services available to that process. For example:

  • File: the file system
  • Pipe: Unix pipe service
  • TTY: serial ports
  • Execute: the execution service
  • Console: the system error console
  • PIX: the parallel interactive executive
  • Graphics: the graphics server
  • Window: terminal emulator windows
  • FTP: file transfer service
  • Tape: file backup
  • Null: the null device (like/dev/null)
A QIX process can communicate with services directly using Linda operations. Unix-compatible system calls are implemented using these Linda operations since those operations are the lowest-level means for a process to communicate with the rest of the system. One advantage of the indirection and generative nature of Linda is that services can be customized, replicated, and distributed without affecting the behavior of the communication.

Tuple spaces form a name-space of sorts on a per-process basis. This has some similarities with the Plan 9 OS "everything is a customizable file system" philosophy.

The following code creates a new process from a code block on disk and communicates with that process using an environment tuple space that consists of just two keys ("x" and "y"). The result of the process is brought back into the original process via a third key ("z") the tuple space. The original process waits for the result via the Linda blocking operation called "in".

// the new environment dictionary
Val new_env = createdict();

// the value of x is the integer 5
new_env.out("x", (Val) 5);

// the value of y is the integer 20
new_env.out("y", (Val) 20);

// read the executable file from disk
Val proc = createblockfromfile("foo");

// create a new process
int pid = new_env.execute(proc);

// collect results
Val result;

// read the value of z
new_env.in("z", result);
printf("z = %d", (int) result);

 The code for corresponding communication in the new process:

void main()
{
  // access my environment
  Val env = environment(); 
  Val x, y;
  // read the value of x and y
  env.rd("x", x);
  env.rd("y", y); 
  int z = (int) x + (int) y;
  // set the value of z
  env.out("z", (Val) z);
}

The article goes on to illustrate the use of Linda to implement flow control, dynamic load balancing, and server farms. One of the most interesting aspects of QIX is PIX, a parallel, interactive Postscript interpreter implementing the Sun NeWS window system

The original implementation of NeWS implements "green threads" and coordination within the Unix process applies a combination of shared memory with mutexes and message passing. PIX is a true parallel program with coordination using Linda operations. 

QIX provides a big lesson for today by illustrating how an innovative substrate can be used to provide an all new operating environment while maintaining a significant level of compatibility with the current world.

Wednesday, April 27, 2022

Eva: An Event Driven Framework For Building User Interfaces In Smalltalk

 Notes on "Eva: An Event Driven Framework For Building User Interfaces In Smalltalk", Jeff McAffer and Dave Thomas, November, 1987.

This is an interesting assessment of Smalltalk user interfaces in the mid-1980s. Beyond that assessment is the design for a new user interface framework for Smalltalk. The framework is compared to Sun's NeWS and suggests Eva is better than NeWS in some ways.

The main similarities of Eva and NeWS are:

  1. Event-based
  2. Multiple active views
  3. Lightweight processes
  4. Portable interpretive language
  5. Reactive interaction with distributed applications
The main differences attributed to Smalltalk are:
  1. Smalltalk development environment
  2. Richer class library
  3. Better runtime garbage collector
  4. Better runtime performance
The advantage of these are to support more complex application user interfaces, for example CAD applications.

A prototype of Eva was developed in their Smalltalk/v system which ran in 600k. That Smalltalk was not truly multi-processing. The ultimate target for Eva was their Actra implementation of Smalltalk with "actors" providing true multi-processing. Subsequent work on their SmallScript system implemented the Postscript imaging model.