gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Newbie - don't quite understand tagging method


From: David Allouche
Subject: Re: [Gnu-arch-users] Newbie - don't quite understand tagging method
Date: Mon, 1 Dec 2003 15:59:47 +0100
User-agent: Mutt/1.5.4i

On Fri, Nov 28, 2003 at 10:21:03AM +0000, Mark Thomas wrote:
> It's not. It's potentially less unique.
> 
> On a symmetric-multiprocessing machine running your script many times in
> parallel, it's possible for two instances of 'date' to be exec'd
> simultaneously and get the same time (the kernel rarely has nano-second
> precision: mine has microsecond precision, as far as I can tell).  So the
> probability of a collision between two processes running within a 1ms gap
> is 1 in 1000 (for my kernel, at least).
> 
> It's not impossible: I have actually had this happen to me for something
> entirely unrelated in the past (generating pseudo-random seeds from the
> clock and the MAC address).
> 
> Adding the process id might help :)

Well, my template was intentionally simplistic. If you are generating
several ids in a tight loop, you need to loop as long as the new id is
the same as the previous one. If you have several parallel processes
running you could use some locking method (e.g.  mkdir) so only one ID
is generated at a given moment (with moment > the resolution of the
clock). Eventually that might become a performance bottleneck, but at
this point the whole thing would likely have moved out of the
sh-scripting realm entirely.

> I think another discussion a few months ago mentioned that uuids were
> useful as arch ids as they didn't look like "last-edited" timestamps that
> another non-arch-using developer might want to update.

That is definitive good point for uuids. I may even start using them so
other people would not change the tag while trying to do a good thing.

-- 
                                                            -- ddaa




reply via email to

[Prev in Thread] Current Thread [Next in Thread]