From owner-freebsd-hackers Mon Jan 29 10: 6:21 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from smtp.nettoll.com (matrix.nettoll.net [212.155.143.61]) by hub.freebsd.org (Postfix) with ESMTP id 750C837B400 for ; Mon, 29 Jan 2001 10:06:01 -0800 (PST) Received: by smtp.nettoll.com; Mon, 29 Jan 2001 19:02:47 +0100 (MET) Message-Id: <4.3.0.20010129191306.061fb3e0@pop.free.fr> X-Sender: usebsd@pop.free.fr X-Mailer: QUALCOMM Windows Eudora Version 4.3 Date: Mon, 29 Jan 2001 19:16:43 +0100 To: Luigi Rizzo From: mouss Subject: Re: [kernel patch] fcntl(...) to close many descriptors Cc: rizzo@aciri.org, drosih@rpi.edu, hackers@FreeBSD.ORG, wollman@khavrinen.lcs.mit.edu In-Reply-To: <200101291657.f0TGveG33419@iguana.aciri.org> References: <4.3.0.20010129151413.023e03a0@pop.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 08:57 29/01/01 -0800, Luigi Rizzo wrote: >hi, >i have to admit i am not too much into theory of hashing, but i am >unclear on how a perfect hash function can be simpler than "the >obvious method" when the namespace is changing dynamically because >modules are added or deleted. >(the obvious method would be a cheap hash on 2-4 chars of >the name followed by a scan of the list in each hash slot.) one way would be to rehash when a syscall is added. hopefully, you want spend your time adding'em. but it is probable that even this is unneded, though one still needs to check. for example, when adding named_syscall("foo", args), you compute hash("foo") using the "current hash function, you try to insert it, and if you have a collision, you recompute the hashes. but, yes, this is over-engineering... >Hopefully the number of functions using this method is >small enough not to worry about the depth of the lists, >and the type of calls using this method is one where the amt >of work in the syscall itself is way larger than the matching cost. yes, one can just strcmp() through the list. it's what filesystem code does anyway, and there are far more files than there are syscalls. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message