Threads as braided strings in abstract space (1)

In the past I was trying to find a way to depict running and blocked threads graphically perhaps as strings in some abstract n-dimensional space (manifold), preferably 3-dimensional manifold. If you have never encountered manifolds here is their informal definition:

3-dimensional manifold is a 3-dimensional space that looks like a 3-dimensional Euclidean space locally (in small regions) so we can explore the manifold space like we do in our 3-dimensional spatial world

Example: the surface of a sphere where small regions look like 2-dimensional rectangles (compare Earth surface and a football field on it)

My infrequent attempts were not satisfactory and only recently after reading the book Towards a Philosophy of Real Mathematics written by David Corfield I’ve found that it might be good to represent threads as n-string braids.

 Buy from Amazon

Braids are strings that raise monotonically without reversing their direction. It sounds like an arrow of time during computation. Braid theory is related to knot theory and might be at a good metaphor to explore. To picture thread strings we need to find abstract coordinates for our space. One of axes is obviously time axis and the other is a program counter axis (for example, the value of EIP register). 

Here is a thread running through code sequentially without jumps or loops, acquiring and releasing a spinlock on its way:


Here is another thread looping while trying to acquire a spinlock and finally taking ownership of it and then running through the same code sequentially:

Suppose that both threads contend for the same spinlock and there is a 3rd thread doing the same. Let’s overlay them on one single diagram:

To have a perspective we can add a 3rd dimension - thread number or ID (TID):

Instead of TID axis we can use data address axis (the data address accessed by the current instruction) or have it as a 4th dimension. If we want to differentiate between read and write addresses we can add 5th axis. We will try to do it in the next part.

- Dmitry Vostokov @ -

4 Responses to “Threads as braided strings in abstract space (1)”

  1. Marc Sherman Says:

    Very cool.


  2. Crash Dump Analysis » Blog Archive » Physics of Debugging (Part 1) Says:

    […] on threads in abstract space I tried today to apply canonical formalism in classical mechanics. Thread kinematics involved 2 […]

  3. Crash Dump Analysis » Blog Archive » Dictionary of Debugging: Thread Says:

    […] discreet time arrow and IP is a memory space (Instruction Pointer). Threads can also be viewed as braided strings in an abstract computational space. Another computer science definition centers on considering each individual thread as a Turing […]

  4. Crash Dump Analysis » Blog Archive » Extending Multithreading to Multibraiding (Adjoint Threading) Says:

    […] considered computational threads as braided strings and after discerning several software trace analysis patterns (just the beginning) we can […]

Leave a Reply

You must be logged in to post a comment.