Re: threading and multicores, pros and cons
- From: Paul Rubin <http://phr.cx@xxxxxxxxxxxxxx>
- Date: 14 Feb 2007 22:32:52 -0800
John Nagle <nagle@xxxxxxxxxxx> writes:
But there are dumb thread implementations that make
a system call for every lock.
Yes, a sys call on each lock access would really be horrendous. But I
think that in a modern cpu, LOCK XCHG costs as much as hundreds of
regular instructions. Doing that on every adjustment of a Python
reference count is enough to impact the interpreter significantly.
It's not just mutating user data; every time you use an integer, or
call a function and make an arg tuple and bind the function's locals
dictionary, you're touching refcounts.
The preferred locking scheme in Linux these days is called futex,
which avoids system calls in the uncontended case--see the docs.
.
- References:
- Re: threading and multicores, pros and cons
- From: garrickp
- Re: threading and multicores, pros and cons
- From: Paul Rubin
- Re: threading and multicores, pros and cons
- From: John Nagle
- Re: threading and multicores, pros and cons
- Prev by Date: Re: Method overloading?
- Next by Date: Re: AUX File Writing Error
- Previous by thread: Re: threading and multicores, pros and cons
- Next by thread: Re: threading and multicores, pros and cons
- Index(es):
Relevant Pages
|