[Haskell-cafe] Timing out a pure evaluation of an expression I did not write myself
carter.schonwald at gmail.com
Tue Nov 27 00:13:38 UTC 2018
so one way to handle no allocation things playing nicely with the scheduler
is to compile haskell code with -fno-omit-yields
this will generate code which has scheduler yields even in loops which dont
On Mon, Nov 19, 2018 at 3:27 PM Viktor Dukhovni <ietf-dane at dukhovni.org>
> On Mon, Nov 19, 2018 at 11:26:17AM -0800, Ryan Reich wrote:
> > I suppose my question concerns the more general question of how to create
> > OS-managed threads in GHC. [...]
> > I would have expected there to
> > be a corresponding operation in GHC Haskell ("bound threads" seem not to
> > it, as they are still scheduled by the RTS) but it does not appear that
> > there is. Is this because of the need to keep the runtime unified?
> > Because it seems strange that we are prevented from operating truly
> > independent threads.
> I was just reading:
> which may offer some insight. The runtime needs to be able to
> provide a consistent memory model to threads. Just running something
> in an OS thread that's managed by the RTS could make that difficult,
> and it is not clear how that cooperates with garbage collection.
> But to your point, when adding threads to your example, I find that
> the infinite loop then runs concurrently in all the threads, and
> the timeout never happens. While:
> Replacing: let x = 0:x in last x
> with: let ! x = 0 + x in x
> does make timeout work, so it is not entirely obvious which pure
> computations can be timed out.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe