ALEF(ID:1799/ale002)


Concurrent language for systems programming. C-like syntax, but a different type system. Exception handling, process management and synchronization primitives, both shared variable and message passing. Used in Plan 9 OS.

Limbo borrowed "Alef's abstract data types and channels"

Plan 9 documentation: "The system has its own programming languages: a dialect of C with simple inheritance, a simplified shell, and a CSP-like concurrent language, Alef"




People:
Structures:
Related languages
Newsqueak => ALEF   Based on
ALEF => LIMBO   Influence

References:
  • Condon, J. H.; Duff, T. S.; Jukl, M. F.; Kalmanek, C. R.; Locanthi, B. N.; Savicki, J. P.; Venutolo, J. H. "Rednet: a wireless ATM local area network using infrared links" Proceedings of the 1st annual International Conference on Mobile Computing and Networking 1995 Berkeley, California, United States pp151-159 view details Abstract: Rednet provides portable computers with an incxpensivc wireless network connection. It is designed to support seamless end-to-end communication using the Asynchronous Transfer Mode (ATM). Rednet uses a Iowpower infrared transceiver operating at 2-5 Mbps over a distance of 4 meters. The link layer protocol supports link sharing and transport of ATM cells over the link. Ceiling mounted base stalions in each room act as gateways between the infrared link and rhe wired network. Rednet is designed to support user mobility, so that users can roam from room to room and access network services in a location independent manner. The paper describes our infrared physical layer and link layer protocols, presents an ovcrview of protocols for dynamic address assignment and conncction management, and summarizes the status of the work. DOI Extract: Using ALEF
    We have implemented a small run-time system on the base station; the run-time system supports a concurrent programming language called Alef. For our purposes, Alef and its run-time environment provide a convenient way of writing the base station code to implement cell forwarding, connection management, and address assignment.
  • Flandrena, Bob "Alef Users' Guide," in Plan 9 Programmer's Manual: Volume Two, AT&T, Murray Hill, 1995. view details pdf Extract: Introduction
    Introduction
    The Alef programming language provides a convenient means for implementing concurrent programs. An Alef program looks like a C program: the syntactic structure is similar and the expression syntax is almost identical. But, despite the similarity of the language constructs, most Alef programs are structurally dissimilar and operate differently. This document describes some of Alef's capabilities, concentrating on concurrency features and language facilities not found in C. Alef provides language support for two process synchronization models: shared variables and message passing. The styles can be freely mixed and the choice often depends on the details of a programs design. Programs in the shared variable style rely on locks to synchronize access to shared data. The message passing model benefits from Alef primitives that control, send on, receive from, and multiplex message channels. This document focuses on the latter synchronization model, emphasizing its interaction with abstract data types and languagesupplied process management primitives.
    The Alef Language Reference Manual by Phil Winterbottom contains the formal definition of the language and is a necessary adjunct to this document. Also, we assume a basic understanding of parallel programming and a familiarity with ANSI C. Alef compilers are available on Plan 9 and on Silicon Graphics systems running IRIX. The implementations are almost identical; this document explicitly identifies the few places where system dependencies intrude. Although some examples are expressed in terms of the Plan 9 system model, it is usually easy to produce an equivalent Unix implementation. Throughout this paper, when reference is made to the C language, it is the ANSI C standard being compared rather than the Plan 9 dialect, which has some extensions. Extract: Overview
    Overview
    Alef consists of four parts: the Alef compiler, run-time support functions, header files, and libraries. The Alef compiler uses the ANSI C preprocessor, so the syntax and semantics of preprocessor directives are identical to those of C. However, because of differences in the declaration syntax, the Alef compiler does not accept C header files. The Alef system header files are stored in the alef subdirectory of the system header file directory. Alef and C programs implement incompatible stack models, so object modules from the two languages cannot be linked with each other and separate system libraries are needed for each compiler. The Alef system libraries are stored in the alef subdirectory of a system library directory. The Alef compiler and loader automatically search the proper directories for the system headers and libraries.
    All Alef programs begin by including header file alef.h. This file contains the declarations of the complex data types used by the Alef library functions and the prototypes of the functions themselves. Unlike C, the Alef run-time system continually interacts with a program during its execution. It provides functions that manage threads of execution and pass messages between them. Most of these functions implement language operators and are implicitly called by the compiler, but some, such as those that manipulate locks, can be invoked explicitly by the application program. An Alef program consists of one or more processes each of which contains one or more tasks. Processes are threads of execution that are preemptively scheduled by the system and may execute in parallel on a multi-processor. Tasks are controlled by the Alef run-time and execute cooperatively. The first task of each program is implicitly created when the program starts; it begins execution at the function named main. A process may create additional processes and tasks each of which begins execution at a specified function. Threads of execution often communicate on channels as illustrated in the following diagram:
    Process 1
    Main Task 2
    Process 2
    Task 1
    Process 3
    Task 1 Task 2 Task 3
    Channel
    This section provides an overview of Alefs process creation and communication primitives. Later sections then expand on this groundwork. Alef provides convenient mechanisms for starting threads of execution. The proc primitive creates a process that begins execution at the function supplied as its operand. For example, the statement:
    proc func(1, 2);
    starts a process at the function named func and passes it two arguments. The current process continues execution at the statement following the proc statement. An Alef channel is a mechanism for passing data between threads of execution. A channel is similar to a pipe, but unlike a pipe, which is typeless, a channel can only transport the single type specified in its declaration. The chan statement
    chan(int) c;
    declares a channel named c that transports integer values. Unlike variables, channels are not allocated when they are declared; instead, the alloc primitive must be used to allocate and initialize a channel:
    alloc c; /* allocate channel named 'c' */
    The send operator, <-=, transmits the result of the expression supplied as its right operand on the channel specified as its left operand:
    c <-= 1+1; /* send a 2 on channel 'c'' */
    The unary receive operator, <-, receives a message on the channel supplied as its operand. The received value may then be manipulated by other operators; for example, it can be assigned to a variable or used as an operand in an expression:
    int i;
    i = <-c; /* assign value received on c to i */
    func(<-c); /* pass value received on c to func */
    We can combine processes and channels to implement a simple message passing program:
    #include
    void
    receive(chan(byte*) c)
    {
    byte *s;
    s = <-c;
    print("%s\n", s);
    terminate(nil);
    }
    void
    main(void)
    {
    chan(byte*) c;
    alloc c;
    proc receive(c);
    c <-= "hello world";
    print("done\n");
    terminate(nil);
    }
    The main process declares and allocates a channel that transports a string address. It then creates a new process with the channel as its argument and sends the address of a string on the channel before printing a message and terminating. The new process begins execution in function receive, where it blocks on the channel until a message arrives and then prints the string before terminating. The order in which the print statements execute is indeterminate, depending on such external factors as system load, the number of processors, and system scheduling policy.
    This example illustrates a control structure common to Alef programs: an executive process starts other threads of execution and communicates with them via channels. Subsequent examples elaborate on this basic architecture to illustrate the capabilities of channels and the Alef process control model.
  • Winterbottom, P. "Alef Language Reference Manual," Plan 9 Manuals, Harcourt-Brace, 1995, ISBN o-03-017142- view details pdf Extract: Introduction
    Introduction
    Alef is a concurrent programming language designed for systems software. Excep- tion handling, process management, and synchronization primitives are implemented by the language. Programs can be written using both shared variable and message passing paradigms. Expressions use the same syntax as C, but the type system is substantially different. Alef supports object-oriented programming through static inheritance and information hiding. The language does not provide garbage collection, so programs are expected to manage their own memory. This manual provides a bare description of the syntax and semantics of the current implementation.
  • Cox, Russ "Overview of Plan 9 threads" view details Abstract: This page is a slice of the history of concurrent programming, focusing on one particular lineage of Hoare's language of communicating sequential processes (CSP) [1] [1a]. Concurrent programming in this style is interesting for reasons not of efficiency but of clarity. That is, it is a widespread mistake to think only of concurrent programming as a means to increase performance, e.g., to overlap disk I/O requests, to reduce latency by prefetching results to expected queries, or to take advantage of multiple processors. Such advantages are important but not relevant to this discussion. After all, they can be realized in other styles, such as asynchronous event-driven programming. Instead, we are interested in concurrent programming because it provides a natural abstraction that can make some programs much simpler.
    External link: Online copy Extract: Alef
    Alef

    Alef [7] [8] was a language designed by Phil Winterbottom to apply the Newsqueak ideas to a full-fledged systems programming language. Alef has two types of what we have been calling processes: procs and threads. The program is organized into one or more procs, which are shared-memory operating system processes that can be preemptively scheduled. Each proc contains one or more tasks, which are cooperatively scheduled coroutines. Note that each task is assigned to a particular proc: they do not migrate between procs.

    The main use of procs is to provide contexts that can block for I/O independently of the main tasks. (Plan 9 has no select call, and even on Unix you need multiple procs if you want to overlap computation with non-network I/O.) The Acme paper [12] has a nice brief discussion of procs and threads, as do the lecture notes about the Plan 9 window system, also mentioned below.

    Resources
    • ftp

      "