Closed j-hui closed 3 years ago
For the previous example, one could cast blame on the programmer for arranging the priorities in such a way that confounds the performance of the program, but it does appear we may be able to do better. If b
and o
are truly independent (process order does not matter), and b
isn't also perform direct I/O, we might be able to avoid the latency due to b
by scheduling o
first.
I'm suggesting this because I had studied some prior work in "time warp" scheduling strategies, which may help us here. In particular, even though the semantics of the language say that processes are totally ordered, I believe we can justify an out-of-order implementation as long as the behavior is functionally equivalent. Just a thought.
This particular line of discussion hasn't really gone anywhere but the subject will be kept alive in #26 . Closing this, but will summarize that it represents a lazy output implementation (as opposed to a strict one).
Starting a thread here because I found this to be an interesting idea, and wanted to continue discussion asynchronously. This is a potential workaround/alternative to #8 .
In our meeting today, @koengit proposed handling I/O by spawning handler threads waiting for updates on the variable. My understanding of how this works would be as follows. Suppose we have a reference
l :: Ref LED
(perhaps obtained via some reference factory as @Rewbert proposed), and a writer threadw
which writes to the LED:A output listener thread
o
can handle this asynchronously:To handle instaneously assignments,
o
must run at a lower priority tow
; otherwise, the write tol
would be lost.The concern @sedwards-lab had is that if the priority of
o
is lower than a process with some expensive (but logically instantenously) computation, the wallclock time at which the handler is invoked may be unnecessarily delayed. So, for instance, consider a busy processb
whose priority in relation tow
ando
is:w
runs first, writing tor
and schedulingo
to run later. However, it does, the higher priorityb
executes first and stalls the execution ofo
, even ifb
is not at all related too
.Is this an accurate summary of the idea and the issues we think may arise from it?