Critical Sections for userland.

Daniel Eischen deischen at
Tue Oct 2 20:02:09 PDT 2007

On Tue, 2 Oct 2007, Alfred Perlstein wrote:

> * Daniel Eischen <deischen at> [071002 19:46] wrote:
>> On Tue, 2 Oct 2007, Alfred Perlstein wrote:
>>> Hi guys, we need critical sections for userland here.
>>> This is basically to avoid a process being switched out while holding
>>> a user level spinlock.
>> Setting the scheduling class to real-time and using SCHED_FIFO
>> and adjusting the thread priority around the lock doesn't work?
> Too heavy weight, we want to basically have this sort of code
> in userland:

Well, yeah, but are you _really_ sure that you aren't just
running something that should be real-time and have priority
over other applications?  SCHED_FIFO means you will run until
you relinquish the CPU (you can only do this as root).  If
all your threads are well behaved, would this work?  Have
you tried it?

Are you trying to prevent switching out of the thread
amongst other threads of the same application, or all
threads in the system?


More information about the freebsd-hackers mailing list