io-sim icon indicating copy to clipboard operation
io-sim copied to clipboard

Is it possible to integrate with dejafu?

Open fishtreesugar opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe. dejafu provided great facilities to test concurrent programs, tho dejafu using concurrency to provide IO classes which very similar to io-classes I believe. so Is it possible integrate with dejafu?

Describe the solution you'd like fork dejafu, a new package called io-sim-dejafu which build on top of io-classes

Describe alternatives you've considered is it possible to merge io-classes and concurrency?

Additional context @barrucadu WDYT?

Are you willing to implement it? Nah, just an idea 🤣

fishtreesugar avatar Nov 24 '22 09:11 fishtreesugar

If I understand you correctly you're proposing to have the same interface (io-classes with some possible changes) for both io-sim and dejafu. That would be definitely something good to see.

coot avatar Nov 24 '22 10:11 coot

I did consider using dejafu rather than writing io-sim in the first place. In particular, the bounded partial order reduction stuff is really cool.

However dejafu does not handle time, and for our applications time is critical. Because dejafu focuses on finding concurrency bugs and playing with the schedules, it is hard for it to have a notion of time. So for example it implements threadDelay as yield: it allows it to be rescheduled whenever. But that's no good for running simulations (as opposed to concurrency bug testing). For simulations we really need control over time: to simulate how long certain things take to run. This is what lets us do performance simulations.

Also, at the time I was initially considering dejafu, the type classes that provided the IO interfaces were all like the real IO libs but always slightly different. It looks like the situation has improved (looking at the latest concurrency lib), the differences appear to be fewer. But I felt that for using something like this in a real application that it was really important for programmers to be given the normal API: the same names with the same behaviour. So we've strived to make the io-classes match as close as possible. Indeed, in the lead up to the hackage release we're reviewing it and trying to eliminate remaining differences.

We do have an implementation of partial order reduction in io-sim, though I suspect it's not as elegant as the dejafu one. I suspect that it remains an open question how to do (B)POR well when a simulation also includes time. It's certainly not obvious to me.

dcoutts avatar Nov 25 '22 16:11 dcoutts