This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The problem with __pthread_manager_adjust_prio


On Mon, Apr 15, 2002 at 01:21:39PM -0700, Ulrich Drepper wrote:
> On Mon, 2002-04-15 at 10:38, H . J . Lu wrote:
> > Hi Ulrich,
> > 
> > Have you looked at
> > 
> > http://sources.redhat.com/ml/libc-alpha/2002-03/msg00106.html
> 
> I have commented on this and said how I'd prefer a solution.  I think I
> said the value the manager uses must be stored in a thread-local
> variable or at least a place which is not modified or read by other
> threads.  The use of manager->p_priority in the newly created threads is
> wrong.  I was expecting somebody to act on this.
> 

It won't work. There are 2 problems:

1. pthread_start_thread needs to know the manager's priority when clone
is called. There is no way to tell what the value will be since it can
be changed at any time by __pthread_manager_adjust_prio. One way to
solve it is not to check manager->p_priority in pthread_start_thread
at all and always set SCHED_OTHER by default.
2. There is a race conditon between __pthread_manager_adjust_prio
since diffetent threads can call it at any time.

I don't believe a thread-local variable can solve those problems.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]