Google Answers Logo
View Question
 
Q: Microsoft Windows GUID generation ( Answered,   0 Comments )
Question  
Subject: Microsoft Windows GUID generation
Category: Computers > Programming
Asked by: brother_bill-ga
List Price: $20.00
Posted: 08 Aug 2005 13:13 PDT
Expires: 07 Sep 2005 13:13 PDT
Question ID: 553194
How many GUIDs in Microsoft Windows can one computer generate without
rolling over or running out?
At exhaustion, will it restart (roll over), or fail to generate
additional ones (crash)?  
I'll be using Microsoft .net framework to generate new GUIDs on my
computer, later a dedicated server.
Answer  
Subject: Re: Microsoft Windows GUID generation
Answered By: theta-ga on 08 Aug 2005 21:38 PDT
 
Hi brother_bill-ga,
   The .NET Framework Guid.NewGuid method calls the Windows API
function CoCreateGuid that calls UuidCreate to generate globally
unique 128-bit numbers.
   You can find more information on the UuidCreate function here:
       - MSDN Library: UuidCreate
         (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/uuidcreate.asp)

To answer your questions:
   1. How many GUIDs in Microsoft Windows can one computer generate without
rolling over or running out?
     From the following article on Code Project:
          - Generating GUIDs on the Pocket PC
            (http://www.codeproject.com/netcf/PPCGuidGen.asp)
     "Question: How many GUID combinations are there? 
      Answer: There are 122 random bits (128 ? 2 for variant - 4 for
version) so this calculates to 2^122 or
5,316,911,983,139,663,491,615,228,241,121,400,000 possible
combinations."

  2. At exhaustion, will it restart (roll over), or fail to generate
additional ones (crash)?
     Since the GUID is essentially a numeric value generated at run
time, it will eventually start repeating values. However, this
shouldn't be much of a concern for you, since due the the sheer number
of values available, a GUID is either guaranteed to be different from
all other UUIDs/GUIDs generated until 3400 A.D. or extremely likely to
be different (depending on the algorithm used).
     Rest assured that the function won't crash after all the unique
values have been generated.

For more information, check out the following:
   - UUIDs and GUIDs
     (http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt)

   - The Old New Thing: Sure, we do that
     (http://blogs.msdn.com/oldnewthing/archive/2004/02/11/71307.aspx)

   - joeware: "GUIDs" or "Having unique in the name doesn?t make it so..."
     (http://blog.joeware.net/2005/06/19/42/)

------------------------------------------------------------

Hope this helps.
If you need any clarifications, just ask!

Regards,
Theta-ga
:)


=========================================================
Google Search Terms Used:
  when will guids run out
  windows generate guid

Request for Answer Clarification by brother_bill-ga on 09 Aug 2005 02:45 PDT
OK, so there are 2^122 different GUIDs in the entire universe.

Would a specific machine start with a fixed sub-bit code, say 64 bits,
say from a network card ID and then have the remaining bits vary?  In
this case, the variation would be in (122-64) bits or 2^(122-64)
random numbers.

Or does each machine pick a random number within the 2^122 possible
choices, so that there is a theoretical possible of 2 machines
generating the same GUID, but on a practical view is extremely
unlikely?

The purpose of this exercise is to determine whether generating GUIDs
is sufficient to generate a random character string based on each
GUID.

Clarification of Answer by theta-ga on 09 Aug 2005 04:20 PDT
Hi brother_bill-ga,
  On systems running versions of Windows older than Windows 2000, the
UuidCreate method generates version 1 UUID's. These devote 48 bits of
the 128 bit GUID to the MAC address of the network card. For systems
with multiple IEEE 802 addresses, any available address can be used.
For systems that do not have a network card installed, a randomly
generated value is used.
  On Windows 2000 and later, the UuidCreate method generates version 4
UUIDs, which *always* use a random number instead of the MAC address.

  In case of both v1 and v4 UUID's there is a theoretical possible of
2 machines generating the same GUID, but on a practical view this is
extremely
unlikely.
   This is so in case of v1 UUID's because even though in theory a
systems MAC address is supposed to be unique across all machines, in
practice it is possible to find multiple machines with the same MAC
address. In this case, there is a theoretical possibility, however
small that a GUID generated on these machines may be the same.
   For more details on this topic, you can refer to the articles I
linked to in my initial posting.

   Hope this helps.
   If you need further clarifications, just ask.

Regards,
Theta-ga
:)

Request for Answer Clarification by brother_bill-ga on 09 Aug 2005 13:36 PDT
Last clarification (maybe ;-)  )

OK, so it isn't truly "Globally Unique" (marketing for you).

If I want to use part of the GUID as a base for a unique ASCII
graphical identifier, is one part (substring) of the GUID better than
another?
That is, is one part of the GUID static, where another part varies widely.
If so, I would want to extract from the varying part.

BTW, I do tip ;-)

Clarification of Answer by theta-ga on 09 Aug 2005 20:43 PDT
Hi brother_bill-ga,
  There is no need to worry about the clarifications. We will work
through this till you are satisfied. :)
  Coming back to your question, as you are aware for v4 GUIDs, 6 bits
out of the 128 bits are used to store information such as version
number and variant.
  The following article gives a breakup of the various parts of a GUID:
        - Generating GUIDs on the Pocket PC: The GUID Format
          (http://www.codeproject.com/netcf/PPCGuidGen.asp#The_GUID_Format)
  As you can see from the breakup, the High field of the timestamp and
the two clock sequence fields can be considered less random than
others because they are used to store data. The remaining fields
should serve your purpose.
Hope this helps.
If you need any clarifications, you know what to do! ;)
Regards,
Theta-ga
:)
Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy