[openbeos] Multi CPU thread scheduling (question)

Morning / Afternoon / Evening

This evening I gave Haiku a twirl (mouse only support, no keyboard), and
tried the famous GLTeapot demo.  I have an AMD Dual Core CPU, and with Pulse
open noticed a pecularity.  For one second GLTeapot would hammer CPU #1 at
100% with the second CPU idle, and after a second or so, the roles would
swap around (CPU #2 would be 100%, while the first core is idle).

Yes, it's good to see Haiku scheduling a task to the free CPU when the other
is busy.  What is not good is the bouncing around, especially considering
that the CPU cache's get flushed / refilled with every transition.   The
question I have is - is there anything that can be done to avoid this
(schedular design and CPU affinity)?  Does the scheduler take into account
which thread was running on which CPU before scheduling, in order to avoid
expensive cache misses?  What sort of design can work around this problem?

This is probably the hard core question of the week.

Other related posts: