tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: looking for NetBSD kernel & driver info


"Nadolski, Ed" <> wrote:
> Can anyone please point me to any info about the NetBSD kernel and
> writing drivers?  I already have the J. Kunz doc & kernel docs from
> but these seem rather basic.
> I'm interested in more info on threading, interrupts, locking, etc.  For
> example, Linux drivers use mutexes, and Solaris drivers use interrupt
> threads & kmem_cache_alloc().  Are there any analogous constructs in
> NetBSD?  I see mutex functions in the source but they appear little used
> in the drivers, compared to splbio()/splx().

Since the core of NetBSD kernel uses fine-grained locking these days, old way
of spl*()/splx() calls should not be used, and existing drivers are going to
be converted to a modern synchronization primitives.

As you have already noticed, NetBSD provides other synchronization mechanisms.
You may be interested in the following man pages (from -current):

mutex(9), rwlock(9) - mutual exclusion, reader/writer (shared) locks;
softint(9) - software interrupts framework (threaded interrupts);
workqueue(9) - simple API for works in thread-context;
kthread(9) - kernel thread (usually, for a heavy case);
kmem_alloc(9), kmem_free(9) - general memory allocator;
pool_cache(9) - resource-pool cache allocator;

As you will probably find, these APIs are very similar to Solaris'.

Best regards,

Home | Main Index | Thread Index | Old Index