Date: Mon, 7 Oct 2002 23:06:24 -0700 (PDT) From: Don Lewis <dl-freebsd@catspoiler.org> To: nate@root.org Cc: julian@elischer.org, tlambert2@mindspring.com, sam@errno.com, freebsd-arch@FreeBSD.ORG, freebsd-net@FreeBSD.ORG Subject: Re: CFR: m_tag patch Message-ID: <200210080606.g9866OvU034411@gw.catspoiler.org> In-Reply-To: <Pine.BSF.4.21.0210072203180.9216-100000@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7 Oct, Nate Lawson wrote: > On Mon, 7 Oct 2002, Julian Elischer wrote: >> it is just working on the principal that there is not going to be >> a collision in the 32 bit space. Especially when we create them from >> "time since the epoch", and when teh various authors can see each >> other's choices of value. > > There are deterministic ways to generate them. > 1. A counter -- gettag() { return tag++; } > 2. A LCRG -- gettag() { return (A * tag) % n; } > 3. A global registry -- "Hey, gimme a major" > > There are non-deterministic ways as well, i.e. hash functions and > PRNGs. And if code can run faster than a given time source, the output of > that source or permutation thereof can produce collisions. > > What leads you towards the time-based option vs. the others, especially > the deterministic ones? Why not name them? At boot or module load time stuff the name in a table and use the table index as the 16 bit ID. Is there any reason the ID has to be the same each time the system is booted? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210080606.g9866OvU034411>