threads all around

We have just finished cleaning up the code for Mutex and Threads in oscit and now we have to decide what kind of locking policy we want to implement.

Do we want:

  1. Global locking of a processing tree ? (could be managed by Root class)
  2. Object locking ? (must be implemented by hand for each object class)

The current (buggy) implementation of oscit library uses the first paradigm, but it’s bad because we forbid parallelisme all together by locking too much. Moreover, most objects can perfectly handle concurrent requests. For example, an object that is bound to some hardware sensor could return the current temperature to many callers at the same time without problem.

If we lock less, we have to lock better and analyse where concurrency could blow up. Here is a short list of such places:

  • Find object, [object destroyed] trigger method (boom).
  • Start parsing script [method call: boom].
  • Start computing new PCA model [matrix input: boom].
  • Start command call [kill command]: some object could be left in an undefined state.

From these examples, we see that it shouldn’t be too difficult to write proper locking inside the objects themselves.

comments

  1. leave a comment