[concurrency-interest] ThreadLocal vs ProcessorLocal
David M. Lloyd
david.lloyd at redhat.com
Wed Oct 17 17:58:54 EDT 2012
Yes, the OS can and does move threads between CPUs. The scarier
question is: what do you do if/when a CPU is hot-plugged (i.e.
enabled/disabled while the system is up)?
On 10/17/2012 04:30 PM, Dr Heinz M. Kabutz wrote:
> [newbie question]
> Is it possible for a thread to ever be moved between processors, if
> for example the is an idle processor and another that is really busy? If
> not, then load balancing could be problematic. If yes, then this means
> that we need to take this into consideration and not build static
> structures based on the value of which processor the thread is
> /currently/ running on.
> Again, if no, then what is the guarantee that it won't be available on
> some VMs or some hardware architectures or operating systems?
> [/newbie question]
> Dr Heinz M. Kabutz (PhD CompSci)
> Author of "The Java(tm) Specialists' Newsletter"
> Sun Java Champion
> IEEE Certified Software Development Professional
> Tel: +30 69 75 595 262
> Skype: kabutz
> On 10/17/12 11:05 AM, Romain Colle wrote:
>> On Wed, Oct 17, 2012 at 9:15 AM, Kirk Pepperdine <kirk at kodewerk.com
>> <mailto:kirk at kodewerk.com>> wrote:
>> SOT, right now we are using CPUID for a number of reasons. Very
>> easy to get to on Linux as we can do this in pure Java. However
>> other platforms require C++/assembler so having <gulp> an unsafe
>> operation in the JVM would be a win from my POV.
>> I strongly second that. It is next to impossible to implement most
>> NUMA-aware algorithms without knowing on which NUMA node the current
>> thread is running.
>> Having this information available as a Java class (in Thread, Unsafe,
>> ...) would be a huge win for people like us that need NUMA-aware behavior.
>> Romain Colle
>> R&D Project Manager
>> 2 rue Jean Lantier, 75001 Paris, France
>> http://www.quartetfs.com <http://www.quartetfs.com/>
>> Concurrency-interest mailing list
>> Concurrency-interest at cs.oswego.edu
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
More information about the Concurrency-interest