💾 Archived View for schinkel.bevuta.com › strand › strand.gmi captured on 2024-08-25 at 00:02:47. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-11-04)
-=-=-=-=-=-=-
,---.| | `---.|--- ,---.,---.,---.,---| || | ,---|| || | `---'`---'` `---^` '`---'
"Strand" is an open-source implementation of the identically named
parallel Prolog dialect as described in the book "Strand: New
Concepts for Parallel Programming" by Ian Foster and Stephen Taylor.
Strand represents a very elegant and concise notation for expressing
concurrent and distributed algorithms using only a small number of
fundamental language constructs and a very simple execution model.
This implementation of Strand is written in Forth and runs on Linux
x86-64/ARM, Mac OS X x86-64 and OpenBSD amd64 systems, has no
dependencies and is entirely self-contained. Operating system
facilities are invoked directly via system calls, no C runtime
library is required. The Forth system is provided with source
code and is able to recompile itself into an ELF or Mach-O binary.
"Strand" is a trademark of Artificial Intelligence Ltd., which
once offered a commercial implementation.
Version: 9
Release History:
Version 9:
* Language changes:
- "put_bytes/3" has been removed, "put_bytes/4" has been renamed
to "$put_bytes/4".
- Added "char_list_to_bytes/2", "bytes_to_char_list/3",
"integer_to_list/4", "string_search/3", "string_search/4",
"copy_bytes/4", "pack/2", "unpack/2" and "getcwd/1".
- Added the special forms "foreach/3" and "when/2".
* VM changes:
- In the underlying Forth interpreter, more words have beenre
implemented in assembly language which speeds up the VM considerably.
- Fixed a serious memory-leak in "merger/2".
- Forth words invoked via "$foreign_call" must follow the
"<name>/<arity>" convention.
- In debug-mode messages sent via "send/2" and "send/3" are shown
in the log file.
- Fully dereferencing complex data structures handles lists of
arbitrary length by using a tail-recursive traversal algorithm.
* Library changes:
- "proc" module: the "close/1" I/O-descriptor for "execute" now
actually works.
- "fmt" module: byte block objects are allowed as arguments for
the "~s" directive.
- "list" module: added "join/4" and "find/3".
- "map" module: fixed an ordering bug in "replace/N".
- "sys" module: completion of full distributing of topology
information through a process network is now ensured before
commencing multi-node applications.
* Compiler changes:
- Process-definitions that contain only a single clause and have
only variables in the definition-head generate more efficient
code.
- Complex compound literals are compiled in a more space-efficient
way so that the literal is only created once during compile time.
* Tool changes:
- "strand start" didn't create the vm-file from scratch, but only
appended to an existing one.
- The "plot" utility is now a subcommand of "strand".
Version 8:
* AArch64/Linux is now supported.
* Language changes:
- Added new primitives "delete_file/2", "kill/3", "bytes_to_list/3",
"list_to_bytes/2", "make_bytes/2", "make_bytes/3", "put_bytes/3",
"put_bytes/4", "get_bytes/5", "write_bytes/3", "write_bytes/5",
"timer/2", "timer/3", "utf_encode/3", "current_node/1",
"current_node/2" and "current_module/1".
- Added the guard "bytes/1".
- Byte block objects have a literal and printable representation
("#<hex...>").
- "read_bytes" reads byte-block objects now, not byte lists.
Use "io:read_byte_stream" to convert the block into a byte stream.
- In quoted string and character list literals the escape sequence
"\e" (ASCII 27) is allowed.
* VM changes:
- Re-registration of peers for the topology protocol doesn't leak
memory anymore.
- Distributed idleness detection has been removed, it was too complex
and unreliable to be supported for all situations and is better
handled in a user- and application-specific manner.
- Environment accessors produce slightly shorter and more efficient
code.
- A failure of delivery of a message via tunnel doesn't terminate
the tunnel node anymore, an error message is printed to stderr
instead and the message is dropped.
- Some I/O system calls produced fatal errors on failure instead of
properly terminating when running inside a task.
- "merger/2" leaked processes which prevented tasks using this
primitive to terminate properly.
- "get_global/2" printed an invalid value when the global could not
be found.
- Heap-statistic logging can be enabled separately from other
statistics by using the "-hs" command line option.
- Variable dereferencing has been slightly optimized, variable-chains
are partially "collapsed" to reduce subsequent derefencing of the
same chain.
- Fixed bugs in ARM 32-bit Forth kernel (implementation of `u<`,
`errno`).
* Compiler changes:
- Added "meta" and "machine" declarations.
- Every compiled module exposes the process definition '$META'/1
allowing adding arbitrary meta-data to modules.
- A module that contains no "exports" declaration exports all defined
processes by default.
* Library changes:
- The "ns" module has been dropped.
- In the "map" module, AVL nodes now cache their subtree height which
speeds up access by an order of a magnitude.
* Tool changes:
- "strandc" has been integrated into "strand", use "strand -c ..." to
compile a source file into a binary module.
- Multi-node applications has been completely overhauled. Instead of
starting a number of nodes for every application, the concept of
continuously running "node pools" is used, in which application
modules are injected to execute in a node network. This removes
the possibility of race-conditions when setting up a node pool
during application start. Pools and tunnels connecting them are
now started manually and continue executing until nodes abort due
to fatal errors. Topologies are assigned on application startuo
which makes node pools somewhat more resilient should single nodes
terminate unexpectedly.
Version 7:
* PowerPC64le/Linux is now supported (Thanks to Cameron Kaiser
for various useful suggestions).
* VM changes:
- Task failure returns a somewhat more meaningful error string
than a simple tag designating the type of error.
- Error conditions during the internal use of poll(2) are caught
and trigger an error message.
- Receiving of messages didn't lock the port properly before
testing for incoming data.
* Documentation changes:
- The protocol description has been moved from the manual
the the "HACKING" document.
* Tool changes:
- Several bugfixes in the "strand" script.
* Library changes:
- The "avl" module has been renamed to "map".
Version 6:
* Language changes:
- Removed "randomize/1" primitive and "random/1" expression
operator (See new "rnd" module for an alternative interface
to random and pseudo-random numbers).
- Added "writeln/2".
* Compiler changes:
- Second-level clause-indexing has been added for tuples
and list heads, which reduces matching overhead in large
process definitions.
* Tool changes:
- The "strand" tool has been rewritten in sh(1) and is now
included in the base distribution.
- "strand"/"strandc": the symlink resolution wasn't
correctly handled for obtaining the home-location of the
VM and libraries.
- "strand": the handling of "start", "stop", "premake" and
"postmake" project properties properly expands the values
before invoking them as shell commands.
- "plot" has been reimplemented as a sh(1) script.
- "strand" now supports distributed projects with more than 2
machines.
* Library changes:
- Topologies exchanged between "ns" nodes on different machines
are now ensured to be fully instantiated as peer-resolution
on a remote ns node with a topology data structure that
contained remote variable references could result in a
deadlock.
- "ns" nodes now include tunnels in the total node count to
ensure all tunnel nodes are properly running before starting
idle detection and other communication.
- Added library for pseudo random numbers and access to
system random source ("rnd" module).
- idleness-detection can now be disabled by passing an
option to the "ns" module.
Version 5:
* Language changes:
- Added support for "ports", a practical stream abstraction,
with new primitives "open_port/2", "send/2", "send/3" and
new guard "port/1".
- Added "get_global/3".
- The peer name "all" can be used to perform a broadcast
by invoking a process on all peers in a collection of
nodes.
- "command_line/1" now only returns the arguments (without
the executable name) and ignores previous arguments if
"--" is given.
- Added the guard "idle" for triggering processes when
a node or a network of nodes becomes idle.
* VM changes:
- Fixed a nasty bug in module-unmarshaling code that would
result in message ports not being properly cleared after
receiving a message containing an already loaded module.
- Ordering of modules using one of the comparison guards
like "@>/2" is now stable.
- Implemented idleness detection for single or multiple
nodes.
- Small integers are encoded in bytecode in a more efficient
manner which reduces the size of compiled modules
considerably.
- Also, small integers are encoded in the internal
marshalling format more efficiently.
* Protocol changes:
- The termination protocol has been extended to a two-stage
process to make it more reliable.
* Compiler changes:
- Fixed bug that caused deadlock when an incomplete term was
parsed.
- the performance of clause-indexing for atomic arguments
in the first argument position of a process definition
has been improved.
* Library changes:
- Moved set operations "union/3", "intersection/3" and
"difference/3" from "list" into new "set" module.
- "fmt" module: added "~x" output format (hex integer).
- "list" module: added "pad_left/4", "pad_right/4" and
"make/*".
- Added "strand" module for reading Strand terms.
- Fixed some serious bugs in the "avl" module.
* Documentation changes:
- Added section to MANUAL describing the VM execution model.
- Extended documentation of node-communication protcols.
* Tool changes:
- "strand": added "keep-remote-files" option to retain
log- and output-files of started remote nodes.
Version 4:
* Language changes:
- The "time/0" expression operator has been replaced with
a primitive process ("time/1").
- The "pledge" and "unveil" primitive processes take a third
argument now to indicate completion.
- Added the "set_user_id/2", "module_exports/2" and "deref/2"
primitive processes.
- Added expression operators "max/2" and "min/2".
* VM changes:
- When listening on multiple files, registered listeners
where not always correctly unregistered once input was
available.
- When idle, the time waited between attempts to lock a port
or receive a message progressively increases to reduce
CPU cycles for long-running nodes and can be tuned
using the "-r" command line option.
* Tool changes:
- "strandc":
- Circular assignments detected when compiling a file
show offending variable instead of producing an infinite
error message.
- Redefinition of internal or primitive processes signals
a compiler error now.
- Non-anonymous singleton variables in process definitions
produce a warning, which greatly reduces inadvertedly
caused deadlocks by wrongly named variables.
* Library changes:
- "io:read_byte_stream/2" and "io:read_char_stream/2" are
now non-blocking.
- added "io:split_lines/2".
- added "list:scan/4", "list:take/4", "list:drop/3" and
"list:cut/5".
- "fmt" module: fixed a bug in handling of "~?" with an
initial list argument.
Version 3:
* Language changes:
- Added "run/3" to invoke tasks in the current module.
- Dropped the guard "file_exists/1" and added the primitive
process "file_status/2" to obtain information about the
type and existance of a file.
- "open_file/3", "shell/2", "file_size/2", "chdir/1",
"file_modification_time/2" and "getenv/2" accept strings or
character lists as their first argument.
- Added a third argument to "put_global" to signal when
the store is complete.
- The numerical comparison guards ">/2", "</2", ">=/2" and
"=</2" accept now any numerical expression as arguments.
- Added numerical comparison guards "=:=/2" and "\=:=/2".
- On OpenBSD, "pledge/2" and "unveil/2" can be used to
restrict access to operating-system facilities and the
file-system.
* VM changes:
- Added the "-v" option to show the VM version.
- When the message-file designated by the "-f" option could
not be opened, a proper error is shown instead of crashing.
- File reading/writing behaves properly in the presence of
signals triggered by child-process termination.
- Increased the port size to 32k.
- When comparing values for equality, identical remotes
compare equal without requiring message traffic.
* Compiler changes:
- Error handling has been overhauled and provides somewhat
improved error messages.
- Slightly reorganized compiler toplevel module and renamed
it to "stc".
* Tool changes:
- "strand":
- The "nodes" property holds now the total number of
nodes, including any remote nodes.
- Several bugfixes with regard to start + cleanup of
remote processes.
- passes "-i <strandhome>/lib/<OSNAME>" to invocations of
the VM.
- "strandc":
- allows compiling multiple files in one invocation.
- correctly searches location of VM and added "-home"
option to show it.
* Library changes:
- Added the "~?" (recursive format) format specifier to
"fmt:format/*".
- Repaired handling of "~s" with "fmt:format_chars/*".
- Fixed several bugs in the "proc" module related to the
invocation of external processes.
- "proc:execute/4": changed order of arguments and added
PID to results.
* Documentation changes:
- Documented internal primitive processes in HACKING.
Version 2:
* Language changes:
- Double-quoted strings can now be used as a more
convenient syntax for lists of character codes.
- "command_line/1" now includes the program name as the
first element in the returned list.
- Added primitive processes "get_global/2", "put_global/2"
and "chdir/1".
* VM changes:
- On x86_64, the Forth engine is now significantly faster
due to inlining of the inner interpreter in the assembly
language kernel.
- Signal handling has been implemented for Darwin, and
a bug in the Mach-O binary generation been fixed. Also,
the interface to the "pipe(2)" system call is working
now (Many thanks to Jorge Acereda Maciá!)
* Library changes:
- Added "list:append/2", "list:split/4", "list:trim/3",
"list:trim_left/3" and "list:trim_right/3".
- "proc:execute/3" accidentally left file-descriptors
open in the parent process.
- "proc:execute/3" now properly searches PATH for locating
the program invoked in the subprocess.
- Added "proc:capture/3".
- Added the "~s" (char-list) format specifier to
"fmt:format/*"
- "io:read_byte_stream/2" and "io:read_char_stream/2"
do not close the input stream at end of input.
* Tool changes:
- Fixed incorrect passing of debug options to remote
process-invocations when using the "strand" tool in
strand-utils.
Version 1: Initial release