package coq
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=b1501d686c21836302191ae30f610cca57fb309214c126518ca009363ad2cd3c
doc/coq-core.stm/Stm/QueryTask/index.html
Module Stm.QueryTask
Source
Main description of a task. Elements are stored in the "master" process, and then converted into a request.
competence
stores the information about what kind of work a worker has completed / has available.
A worker_status is:
`Fresh
when a worker is born.
`Old of competence
: When a worker ends a job it can either die (and be replaced by a fresh new worker) or hang there as an`Old
worker. In such case some data can be carried by the`Old
constructor, typically used to implementrequest_of_task
.
This allows to implement both one-shot workers and "persistent" ones. E.g. par: is implement using workers that don't "reboot". Proof workers do reboot mainly because the vm has some C state that cannot be cleared, so you have a real memory leak if you don't reboot the worker.
Type of input and output data for workers.
The data must be marshallable as it send through the network using Marshal
.
Extra arguments of the task kind
Master API, it is run by the master, on a thread
request_of_task status t
takes the status
of the worker and a task t
and creates the corresponding Some request
to be sent to the worker or it is not valid anymore None
.
task_match status tid
Allows to discard tasks based on the worker status.
val use_response :
worker_status ->
task ->
response ->
[ `Stay of competence * task list | `End ]
use_response status t out
For a response out
to a task t
with status
we can choose to end the worker of to keep it alive with some data and immediately inject extra tasks in the queue.
For example, the proof worker runs a proof and finds an error, the response signals that, e.g.
ReponseError {state = 34; msg = "oops"}
When the manager uses such a response he can tell the worker to stay there and inject into the queue an extra task requesting state 33 (to implement efficient proof repair).
on_marshal_error err_msg tid
notifies of marshaling failure.
on_task_cancellation_or_expiration_or_slave_death tid
These functions are meant to parametrize the worker manager on the actions to be taken when things go wrong or are cancelled (you can kill a worker in CoqIDE, or using kill -9...)
E.g. master can decide to inhabit the (delegate) Future.t with a closure (to be run in master), i.e. make the document still checkable. This is what I do for marshaling errors.
forward_feedback fb
sends fb to all the workers.