, <tech-security@netbsd.org>
From: Nick Gimbrone <Nicholas.Gimbrone@Home.Com>
List: tech-net
Date: 01/08/2002 22:10:00
> > (I recall them being defined as 'small integers' - I always fancy random
> > 32 bit ones myself (mathematically small!))
> The reason you'd like the integer to remain 'small' (i.e. fairly densely
> packed towards 0) is that it makes it possible to do a simple table lookup
> to get from the integer to the stuff you need to know about an interface
> to do an operation. Randomly-assigned 32-bit values would unnecessarily
> require a fancier and more costly data structure to do the same operation.
That is only one possible path. Another path that uses pseudo-random 32 (or 64
;-) bit values is to simply use the address of the data structure in question
(along with suitable validation when this indexing is performed that it actually
does point to such a data structure... ;-). This leads to a very fast "look-up"
and allows the data structures in question to be stored in something other than
an array (thus allowing much more flexable memory management schemes for
allocating the structures in question). I've used this technique very
successfully in a number of high performance kernels.
Peace. -njg