News for hackers. Stuff that matters.
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by brlewis on Tuesday January 28, 2020 @02:37PM (#22173232)
Are you saying that concurrency issues can reliably be found via testing?
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by pmarreck on Tuesday January 28, 2020 @04:05PM (#22174011)
Well, they can't be deterministically found since process scheduling is not deterministic (notable exception: Haskell, I believe, has a way to do deterministic concurrent scheduling!), but I have definitely seen fails that only crop up when the suite is run concurrently, and it usually turns out that the code failing in those circumstances has made assumptions about application state that do not hold true in a concurrent context
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by btilly on Tuesday January 28, 2020 @04:38PM (#22174327)
OK, intermittently your test suite fails nondeterministically 0.01% of the time. Do you imagine that this will be sufficient to find which of the last thousand commits introduced the bug?

I would recommend using specialized tools for the task like Intel's Thread Inspector or Coverity's Helgrind.

Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by pmarreck on Tuesday January 28, 2020 @04:53PM (#22174467)
Or one could simply try very hard not to mutate any state that is available to another process and corral all such code that requires doing so (which most of the time ends up being only a small portion of the code; the rest can be designed functionally, just passing values in and back out with no other side-effects) into a thin I/O layer, which is (I believe) the Hexagonal Architecture and is explained quite well by Gary Bernhardt here: https://www.destroyallsoftware.com/talks/boundaries
Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by btilly on Tuesday January 28, 2020 @05:15PM (#22174698)
This is not an either or, it is an and.

The one being a good idea doesn't preclude the other from being a good idea as well. Do them both.

(And also avoid concurrency wherever you can. And of the available forms of concurrency, threads are one of the worse ones.)

Re:Threads Are a Bad Idea for Most Purposes (1995) [pdf] by pmarreck on Tuesday January 28, 2020 @06:28PM (#22175340)
Agree!