GDB 6.0 and FreeBSD threads

Petri Helenius pete at
Mon Mar 29 12:41:48 PST 2004

Niall Douglas wrote:

>Here's a thought - surely on a M:N threading implementation the 
>kernel and user side library can automatically optimise which threads 
>don't need to be system scope? They could do this by maintaining a 
I would hate to see this happen. The added complexity and 
unpredictability would make implementations harder because you would 
have to account for an optimizer which tries to think what´s best for 
the crappy application/programmer who does not know what he wants.

>sleep & i/o history for each thread, noting when which threads run 
>concurrently, which i/o dependencies exist between threads and from 
>that dynamically rescope the thread plus perform dynamic priority 
>boosting to minimise sleeps. Indeed, if the kernel scheduler felt it 
>was being overtaxed, more threads could be moved in-process.
Why not just run all threads SCOPE_PROCESS? Then the system will do that 
for you.

>To me there is little point investing in all the complexity of a M:N 
>implementation if you don't implement such optimisation features - 
>otherwise the substantial amounts of extra code cause things to run 
>slower due to sheer binary size. Of course this subtly breaks POSIX 
The great advantage of process scope threads is the fact that you can 
hand over a mutex without going trough a process switch.


More information about the freebsd-threads mailing list