HN2new | past | comments | ask | show | jobs | submitlogin

Omg the multi-threaded code examples are amazing. The active line is highlighted. Amazingly illuminating, so so good.


Question: do people find that sort of animation easier to grok than showing the interleaving visually, as I do at https://outerproduct.net/boring/2023-01-27_trans-locks.html#...? I prefer the latter, because it lets me see everything at once, but may switch to the former presentation style if other people prefer it.


Not that it would apply in this particular case, but my all-time favorite visualization of concurrency is this 2016 blog post called "Visualizing Concurrency in Go" [0]. So good.

[0] https://divan.dev/posts/go_concurrency_visualize/


Using time to represent time is a pretty helpful & intuitive strategy, very nicely on display in this example & the submission.

It does require some waiting around to see how things develop (versus the at-a-glance approach) but it really feels so very graspable & clear to me.


I think for anything more complicated than my examples, animations would be worse than your explicit interleavings.

That said, I don't really think interleavings are the best way to show weak memory effects either, since they give the impression that there is some global order that is the same in all threads. I'm not sure how to do a nice visualization of the reality though.

One idea: show the interleaving of atomic operations, and based on that, show what values each other read might see. Maybe even let the user change the interleaving by dragging stuff around, and show how it changes which other values can be observed.


FWIW coming from some random stranger on the internet, I like the animations. They're short enough that even though all the information isn't on the screen at once, I can remember/interpret the whole thing after it's run once. I could also imagine for demonstrating longer-running bugs (of more than just a few instructions) a user-controlled slider might be nice.


The answer is almost certainly yes. For both directions of the question. Few things have a single visualization that is the best.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: