Go to the first, previous, next, last section, table of contents.


Low-level concurrency/multithreading primitives

Author(s): Manuel Carro.

Version: 1.5#118 (2000/4/19, 18:13:43 CEST)

Version of last change: 1.3#118 (1999/11/25, 19:28:6 MET)

This module provides basic mechanisms for using concurrency and implementing multi-goal applications. It provides a means for arbitrary goals to be specified to be run in a separate stack set; in that case, they are assigned a goal identifier with which further accesses (e.g., asking for more solutions) to the goal can be made. Additionally, in some architectures, these goals can be assigned an O.S. thread, separate from the one which made the initial call, thus providing concurrency and, in multiprocessors, parallelism capabilities.

As for now, the memory space of the threads (c.f., stack sets) is separate in the sense that goals are copied to the new stack set, and bindings of variables are not seen among stack sets which allows forward and backward execution to proceed independently in each stack set, at the cost of the initial goal copy. However, the program space (including, specially, the concurrent predicates) are shared and seen by all the goals and threads, and should be used as the primary means of communication and synchronization. Higer level libraries can be built using these basic blocks.

Additionally, a small set of lock primitives are provided. Locks are associated with atom names. Whereas the concurrent database facilities are enough to implement locks, semaphores, messages, etc., the predicates implementing atom-based locks are faster than the ones accessing the concurrent database (but they are less powerful).

Usage and interface (concurrency)

Documentation on exports (concurrency)

PREDICATE: eng_call/4:

Meta-predicate with arguments: eng_call(goal,?,?,?).

Usage 1: eng_call(+Goal,+EngineCreation,+ThreadCreation,-(GoalId))

Usage 2: eng_call(Goal,EngineCreation,ThreadCreation,GoalId)

PREDICATE: eng_call/3:

Meta-predicate with arguments: eng_call(goal,?,?).

Usage 1: eng_call(+Goal,+EngineCreation,+ThreadCreation)

Usage 2: eng_call(Goal,EngineCreation,ThreadCreation)

PREDICATE: eng_backtrack/2:

Usage 1: eng_backtrack(+GoalId,+ThreadCreation)

Usage 2: eng_backtrack(GoalId,ThreadCreation)

PREDICATE: eng_cut/1:

Usage 1: eng_cut(+GoalId)

Usage 2: eng_cut(GoalId)

PREDICATE: eng_release/1:

Usage 1: eng_release(+GoalId)

Usage 2: eng_release(GoalId)

PREDICATE: eng_wait/1:

Usage 1: eng_wait(+GoalId)

Usage 2: eng_wait(GoalId)

PREDICATE: eng_kill/1:

Usage 1: eng_kill(+GoalId)

Usage 2: eng_kill(GoalId)

PREDICATE: eng_killothers/0:

Usage 1:

Usage 2:

PREDICATE: eng_self/1:

Usage 1: eng_self(?(GoalId))

Usage 2: eng_self(GoalId)

PREDICATE: eng_status/0:

Usage 1:

Usage 2:

PREDICATE: eng_status1/1:

No further documentation available for this predicate.

PREDICATE: lock_atom/1:

Usage 1: lock_atom(+Atom)

Usage 2: lock_atom(Atom)

PREDICATE: unlock_atom/1:

Usage 1: unlock_atom(+Atom)

Usage 2: unlock_atom(Atom)

PREDICATE: atom_lock_state/2:

Usage 1: atom_lock_state(+Atom,+Value)

Usage 2: atom_lock_state(+Atom,-(Value))

Usage 3: atom_lock_state(Atom,Value)

Usage 4: atom_lock_state(Atom,Value)

Known bugs and planned improvements (concurrency)


Go to the first, previous, next, last section, table of contents.