[tor-bugs] #9682 [Tor]: Better work queue implementation for cpuworkers
Tor Bug Tracker & Wiki
blackhole at torproject.org
Wed Feb 26 19:09:24 UTC 2014
#9682: Better work queue implementation for cpuworkers
-----------------------------+---------------------------------------------
Reporter: nickm | Owner:
Type: enhancement | Status: needs_review
Priority: normal | Milestone: Tor: 0.2.5.x-final
Component: Tor | Version:
Resolution: | Keywords: tor-relay performance cpuworker
Actual Points: | Parent ID:
Points: |
-----------------------------+---------------------------------------------
Comment (by nickm):
Replying to [comment:9 andrea]:
> Review, part 2:
>
> 764eb698a4f6dcaaa02f3343589fc9ae763133ff:
> - Where is SPIN_COUNT used?
InitializeCriticalSectionAndSpinCount, which is a Windows thing. It's
like the hybrid spinlock/heavy-lock implementation that most good systems
use these days, but unlike the good systems, Windows expects you to try to
figure out how many times to try spinning before you hand off
responsibility to the OS.
> 05a184ce130856be553985dbdac1d4df8d36902c:
> - Wait, pthread_cond_timedwait() wants an absolute time()? Really? How
many
> ways can this horribly break if the system time changes at the wrong
moment?
Probably many ways; you'd need to read each implementation to find out.
The glibc one does a clock_gettime or a gettimeofday to convert the input
to a relative time right before it passes it to the kernel, so there's a
small window for the clock to jump.
There's also pthread_condattr_setclock that we could use to make this use
(e.g.) CLOCK_MONOTONIC_COARSE instead or something.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9682#comment:12>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list