mionic
mionic

Reputation: 41

boost::asio: Is there any name for the "strand" type of synchronization primitive?

The boost::asio library provides an interesting synchronization model using "strands" to serialize accesses to a resource that would normally require locks. This increases parallelism by essentially turning every lock operation into an enqueue.

Searching for "strands" only yields relevant results about asio, even though they seem like an exceptionally useful primitive for multithreading. Is there some other term for them that I'm missing?

Link to the asio strand documentation: http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/io_service__strand.html

Upvotes: 3

Views: 314

Answers (2)

Sam Miller
Sam Miller

Reputation: 24174

I've started doing a bit of programming in the iOS and Mac OS X domain, they have a similar concept to strands called a serial dispatch queue from Grand Central Dispatch. The tasks are executed in the order they are added to the queue, just like a strand. Similarly, the thread that executes the task is not defined, just as with asio when multiple threads invoke io_service::run().

Upvotes: 0

Tanner Sansbury
Tanner Sansbury

Reputation: 51941

I am not aware of an official name for the construct.

The proposal based on Boost.Asio (N2175 - Networking Library Proposal for TR2) documents the strand class, but does not reference any relevant material. Also, the Intel compiler documentation makes a few references to strand in its execution model, defining it as "any sequence of instructions without any parallel control structures."

Upvotes: 1

Related Questions