in reply to Converting a parallel-serial shell script
I would advise against using Threads to solve your problem. There's nothing to gain from using threads since the problem you describe is disk bound and computationally intensive. Forks, on the other hand, are bit simpler to use and have less potential gotchas.
You could use SystemV semaphores to serialize the bulk loading part of the code, which should be available on any Posix complaint system including Windows, although I have never tried using SystemV semaphores on Windows before.
To be honest I am not convinced that you need semaphores at all. What if somebody or something else starts doing bulk upload while your script is running? Instead, in every forked process I would try to do the bulk load and if it fails go into sleep for 5 seconds and then try again. And I would keep trying until the bulk load succeedes.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting a parallel-serial shell script
by BrowserUk (Patriarch) on Sep 22, 2008 at 14:02 UTC | |
by kubrat (Scribe) on Sep 22, 2008 at 16:37 UTC | |
by BrowserUk (Patriarch) on Sep 22, 2008 at 21:21 UTC | |
by kubrat (Scribe) on Sep 26, 2008 at 11:11 UTC | |
by BrowserUk (Patriarch) on Sep 26, 2008 at 12:07 UTC | |
| |
|
Re^2: Converting a parallel-serial shell script
by Corion (Patriarch) on Sep 22, 2008 at 14:11 UTC | |
by kubrat (Scribe) on Sep 30, 2008 at 14:56 UTC | |
by Corion (Patriarch) on Sep 30, 2008 at 15:06 UTC |