From owner-freebsd-net Mon Oct 7 23: 7:17 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 19AEF37B401; Mon, 7 Oct 2002 23:07:16 -0700 (PDT) Received: from gw.catspoiler.org (217-ip-163.nccn.net [209.79.217.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 99E4B43E6E; Mon, 7 Oct 2002 23:07:15 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Received: from mousie.catspoiler.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.12.5/8.12.5) with ESMTP id g9866OvU034411; Mon, 7 Oct 2002 23:06:28 -0700 (PDT) (envelope-from dl-freebsd@catspoiler.org) Message-Id: <200210080606.g9866OvU034411@gw.catspoiler.org> Date: Mon, 7 Oct 2002 23:06:24 -0700 (PDT) From: Don Lewis Subject: Re: CFR: m_tag patch To: nate@root.org Cc: julian@elischer.org, tlambert2@mindspring.com, sam@errno.com, freebsd-arch@FreeBSD.ORG, freebsd-net@FreeBSD.ORG In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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-net" in the body of the message