comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Simultaneous write on textfile over NFS
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Simultaneous write on textfile over NFS [message #69720] Wed, 10 February 2010 06:39
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
On Feb 10, 4:29 am, Johannes Korn <k...@freisingnet.de> wrote:
> Hi,
>
> I often run idl programs which utilize only one CPU core (for loops).
> The output is a text line appended to a file.
>
> To exploit a multicore I run multiple instances with different parameter
> setups. The output goes to different files. After all jobs are completed
> I manually merge the files.
> This ways I have to keep track which file contains what output and so on.
>
> My question, what happens if I use the same output file for all jobs. Is
> it save?
>
> This means every job would write about every 15 seconds a line like that.
>
> OPENW, u, 'file.txt', /GET_LUN, WIDTH=250, /APPEND
> printf, a, b, c
> FREE_LUN,u


Well, I have no experience with this, but I would
be concerned that if one program attempts to write
"apple" and the other "orange" you may end up with
"apporangele" or something ugly like that...

I mean - maybe it's safe but it looks risky to me.

I would suggest instead to write the time stamp
first in each line of output in all the different
files - this way you can merge the file and sort
them (it's a few commands only if you have a
UNIX-like terminal) - and end up with the same
output as if they were using the same file...

After merge & sort you would have something like:

20100210 09:01:00 apple
20100210 09:01:03 orange
20100210 09:01:12 banana
etc.

Looks much cleaner to me :)


Ciao,
Paolo


>
> What if two write accesses collide? Will the file be corrupted? Will
> there be an error? Will the second job wait until the first one has
> closed the file?
>
> Filesystem is NFS.
>
> Regards,
>
> Johannes
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: "shrink" structures
Next Topic: Re: Serial port DLM for UNIX ?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:42:46 PDT 2025

Total time taken to generate the page: 0.00582 seconds