[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/38741: priority inversion in libpthread breaks apps that use SCHED_FIFO threads
>Synopsis: priority inversion in libpthread breaks apps that use
>Arrival-Date: Sun May 25 14:05:00 +0000 2008
>Originator: Andrew Doran
The NetBSD Project
T1, low priority thread acquires a spinlock in libpthread. It's preempted
by T2, which is a realtime thread (SCHED_FIFO) with a high priority. The
system has a single CPU. T2 busywaits for the spinlock held by T1. T2
is much higher priority and does not have a fixed time quantum, so will
spin indefinitely. Because of T2's high priority, T1 will never get CPU
time and so the spinlock will never be released.
Short term: don't use spinlocks, use pthread_mutex_t wherever possible.
Longer term: for real-time threads, introduce kernel assisted mutexes &
rwlocks that implement priority inheritance.
Main Index |
Thread Index |