Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 1999 09:13:53 -0700
From:      Mike Smith <mike@smith.net.au>
To:        rkw@dataplex.net
Cc:        Marc Slemko <marcs@znep.com>, hackers@FreeBSD.ORG
Subject:   Re: libkvm sucks 
Message-ID:  <199905181613.JAA03949@dingo.cdrom.com>
In-Reply-To: Your message of "Tue, 18 May 1999 05:14:23 CDT." <Pine.BSF.4.05.9905180456530.6225-100000@nomad.dataplex.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> However, this applies to the functionality wherever it is implemented.
> Moving the formatting to the kernel does not change anything.

It "changes" thinks in that it unnecessarily bloats the kernel.

> If you are concerned about the time that it takes to do hostname lookups,
> that time is not any shorter in the kernel.

You can't perform hostname lookups in the kernel.

> There are two fundamental approaches that work.
> 
> 1) Lock the structure
>    Make a snapshot copy
>    Unlock the structure
>    Generate the report from the copy
>    Destroy the copy
> 
> This technique can be used in either userland or kernel implementation.

You can't lock kernel datastructures from userland (except for certain 
very specific cases where the lock is a side-effect of another 
operation).

> 2) Use list traversal protocols that prevent the actual deletes from
> occurring while there is another list reader in that portion of the list.
> 
> Again, the only requirement in the kernel is the ability set and clear the
> lock. The remainder of the formatting can occur outside the kernel
> because the structures being viewed and not destroyed during the
> traversal. 

This is where sysctl is preferable; the system call allows the kernel 
to perform whatever locking protocol is required to complete the call 
in a timely and efficient fashion, and all formatting can be performed 
in userland while the kernel holds no locks.

Consider the similarities to NFS directory traversals, and the cookie 
approach used in NFSv3 to deal with server-side state changes during 
traversal by the client.  You're arguing about a problem that already 
has several tried and tested solutions.

-- 
\\  The mind's the standard       \\  Mike Smith
\\  of the man.                   \\  msmith@freebsd.org
\\    -- Joseph Merrick           \\  msmith@cdrom.com




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905181613.JAA03949>