|
There is a finite number of possible values for a GUID. No finite number can be guaranteed unique.
It's not that difficult.
|
|
|
|
|
If you're only talking about the random GUIDs, only 122 bits are actually random.
|
|
|
|
|
|
Quote: For example, time value will roll over at less than 1400 years.
Oh My! Prepare for Year 3400 panic - all the COBOL code will have to be updated all over again.
|
|
|
|
|
Of course it is possible to generate a non-unique GUIDs, but if you use a reliable implementation of a good generation algorithm, you can be reasonably confident that GUIDs will be unique within the context that matters. The only time I have seen problems was when using an unreliable implementation - NetWare 5 used to have problems with duplicate GUIDs being generated when timesync caused the clock to go backwards.
|
|
|
|
|
Arguing about the uniqueness of GUIDs is pointless, given that they're integer numbers in a finite space, which means that soon or (most likely) later there's going to be a collision, however, for practical purposes we can say that they're unique.
|
|
|
|
|
I've actually been burned twice in the same year by GUID collisions within unrelated software products from other companies. They are a very poor architecture choice.
|
|
|
|
|
This may not be in the same spirit of fun that the article sets up, but I thought GUIDs were guaranteed unique because they are based on MAC addresses that are guaranteed as unique!? So proving MAC addresses are not unique would be a prerequisite?!
"Courtesy is the product of a mature, disciplined mind ... ridicule is lack of the same - DPM"
|
|
|
|
|
But your server is generating GUIDs using the same MAC address, right? So it wouldn't be unique per GUID generated on that server. But you shouldn't have to worry about collisions with GUIDs generated on other machines, I guess.
|
|
|
|
|
do {
myguid = getGUID();
} while(!exists(myguild))
This would solve the problem with unique, it'll execute almost only once for the next several thousand years. It'll never generate bug for "bad luck".
P.S. Sorry for my pseudocode, I write in javascript usually.
|
|
|
|
|
I assume their algorithm is designed to use the MAC Address as a seed and is contructed to guarantee unique GUIDs given this.
You are right that there is a lot more to it than just the unique seed. I have never seen the algorithm and clearly never will. Sounds like a really interesting Math problem though. I would love to know the rest of the approach they used.
"Courtesy is the product of a mature, disciplined mind ... ridicule is lack of the same - DPM"
|
|
|
|
|
Systems without network cards can generate GUIDs. What do they use for their MAC address? Yup.. zeros. A GUID also includes clock ticks of some sort or another that (they hope) tick faster than the system can request GUIDs. I seem to recall there's some bits in there for sequence number within a clock tick, or maybe systems just keep track of the last one issued and ensure they don't generate duplicates. I think there might be some other sources of mostly unique bits thrown in, like CPU serial numbers or something. The idea being that within a given uptime, of a given OS load, on a given system, they are guaranteed to be unique, and between systems, they are as unique as reasonably possible.
How are these bits packed into the GUID? It doesn't matter, no amount of deterministically massaging the bits will give you anything more unique. Massaging the source bits could obscure them and make backtracking to the original values for nefarious purposes more difficult, and I suspect its done. Using the source bits as seed for a pseudorandom number generator won't add uniqueness, but it is probably a pretty good, and inexpensive, way to deterministically massage the bits to obscure them.
GUIDs were never absolutely guaranteed to be unique, and I'd be willing to bet most of those sources of unique bits are no longer unique once one starts running GUID generation code in virtual machines.
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|
|
Great insights. Thanks.
This has always interested me. I guess I should try to research it better sometime.
"Courtesy is the product of a mature, disciplined mind ... ridicule is lack of the same - DPM"
|
|
|
|
|
This has always interested me. I guess I should try to research it better sometime.
Thanks for the great insights.
"Courtesy is the product of a mature, disciplined mind ... ridicule is lack of the same - DPM"
|
|
|
|
|
MS generates two types of GUID: one that is MAC address based and one that is time based. If you generate them sequentially, it will tke you some time to get a duplicate but if you generate them at random, it is a lot easier to get a duplicate. I have had duplicates several times.
|
|
|
|
|
Came home tonight from my sh*tty job-you-have-when-you-haven't-got-a-job only to find a round black adhesive rubber foot about 8-9mm in diameter sitting on my desk.
No idea how it got there, no idea what it's from and I have just scoured the house looking for anything it could be from and retracing my steps to find the devices I have handled today.
Like a steering wheel attached to my dick, it's driving me nuts.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Aliens?
---------------------------------
Obscurum per obscurius.
Ad astra per alas porci.
Quidquid latine dictum sit, altum videtur .
|
|
|
|
|
No, they give him anal probes.
|
|
|
|
|
Keith Barrow wrote: No, they give him anal probes.
My name is not Eric Cartmen.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Put in the "magic jam jar" in the kitchen cupboard, that's what I do I get something like that, Six hours, months & or years later when you find what it is off you can refit it (and appear a hero to those who are complaining about X being not level)....
|
|
|
|
|
Either that, or he'll become the object of scorn for retaining 873 magic jars -- which are not in any way indexed, so their content can be safely categorised as "lost".
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Well yes, once the magic jar is full it moves to the garage, and the phrase "I had one those" and you get to hang out in the garage until you find it
|
|
|
|
|
Michael Martin wrote: Like a steering wheel attached to my dick, it's driving me nuts.
Careful it may have an airbag in it. Just don't rush to fast to find the solution. It could be painful.
I actually like the title "Black Adhesive Rubber Foot". Sounds like a Captain Beefheart song title or lyric.
"Rock journalism is people who can't write interviewing people who can't talk for people who can't read." Frank Zappa 1980
|
|
|
|
|
Ah, I lost one of them from my keyboard.
Could you e-mail it to me?
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Mark_Wallace wrote: Ah, I lost one of them from my keyboard.
Could you e-mail it to me?
On its way.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|