-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KILL-TASKS and nested tasks #32
Comments
Interesting, all tests pass after replacing in kill.lisp
with
For each lisp implementation I would have to check that I realize your example is just for demonstration purposes, but using |
I do not think pmapcar inside a worker wastes a thread, your nice work stealing logic seems to prevent the problem. |
Ha, you're right: there it is in kernel-util.lisp: |
kill-tasks only kills active tasks, is there a good way to cancel queued tasks? For example, if a pmap produces more tasks than there are available workers, kill-tasks is not sufficient to abort the pmap cleanly. Is there a way to do anything better than
|
It's come up before, and I have a couple private branches which have The second method flushes the internal lockless queues (called spin queues in lparallel), which also lets us write |
Thanks for the explanation. The second method depends a lot on internals of lparallel, so I will use the first one for now.
I am aware of 3 use cases where such an extension point would be useful: the one discussed above, passing values of special variables from a caller of pmap to tasks, and pmap/wait (we discussed it in issue 18). |
Yes, successively wrapping lambdas around tasks is the natural way to do this. There is already one such lambda wrapping in lparallel, namely the rebinding of the handlers established with |
When KILL-TASKS is used with nested pmap calls, it sometimes kills unrelated tasks. It is not unexpected, because KILL-TASKS destroys threads, but in some cases it is inconvenient.
What are the reasons for using DESTROY-THREAD in KILL-TASKS? It probably would be possible to use INTERRUPT-THREAD to abort a task without killing its thread.
Here is an example that show the problem:
The following code does not signal any errors
but if it is wrapped with another pmapcar, it signals TASK-KILLED-ERROR
The text was updated successfully, but these errors were encountered: