marekjm / viuavm

Parallel virtual machine designed to reliably run massively concurrent programs
https://viuavm.org/
GNU General Public License v3.0
71 stars 11 forks source link

Add timeouts to concurrency instructions #162

Closed marekjm closed 8 years ago

marekjm commented 8 years ago

Both "receive" and "join" should accept timeouts to prevent blocking the process indefinitely. Proposed syntax:

receive <register> <timeout>
join <register> <pid> <timeout>

Example:

receive 1 100ms  ; wait 100ms for a message
join 1 2 500ms   ; wait 500ms for a process to finish

If timeout is not be present, the instructions should block indefinitely. Timeouts are not guaranteed to be met, that is if a 500ms is set there is no guarantee that the process resumes running after exactly 500 milliseconds, and it may as well resume after 791 milliseconds due to nondeterminism of scheduling.

The VM guarantees that the process will not be put on hold if it awaits a timeout, i.e. that it will not be moved out of a scheduler and put on the central run queue.