Status: New
Owner: ----
New issue 729 by [email protected]: V8's preemption mechanism
(Locker::StartPreemption()) is broken
http://code.google.com/p/v8/issues/detail?id=729
V8 allows threads that hold the V8 lock to be periodically preempted,
allowing multiple threads to share V8. This is implemented by having the
thread being preempted release the V8 lock and then call sched_yield() in
Thread::YieldCPU() in all platforms except win32, which calls Sleep(0)
instead.
However, scheduling fairness does not directly translate to mutex fairness.
The scheduler is just allocating CPUs to waiting threads. Mutex contention
is orthogonal to this. Yielding the CPU does not necessarily yield the
mutex to a blocking thread. Instead, the yielding thread could immediately
be rescheduled and re-acquire the V8 lock before the blocking thread has a
chance to acquire it.
For V8's preemption to work, I think it needs some kind of user-level
coordination mechanism that would ensure a round-robin assignment of
threads.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev