FreeBSD src
Go to file
John Baldwin 3f08bd8bce Add a basic reader/writer lock implementation to the kernel. This
implementation is by no means perfect as far as some of the algorithms
that it uses and the fact that it is missing some functionality (try
locks and upgrades/downgrades are not there yet), however it does seem
to work in my local testing.  There is more detail in the comments in the
code, but the short version follows.

A reader/writer lock is very much like a regular mutex: it cannot be held
across a voluntary sleep; it can be acquired in an interrupt thread; if
the lock is held by a writer then the priority of any threads that block
on the lock will be lent to the owner; the simple case lock operations all
are done in a single atomic op.  It also shares some similiarities
with sx locks: it supports reader/writer semantics (multiple readers,
but single writers); readers are allowed to recurse, but writers are not.

We can extend this implementation further by either improving algorithms
or adding new functionality, but this should at least give us a base to
work with now.

Reviewed by:	arch (in theory)
Tested on:	i386 (4 cpu box with a kernel module that used 4 threads
		that randomly chose between read locks and write locks
		that ran w/o panicing for over a day solid.  It usually
		panic'd within a few seconds when there were bugs during
		testing. :)  The kernel module source is available on
		request.)
2006-01-27 23:13:26 +00:00
bin Document that '#' starts a comment. 2006-01-01 16:02:12 +00:00
contrib s/predefine/predefined/ 2006-01-24 06:38:35 +00:00
crypto Fix the amd64 (and presumably ia64) lib32 build by ensuring that the 2006-01-02 11:28:42 +00:00
etc Document the user/group LOR in our sample pf.conf 2006-01-27 17:16:20 +00:00
games Add some wisdom from Garrett Wollman concerning error codes returned by 2006-01-27 21:06:19 +00:00
gnu Don't pollute output when "make" is run with -s. 2006-01-14 20:48:50 +00:00
include Analogous to __printflike and __scanflike, add the macro __format_arg which 2006-01-26 20:53:40 +00:00
kerberos5 Add a new extensible GSS-API layer which can support GSS-API plugins, 2005-12-29 14:40:22 +00:00
lib The .Nm macro prints Open_Disk() instead of libdisk, so use an explicite 2006-01-27 16:38:05 +00:00
libexec In the daemon code, check for and report possible errors 2006-01-21 13:06:37 +00:00
release - Fix the www build by removing obsolete references to &hwlist.sound; 2006-01-26 09:37:24 +00:00
rescue Install nextboot in /rescue as /rescue/nextboot rather than 2005-12-15 18:29:01 +00:00
sbin Fix rev 1.12. 2006-01-26 21:05:39 +00:00
secure Add a new extensible GSS-API layer which can support GSS-API plugins, 2005-12-29 14:40:22 +00:00
share Make an example command correct and copyable to terminal. 2006-01-27 11:56:59 +00:00
sys Add a basic reader/writer lock implementation to the kernel. This 2006-01-27 23:13:26 +00:00
tools - Fix infinite loop in strip_log(). 2006-01-25 23:47:12 +00:00
usr.bin make wall(1) work with pts. 2006-01-27 08:52:14 +00:00
usr.sbin - Hide 'incorrect geometry warning' in non-interactive mode. A user should 2006-01-27 21:41:49 +00:00
COPYRIGHT Happy new year, a little late 2006-01-15 22:06:10 +00:00
LOCKS Document commit constraints for RELENG_6_*. 2006-01-13 06:51:43 +00:00
MAINTAINERS Remove extra geom_zero. 2005-12-12 01:28:19 +00:00
Makefile Fix a bug in previous revision: skip LINT if it exists, not NOTES 2005-11-28 11:14:36 +00:00
Makefile.inc1 Revert the previous change - the lib32 build should work now. 2006-01-02 17:52:16 +00:00
ObsoleteFiles.inc Those files are present on -current (but empty). And they are needed 2006-01-18 18:48:42 +00:00
README KerberosIV de-orbit burn continues. Disconnect from "make world". 2003-03-08 10:01:26 +00:00
UPDATING - Fix typo 2006-01-18 20:36:58 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The
``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html