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


Concurrency/multithreading primitives

Author(s): Manuel Carro.

Version: 1.3#120 (1999/11/26, 12:5:17 MET)

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. Goals can 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. On the architectures for which we were not able to implement it yet, the original thread switches to the new stack set, executes the goal there, and returns after it has completed.

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.

Additionally, a small set of lock-related predicates 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.

Usage and interface (concurrency)

Documentation on exports (concurrency)

PREDICATE: eng_call/4:

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

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

PREDICATE: eng_call/3:

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

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

PREDICATE: eng_backtrack/2:

The predicate is of type implicit.

Usage: eng_backtrack(+GoalId,+ThreadCreation)

PREDICATE: eng_cut/1:

The predicate is of type implicit.

Usage: eng_cut(+GoalId)

PREDICATE: eng_release/1:

The predicate is of type implicit.

Usage: eng_release(+GoalId)

PREDICATE: eng_wait/1:

The predicate is of type implicit.

Usage: eng_wait(+GoalId)

PREDICATE: eng_kill/1:

The predicate is of type implicit.

Usage: eng_kill(+GoalId)

PREDICATE: eng_killothers/0:

The predicate is of type implicit.

Usage:

PREDICATE: eng_self/1:

The predicate is of type implicit.

Usage: eng_self(?(GoalId))

PREDICATE: eng_status/0:

The predicate is of type implicit.

Usage:

PREDICATE: lock_atom/1:

The predicate is of type implicit.

Usage: lock_atom(+Atom)

PREDICATE: unlock_atom/1:

The predicate is of type implicit.

Usage: unlock_atom(+Atom)

PREDICATE: atom_lock_state/2:

The predicate is of type implicit.

Usage 1: atom_lock_state(+Atom,+Value)

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

Known bugs and planned improvements (concurrency)


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