Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Request: matrix_init function in Array
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-02-20 (10:24)
From: Michel Schinz <Michel.Schinz@e...>
Subject: [Caml-list] Re: feature priorities (multithreading) writes:


> Personally, I try to avoid threads because they usually make my
> programs less portable and sometimes more complex.


> If the threads in a program only run on one processor, then all you
> have is the overhead.

I don't agree here, some programs are inherently multi-threaded.

Take GUIs for example. Most GUI toolkits today are based on an event
loop, which waits for events and dispatches them to various
call-backs. This event loop is nothing more than a poor-man's
scheduler. It is a poor solution to the problem, though, because this
scheduler is not preemptive, and this means that your call-backs have
to execute quickly for the application to be responsive. It also means
that if your "threads" have a state, this state must be saved
explicitly between calls.

All applications which use Posix's "select" function are also
screaming for threads. When you use "select", you wait for one of
several events to happen, and when one happens you typically dispatch
to one event handling function. This is, again, nothing but an ad-hoc

John Reppy's book "Concurrent Programming in ML" contains several
examples of the usefulness of threads.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: