unix - Shared memory and waiting sessions in Matlab -
doing regression on large dataset, have huge read-only matrix i'd share among several threads. i've looked @ various way of doing , found sharedmatrix
toolkit need. reading through tutorial, came following setup:
session 0
- loads matrix , makes availablesession 1..n
- worker sessions
the problem session 0
has finish after other n sessions have finished. know how make session wait? best solution make wait until kill i'm running scripts on remote linux system , not connected time.
update: in end i've changed approach problem, after reading part of tutorial:
the “free” directive marks shared memory segment deletion. note: not deleted until every attached session explicitly detaches or terminated. last session detaches, system reclaim allocated segment.
this means i've created 1 "master" session loads matrix, makes available , starts own computation, , several "slave" sessions use shared matrix. if master session finishes earlier, causes no problem slave sessions shared matrix remains in memory until last process uses terminated.
if want have wait indefinitely, use eitan's solution based on pause
. more generally, labbarrier
should use perform kind of synchronization.
Comments
Post a Comment