问题
I have read that in a multi core processor each core contains 2 hardware threads for example in dual core processor 4 hardware threads are running. Now if i create 2 threads in java are those threads going to map with 2 hardware threads or those 2 java threads are executed by single hardware thread of a particular core ?
回答1:
That is dependent on a lot of things, however the 2 hardware threads per core you are referring to is the Intel HyperThreading technology. This technology enables the CPU to have two Thread Context's in memory and be executing simultaneously, sharing execution resources.
What threads run where is OS implemention dependent and mostly resolved by the Thread Scheduler algorithm of your OS.
来源:https://stackoverflow.com/questions/5592871/hardware-thread-vs-soft-threads