English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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)
cashin@cs.uga.edu 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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners