Talk:Context switch

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing / Software / CompSci / Hardware (Rated Start-class, High-importance)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 High  This article has been rated as High-importance on the project's importance scale.
Taskforce icon
This article is supported by WikiProject Software (marked as High-importance).
Taskforce icon
This article is supported by WikiProject Computer science (marked as Mid-importance).
Taskforce icon
This article is supported by Computer hardware task force (marked as Mid-importance).
WikiProject Keywords
This article is within the scope of WikiProject Keywords, a collaborative effort to improve the coverage of Keywords on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.

Useful piece of information[edit]

User and kernel mode switching

"When a transition between user mode and kernel mode is required in an operating system, a context switch is not necessary; a mode transition is not by itself a context switch. However, depending on the operating system, a context switch may also take place at this time." A mode transition is not a context, but the context switch is made anyway?

Statistical data[edit]

statistical data seems to be missing? -- paniq

Do you mean typical context switch latency, or something else? Patrik Hägglund 17:37, 21 June 2006 (UTC)
It would be useful to have an answer to the question "how many context switches does a modern CPU perform per second", e.g. vmstat on a dual 2 CPU Pentium 4 300Ghz server system with a network filesystem runs at up to 14257 context switches per second, while my mostly unloaded desktop system does 500 to 1200 context switches per second. It would also be useful to know how many context switches a CPU can do if it is doing very little else. My desktop says this for vmstat:
$ vmstat 3 30
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 1  0  41012  72748  80508 1074072    0    0    10    12   24   18  6  1 93  0
 0  0  41012  72400  80516 1074104    0    0     0    23  494  786  6  1 93  0
 1  0  41012  72384  80524 1074104    0    0     0    20  524  871 36  1 63  0
 1  0  41012  71812  80564 1074332    0    0    83    51  545 1227 16  2 82  0
 0  0  41012  71964  80576 1074480    0    0    43    33  531  940 13  2 85  0
 0  0  41012  71856  80584 1074472    0    0     0    37  538  983 12  1 87  0
 0  0  41012  71980  80584 1074480    0    0     0     0  566 1130 14  2 84  0 (talk) —Preceding undated comment was added at 11:11, 10 November 2008 (UTC).


I removed:

The ELF Interface is one such architecture. A distinct advantage to Human users of unix-like systems is an override cabability inherent in the interfaces: Stdin, Stdout and Stderr, which are nearly always accesable to both root users and normal users.

What does ELF have to do with context switching? The discussion of stdin / stdout / stderr that follows doesn't make any sense, either. Neilc 01:10, 24 July 2005 (UTC)

Interrupt handling[edit]

"Clearly, there is a necessity to switch contexts when issuing interrupts: so that the interrupt handler can be executed, the state of the currently running process must be suspended."

This needs an explanation. The article gives the impression that all interrupts results in a context swith. This is not consistent with my understanding of interrupts. Rather it should depend on the type of the interrupt and the interrupt handling framework (the OS). Do you say that a context switch occurs when you use a DOS interrupt call? If that is the case, what's the difference between such a call and a normal function call?

--Patrik Hägglund 18:15, 21 June 2006 (UTC)

Operator context switching?[edit]

What about the concept of user context switching? As in "the PSP is crap because it forces the programmer to context switch too often"? Does this usage deserve a mention? Sam Wilson 00:48, 24 July 2006 (UTC)

Task Gate[edit]

Is a task gate the same thing as a Barrier_(computer_science)? Mateja 01:11, 13 November 2006 (UTC)

Max switchframes and contexts[edit]

Is there a limit to number of switchframes and contexts maintained by a CPU? Are there examples for Xeon, Opteron, Itanium, Pentium?

Expansion on types of context switches[edit]

What are the differences between register, task, thread and process context switches? what are the relative time penalty? when are they used?

Section "Within psychology"[edit]

I removed the stub-section "Within psychology" containing the text

Task switching a method used to assess executive control of cognition

Is there anything on Wikipedia about context switching in terms of psychology? If there is, I can't find it; if the concept is actually used in psychology, there should be a link to a relevant page. -Shai-kun 04:27, 5 June 2007 (UTC)

user and kernal mode[edit]

user & kernal mode of switching interaction between process and OS —Preceding unsigned comment added by (talk) 08:38, 25 January 2008 (UTC)


"Task switching" re-directs here, but it should re-direct to "Task Switching (psychology)", whose primary title is actually "task switching". The psychology article should have an "Other uses" blurb at the top that re-directs here. The top 2 results on Google direct to Psychology articles, indicating that the psychology usage is more prevalent-- though the first two pages show roughly a 50/50 split, so it's pretty close. Still, since the psychology article is actually labeled "task switching" and this one is "context switching", i think it makes more sense to have the psychology article as the default. — Preceding unsigned comment added by (talk) 22:55, 18 July 2011 (UTC)

Just for the record, Task switching (psychology) is there now, as is a dab page. History2007 (talk) 18:11, 1 December 2011 (UTC)


I suggest merging the stubs process switching latency and thread switching latency into context switch. My understanding is that these latencies never occur without a context switch. Perhaps a single encyclopedia article could easily cover all of them. --DavidCary (talk) 06:00, 28 April 2012 (UTC)

Totally agreed, those two articles should be merged here. — Dsimic (talk | contribs) 23:30, 10 February 2014 (UTC)
Done--Diaa abdelmoneim (talk) 11:25, 22 November 2014 (UTC)
@Diaa abdelmoneim: "Merge" does not mean "replace the articles with a redirect", it means the content of the original articles needs to be integrated into the target article. But as it stands, this article doesn't talk about switching latency at all apart from "requires a certain amount of time for doing the administration". -- intgr [talk] 12:28, 22 November 2014 (UTC)
The other articles had no references and the information in them does not surpass that of "requires a certain amount of time". Furthermore can't find a reliable reference that mentions the terms "Process switching latency" or "Thread switching latency". I didn't find anything useful to add from those articles and therefore redirected them to context switch... --Diaa abdelmoneim (talk) 13:42, 22 November 2014 (UTC)
@Diaa abdelmoneim: You are right, I am sorry, I was too quick with my revert button. A more thorough read reveals not much merge-worthy. But I wrote a new section "Performance" to the article. -- intgr [talk] 15:03, 22 November 2014 (UTC)

Context switching in human cognition[edit]

@David Latapie: In response to this edit: while the concepts are superficially similar, they're from different fields and I think it would only confuse matters to cover them in a single article. I've converted it to a hatnote. Maybe human context switching would work as a section in human multitasking or a separate article, if you're interested in working on that. -- intgr [talk] 22:26, 16 March 2016 (UTC)