From: David Portabella on 10 Aug 2010 14:28 On Jul 18, 6:20 am, "Max " <nikitchmPub...(a)gmail.com> wrote: > Hi, > > I'm writing a code which would allow multithreading on a cluster.For that I start several instances of Matlab: one of them is the "main" one, which put a request for jobs into a message file, "JobSubmit",while the rest of the instances (threads) are supposed to wait for until the jobs are posted. The number of jobs is supposed to be larger than the number of threads, and the the threads should be able to leave a message of what job number they are currently running, so that other thread would not take them. > > Here comes the problem. I need to be able to lock the access to the file, while one of the threads is reading it and is leaving its marks, to exclude the possibility of two threads accessing the same file at once and thus confusing/corrupting the operation. I'm wondering if there is a way to implement it Matlab? Any advises on how it could be realized otherwise are much appreciated! > > Thank you, > Max See a workaround here: http://stackoverflow.com/questions/3451343/automically-writing-a-file-in-matlab/3452143#3452143 Regards, David
From: Walter Roberson on 10 Aug 2010 15:00 David Portabella wrote: > On Jul 18, 6:20 am, "Max " <nikitchmPub...(a)gmail.com> wrote: >> I'm writing a code which would allow multithreading on a cluster. > See a workaround here: > http://stackoverflow.com/questions/3451343/automically-writing-a-file-in-matlab/3452143#3452143 No, as I showed in detail before, Matlab's movefile() *cannot* be atomic on Unix, and that the reality is that rename() cannot be guaranteed to be atomic on any of the common shared file systems such as would be in use for the cluster the original poster asked about. Trying to do this is like trying to define "simultanity" on two different clocks moving at different speeds.
First
|
Prev
|
Pages: 1 2 3 Prev: Decision Variable in the Matrix Form Next: Why do deploytool generates different exe file |