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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
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...)