2 ms·
Since you brought up Java here is some information that I could find about real-time garbage collection: * JamaicaVM's RTGC seems to be the closest to OCaml's
by edwintorok 12y ago
Since you brought up Java here is some information that I could find about real-time garbage collection:
* JamaicaVM's RTGC seems to be the closest to OCaml's GC, including the 'GC does more work when you allocate more',
although the benefit is that threads that don't allocate don't have to run the GC which doesn't apply to OCaml (don't know about Multicore OCaml):
https://www.aicas.com/cms/sites/default/files/Garbage.pdf https://www.aicas.com/cms/sites/default/files/Garbage.pdf
http://www.aicas.com/papers/jtres07_siebert.pdf http://www.aicas.com/papers/jtres07_siebert.pdf
It seems they provide a tool (static analysis?) to determine the worst-case allocation time for an application
* FijiVM's approach: http://janvitek.github.io/pubs/pldi10b.pdf http://janvitek.github.io/pubs/pldi10b.pdf
* on eliminating pauses during GC and compaction, although with quite invasive changes to the read barrier:
http://www.azulsystems.com/sites/default/files//images/wp_pgc_zing_v5.pdf http://www.azulsystems.com/sites/default/files//images/wp_pg...
http://www.azulsystems.com/sites/default/files/images/c4_paper_acm.pdf http://www.azulsystems.com/sites/default/files/images/c4_pap...
Once you have a GC with predictable behaviour you also need a standard library with predictable behaviour (which you have with Core_kernel, right?), and Javolution has an interesting approach, they annotate the public API of the library with time constraints and the compiler can give some warnings:
http://javolution.org/apidocs/javolution/lang/Realtime.html http://javolution.org/apidocs/javolution/lang/Realtime.html
http://javolution.org/apidocs/javolution/lang/Realtime.Limit.html http://javolution.org/apidocs/javolution/lang/Realtime.Limit...
http://javolution.org/ http://javolution.org/
I don't know how this works in practice, it'll probably just warn if you try to use a LINEAR time function when you claim your function should be CONSTANT time, or if you put things inside loops.
Not sure if it'd be worth trying out this approach for Core_kernel, but with OCaml annotations and ppx it might be possible to automatically infer and check:
* annotate stack depth of function (none, tail-recursive, linear-recursive, tree-recursive)
* annotate worst-case time complexity (guaranteed const (no loops, or just constant length ones, no recursion, no allocation); const (like guaranteed but with allocations); log (manual annotation); linear (recursion with decreasing list or loop); quadratic (one nested loop); unknown)
* I/O blocking behaviour (although you do this by hiding the blocking functions in Async.Std already)