All Manuals > LispWorks User Guide and Reference Manual > 15 Multiprocessing > 15.3 Atomicity and thread safety of the LispWorks implementation


15.3.5 Single-thread context arrays and hash-tables

Access to hash tables and non-simple arrays can be improved where they are known to be accessed in a single thread context. That is, only one thread at the same time accesses them.

The make-hash-table argument single-thread tells make-hash-table that the table is going to be used only in single thread context, and therefore does not need to be thread-safe. Such a table allows faster access.

Similarly the make-array argument single-thread creates an array that is single threaded. Currently, the main effect of single-thread is on the speed of vector-pop , vector-push . and vector-push-extend on non-simple vectors. These operations are much faster on "single threaded" vectors, typically more than twice as fast as "multi-threaded" vectors.

You can also make an array be "single-threaded" with set-array-single-thread-p.

The result of parallel access to a "single-threaded" vector is unpredictable.

LispWorks User Guide and Reference Manual - 21 Dec 2011