On Nov 21, 5:33 pm, sword <john...@gmail.com> wrote: > My colleague asks me an interesting problem about uuid library in > python. In multicore system with multiprocessing, is it possible to > get the duplicated uuid with uuid1? > > I just check the RFC 4122, and I can't find anything about multicore > environment. Python's uuid1 method generates the uuid with time stamp, > mac address, and algorithm to gen random numbers. So, I think it's > possible to get the duplicate uuid1 at the same time. > > What about you? Hope for your reply
Check the library documentation: http://docs.python.org/library/uuid.html uuid.uuid1([node[, clock_seq]]) Generate a UUID from a host ID, sequence number, and the current time. If node is not given, getnode() is used to obtain the hardware address. If clock_seq is given, it is used as the sequence number; otherwise a random 14-bit sequence number is chosen. Each process would have to not only execute at the exact same time, it would have to generate the same 14-bit random sequence. And if you're really concerned, try specifying a different clock_seq for each core. -- http://mail.python.org/mailman/listinfo/python-list