developerWorks: Context Switching, Part 2 | Linux Today

developerWorks: Context Switching, Part 2

Written By
Web Webster
Web Webster
Jan 6, 2003

“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…”


Complete Story

Related Story:

developerWorks: Context Switching
(Jul 24, 2002)

Web Webster

Web Webster

Web Webster has more than 20 years of writing and editorial experience in the tech sector. He’s written and edited news, demand generation, user-focused, and thought leadership content for business software solutions, consumer tech, and Linux Today, he edits and writes for a portfolio of tech industry news and analysis websites including webopedia.com, and DatabaseJournal.com.

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.