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
Threads vs. Fork
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-06-11 (17:09)
From: Jonathan T Bryant <jtbryant@v...>
Subject: Threads vs. Fork
The reason I asked about the threads is because I need the shared 
memeory, but I also need to use multiple processors.  Essentially, I'm 
writing a mini-database.  There's a shared data structure (a tree of 
some description) and a bunch of workers that perform lookups.  Every 
time there's an update to the tree, all of the workers need to be 
blocked until the update is completed (pretty standard stuff).  I can 
do this with fork if I can have shared memory, or I can do this with 
threads if I can use multiple processors.  Apparenly, neither option 
exists in OCaml.  Any suggestions on how to resolve this?  Does 
somebody have an extended Unix API that includes things like shared 
memory (shmget(), shmat(), etc...)

--Jonathan