Subject: NetBSD kernels - Are critical sections possible?
To: None <tech-kern@netbsd.org>
From: Marc D Bumble <bumble@groucho.ennovatenetworks.com>
List: tech-kern
Date: 03/19/1999 16:46:59
Hi,

>From NetBSD  kernel space,  I have a  driver which attempts  to access
data across the PCI bus.  There  is an ioctl call which makes the info
request across  the PCI bus and  then puts the kernel  to sleep, using
tsleep(), while it waits for the  data to be retrieved.  In my system,
it does make sense for more than one user process to request this same
data, so if  possible, in the kernel space, I would  like to allow one
PCI call  to retrieve  data whose results  more than one  user process
could access.

Is  the  NetBSD kernel  multi-threaded?   Or  is  there any  value  in
allowing other processes which need the same data to queue and wait on
the same wakeup call?  If so,  do I have a critical section below?  Or
is the waitvar variable deadweight.

For instance, does this code make sense for the NetBSD kernel?

    if (waitvar == 0) 
       send_request_nonBlocking(&reqmesg);
    waitvar++;
    tsleep(pci_data_sleep_var);
    waitvar--;

If it does make sense, is it a critical section, as in does it need some
sort of semaphore blocking?

I  would  just  love  some  pointers  to  the  appropriate  manual  or
documentation which covers this kernel process topic for NetBSD.

thanks in advance, 

marc


-- 
Ennovate Networks, Inc.
330 Codman Hill Rd 
Boxboro MA 01719 
USA Tel 978-263-2002 (ext. 147 or 225)
Fax 978-263-1099 
email: bumble@ennovatenetworks.com
http://www.ennovatenetworks.com/contact/index.htm