DragonFly submit List (threaded) for 2008-01
DragonFly BSD
DragonFly submit List (threaded) for 2008-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: mention msleep() in porting_drivers.txt


From: "Jeffrey Hsu" <hsu@xxxxxxxxxxxxxxxx>
Date: Sun, 06 Jan 2008 12:46:21 -0800

Well, we do have a msleep() function.  It atomically releases a
lock before sleeping to ensure that no wakeup is missed.  It is the
same as the msleep() function that's currently in FreeBSD, except
in FreeBSD it release a mutex lock and in DragonFly it releases a
spin lock.  For short critical sections that don't block, substituting
a spinlock and msleep() for a mutex lock and msleep() would be the
most direct way to convert between FreeBSD and DragonFly.

For more complicated critical sections, it might be better to pursue
a different MP-safety strategy entirely, such as per-cpu data along with
crit_enter()/crit_exit().  This has lower overhead and also parallelizes,
rather than serializes, the work load.

							Jeffrey





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