Share nothing

Share nothing at iNTERFACEWARE refers to the architectural choice to avoid sharing complex data structures and other resources such as sockets and Lua interpreters between threads with the use of mutexs to protect access to those resources.

It’s a special case of separation of concerns.

The challenge of using mutexs to protect shared resources is that it’s too easy for:

  • Deadlocks and race conditions to occur.

  • It’s often not that efficient.

Mainly it’s the first problem.

We ran into this with the release of Iguana 4 which was the first multi-threaded version of Iguana. Had huge problems with QA until we adopted this architecture idea thanks to Andrew Vajocski.

Instead what we do is have threads own particular data-structures and all communication between threads is performed using thread safe queues.

These days we are trending towards using threads for much narrower tasks where the thread owns the data given to it until it is done and then returns state to the main thread by posting back to the event loop.

See: https://en.wikipedia.org/wiki/Shared-nothing_architecture