Critical Sections for userland.
Alfred Perlstein
alfred at freebsd.org
Tue Oct 2 19:19:10 PDT 2007
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.
The way I envisioned doing this was as follows:
1) syscall that sets a pointer in the struct thread.
2) user mlocks that page.
3) when scheduler goes to switch out a process due to quantum it checks
this pointer, if set it will give the process more time to run and
not switch it out. (*)
4) the load would seem to have to be non-faulting.
So my questions are:
1) Where would be a good place to add this code in the scheduler and how?
2) How does one do a read/write to userland address, but if the access would
fault, then return an error rather than trap? I'm quite sure the scheduling
decisions would be made inside of the timer interrupt, (am I right?), and
hence would not be allowed to fault in pages.
(*) Note, we will implement limits to this so that a haywire application
is not able to be "critical" forever.
Any help would be appreciated.
--
- Alfred Perlstein
More information about the freebsd-hackers
mailing list