[MLton] threads in mlton
Thu, 27 Apr 2006 13:51:57 -0700 (PDT)
Can you please answer the following mlton query.
Short version of question: what is a design pattern
that guarantees 100% program correctness in
multi-threaded mlton programs that make use of thread
interruptions and cancellation?
Longer version of my question.
------ brief introduction, skip if irrelevant -------
I'm in the process of working on a large multi-year
project. So far I've used C++ but I hit a wall and
can't go on because I can't prove correctness in a
multiple platform environment (which includes
windows). Also it's difficult to move away from flat
data structures in C++.
I evaluated ocaml and haskell so far.
Ocaml is single threaded and I can't accept this
limitation because multiple threads refer to the same
data in my multithreaded program, and I need the
leverage of the additional CPUs.
As for haskell, concurrency is present and well
thought out but performance seems to be lagging. Now
I'm evaluating MLton.
---------- end of introduction ------------------
Things I like so far in mlton - emphasis is on
performance, unboxed primitive types, whole program
What about threads and cancellation/interruption in
I understand threads in mlton are implemented on top
of native threads.
I want some thread, say thr1 to be able to interrupt
or possibly cancel a descendant thread thr12 reliably
and quickly (akin to the pthread_cancel and
pthread_testcancel API calls in pthreads in the
context of pure C programs).
Let's say thr12 is blocked in a system call such as
read(), I'll be quite satisfied if the interruption
request from thr1 somehow manages to unblock thr12 and
causes it to throw an exception.
If the mlton program is linked to C code via the FFI,
then are there any constraints/precautions that need
to be observed during interruptions to ensure that the
program remains correct?
Is there a link to some program/project where correct
usage of interruptions/cancellations in mlton is
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around