Diagram for Parallel processes

What type of diagram can I use to model parallel processes interacting with a shared set of resources, along with the state of those resources at each point in time? My motivation is I have a bug that appears to be a race condition where a cache is cleared, updated, then set to the outdated value it had before clearing. The only thing is the timing on the logs indicates everything should have worked as expected. I'm trying to visualize what is going on to see what I might be missing, or potential problem areas that should be looked at. As an example, here is the flow that I would expect for the problem if it were a race condition breaking things. DB has Old Value Cache has Old Value Cache cleared Process A reads Old Value from DB DB updated to New Value Process B reads New Value from DB Process B saves New Value to Cache Process A saves Old Value to Cache Process C reads Old Value from Cache My first thought was to use a sequence diagram but it doesn't allow tracking state. For instance, what is the value in the DB and Cache at any given point? Also, PlantUML and Mermaid implementations allow overlapping activations, but only if one activation is completed contained by another. They can't have partial overlap which the timing I'm seeing has. My best idea is parallel timelines. That way I can have a line for the Cache State, DB State, and each process interacting with them.

Mar 13, 2025 - 15:43
 0
Diagram for Parallel processes

What type of diagram can I use to model parallel processes interacting with a shared set of resources, along with the state of those resources at each point in time?

My motivation is I have a bug that appears to be a race condition where a cache is cleared, updated, then set to the outdated value it had before clearing. The only thing is the timing on the logs indicates everything should have worked as expected. I'm trying to visualize what is going on to see what I might be missing, or potential problem areas that should be looked at.

As an example, here is the flow that I would expect for the problem if it were a race condition breaking things.

  1. DB has Old Value
  2. Cache has Old Value
  3. Cache cleared
  4. Process A reads Old Value from DB
  5. DB updated to New Value
  6. Process B reads New Value from DB
  7. Process B saves New Value to Cache
  8. Process A saves Old Value to Cache
  9. Process C reads Old Value from Cache

My first thought was to use a sequence diagram but it doesn't allow tracking state. For instance, what is the value in the DB and Cache at any given point? Also, PlantUML and Mermaid implementations allow overlapping activations, but only if one activation is completed contained by another. They can't have partial overlap which the timing I'm seeing has.

My best idea is parallel timelines. That way I can have a line for the Cache State, DB State, and each process interacting with them.