Interesting problem about uuid1

S

sword

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
 
A

alex23

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top