<!-- MHonArc v2.4.4 --> <!--X-Subject: Re: Unique id's --> <!--X-From-R13: "Xba O. Znzoreg" <wyflfvapNvk.argpbz.pbz> --> <!--X-Date: from babe.globecomm.net [207.51.48.8] by mx01.ny.us.ibm.net id 860864000.68216-1 Sat Apr 12 16:53:20 1997 --> <!--X-Message-Id: 199704121652.LAA06283@dfw-ix4.ix.netcom.com --> <!--X-Content-Type: text/plain --> <!--X-Head-End--> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <html> <head> <title>MUD-Dev message, Re: Unique id's</title> <!-- meta name="robots" content="noindex,nofollow" --> <link rev="made" href="mailto:jlsysinc#ix,netcom.com"> </head> <body background="/backgrounds/paperback.gif" bgcolor="#ffffff" text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000"> <font size="+4" color="#804040"> <strong><em>MUD-Dev<br>mailing list archive</em></strong> </font> <br> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] <br clear=all><hr> <!--X-Body-Begin--> <!--X-User-Header--> <!--X-User-Header-End--> <!--X-TopPNI--> Date: [ <a href="msg00105.html">Previous</a> | <a href="msg00107.html">Next</a> ] Thread: [ <a href="msg00103.html">Previous</a> | <a href="msg00119.html">Next</a> ] Index: [ <A HREF="author.html#00106">Author</A> | <A HREF="#00106">Date</A> | <A HREF="thread.html#00106">Thread</A> ] <!--X-TopPNI-End--> <!--X-MsgBody--> <!--X-Subject-Header-Begin--> <H1>Re: Unique id's</H1> <HR> <!--X-Subject-Header-End--> <!--X-Head-of-Message--> <UL> <LI><em>To</em>: "Multiple Recipients of MUD Design Mailing List" <<A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A>></LI> <LI><em>Subject</em>: Re: Unique id's</LI> <LI><em>From</em>: "Jon A. Lambert" <<A HREF="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</A>></LI> <LI><em>Date</em>: Sat, 12 Apr 1997 12:55:37 -0400</LI> </UL> <!--X-Head-of-Message-End--> <!--X-Head-Body-Sep-Begin--> <HR> <!--X-Head-Body-Sep-End--> <!--X-Body-of-Message--> <PRE> > From: coder#ibm,net > Subject: Re: Unique id's > On 12/04/97 at 12:51 AM, "Jon A. Lambert" <jlsysinc#ix,netcom.com> said: > >Isn't it possible, especially in a multi-threaded system, to generate > >identical IDs if you depend on date/time stamps? > > While possible in those loose terms, if your ObjectID allocation code is > thread-safe its not a problem. Its just a question of making sure that > you don't have a race conditions in your container updates/checks to get > the records# half of the ObjectID (which can be a problem depending on > your approaches). I brute forced the issue as I recall my putting a mutex > on the ObjectID allocation calls so while multiple ID's can be requested > simultaneously, the actual provision of ID's is serialised. After that it > was just a question of making sure that the period that the mutex is > locked for a call is kept to an absolute minimum. > > Note: This gets messy if you go for a distributed database. > > There's no problem if two ObjectID's contain the same timestamp. It > doesn't matter at all. What has to be unique is the combination of > record# and timestamp -- and that combo must be unique for the entire life > of the database. Happily this is not a problem until April 2038, longer > if you chose a different timestamp format. > Ahh your ID has two parts. I use something called a CriticalSection object to block the ' id++; ' function. Its very similar to a mutex, except the reset occurs automatically upon leaving the code section. Its supposed be slightly more efficient, but I believe its really a mutex under the covers. I use it alot, all over the place. :-) > > I found I could easily wrap 2^32 created and destroyed objects in a week > or so. That wasn't good enough, and thus was born my current concept of > recycling and a 64bit time_t/Record# ObjectID. > > I'm rather pleased actually -- the last time I had the server in a shape > it would actually run, I had it creating and destroying about 100,000 > objects per hour while mobiles wandered about the game going in and out of > spoof/watcher areas, and breeding like crazy. stant. > > Figure, that's what, about 40+ million objects being created and > destroyed... Certainly not enough to cause a 32bit wrap, but a good > enough test to demonstrate that the idea works. > Whoa Nelly! I don't expect to reach anything approaching this rate of creation and destruction. My objects tend to have longer lifetimes. Of course I don't implement any sort of spoof/watcher objects. Sounds a lot like the "life" simulation. Have you checked your machine for viruses lately? ;-) </PRE> <!--X-Body-of-Message-End--> <!--X-MsgBody-End--> <!--X-Follow-Ups--> <HR> <!--X-Follow-Ups-End--> <!--X-References--> <!--X-References-End--> <!--X-BotPNI--> <UL> <LI>Prev by Date: <STRONG><A HREF="msg00105.html">Re: Yet Another Introduction</A></STRONG> </LI> <LI>Next by Date: <STRONG><A HREF="msg00107.html">Re: Of disk swapping, database structure & project management..</A></STRONG> </LI> <LI>Prev by thread: <STRONG><A HREF="msg00103.html">Re: Unique id's</A></STRONG> </LI> <LI>Next by thread: <STRONG><A HREF="msg00119.html">Re: Unique id's</A></STRONG> </LI> <LI>Index(es): <UL> <LI><A HREF="index.html#00106"><STRONG>Date</STRONG></A></LI> <LI><A HREF="thread.html#00106"><STRONG>Thread</STRONG></A></LI> </UL> </LI> </UL> <!--X-BotPNI-End--> <!--X-User-Footer--> <!--X-User-Footer-End--> <ul><li>Thread context: <BLOCKQUOTE><UL> <LI><strong><A NAME="00061" HREF="msg00061.html">Unique id's</A></strong>, Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Wed 09 Apr 1997, 21:46 GMT <UL> <li><Possible follow-up(s)><br> <LI><strong><A NAME="00094" HREF="msg00094.html">Re: Unique id's</A></strong>, clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Sat 12 Apr 1997, 06:03 GMT </LI> <LI><strong><A NAME="00101" HREF="msg00101.html">Re: Unique id's</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sat 12 Apr 1997, 11:49 GMT </LI> <LI><strong><A NAME="00103" HREF="msg00103.html">Re: Unique id's</A></strong>, coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Sat 12 Apr 1997, 13:55 GMT </LI> <LI><strong><A NAME="00106" HREF="msg00106.html">Re: Unique id's</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sat 12 Apr 1997, 23:53 GMT </LI> <LI><strong><A NAME="00119" HREF="msg00119.html">Re: Unique id's</A></strong>, coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Mon 14 Apr 1997, 00:01 GMT </LI> <LI><strong><A NAME="00122" HREF="msg00122.html">Re: Unique id's</A></strong>, Jeff Kesselman <a href="mailto:jeffk#tenetwork,com">jeffk#tenetwork,com</a>, Mon 14 Apr 1997, 02:40 GMT </LI> <LI><strong><A NAME="00123" HREF="msg00123.html">Re: Unique id's</A></strong>, Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 14 Apr 1997, 04:31 GMT </LI> <LI><strong><A NAME="00131" HREF="msg00131.html">Re: Unique id's</A></strong>, clawrenc <a href="mailto:clawrenc#cup,hp.com">clawrenc#cup,hp.com</a>, Mon 14 Apr 1997, 23:24 GMT </LI> </UL> </LI> </UL></BLOCKQUOTE> </ul> <hr> <center> [ <a href="../">Other Periods</a> | <a href="../../">Other mailing lists</a> | <a href="/search.php3">Search</a> ] </center> <hr> </body> </html>