“Last month’s column looked at bare context switch times by
using the best primitives on both Windows and Linux. According to
those results, context switch time under Windows takes only half as
long as under Linux. I concluded that the algorithm for choosing a
thread to run is well optimized in Windows.“This month’s column follows up on two issues. In the first, we
look at giving the scheduler algorithm multiple choices by
inserting more than one extra lock into the scheduling stew. Here
again, we look only at the switching algorithm and give the
processor no real work to accomplish. In the second issue, we
finally look at accomplishing real work with threads. My workload
consists of an intensive CPU computation of a fractal point. I give
each thread a fractal point to compute and see how many iterations
each can accomplish after a given amount of time. Will lots of
threads get equal amounts of time?“Recall last month’s column showed that using the proper process
synchronization primitives can make a major difference in the
amount of time required to perform a context switch. Choosing the
best primitives on each platform to measure the context switch time
produces a reasonably fair comparison. Although last month’s
program accomplished no work, it did demonstrate the speed of
context switching in both systems…”
Related Story:
developerWorks: Context Switching(Jul 24, 2002)