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, 2002-04-15 at 13:35, H . J . Lu wrote:

> 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.

There are many different ways to handle this and yes, thread-local
variables are needed.

In adjust_prio you set a flag before calling the syscall.  After the
syscall you update the p_priority element and then you clear the flag.

When starting a new thread and the flag is not set communicate the new
priority in a thread-local variable to the new thread.  If the flag is
set communicate this information and have the new thread unconditionally
set the scheduler and priority.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Attachment: signature.asc
Description: This is a digitally signed message part


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