Talk:Context switch

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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)[reply]
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

41.244.45.37 (talk) —Preceding undated comment was added at 11:11, 10 November 2008 (UTC).[reply]

ELF?[edit]

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)[reply]

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)[reply]

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)[reply]

Task Gate[edit]

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

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)[reply]

user and kernal mode[edit]

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

Redirect[edit]

"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 168.7.237.143 (talk) 22:55, 18 July 2011 (UTC)[reply]

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

merge[edit]

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)[reply]

Totally agreed, those two articles should be merged here. — Dsimic (talk | contribs) 23:30, 10 February 2014 (UTC)[reply]
Done--Diaa abdelmoneim (talk) 11:25, 22 November 2014 (UTC)[reply]
@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)[reply]
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)[reply]
@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)[reply]

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)[reply]


Define Execution Context[edit]

The definition of the components of an execution context would be helpful to have in this article. That might mean just using that term instead of "state" in a few places. Otherwise, it's a technical term that few novices to the field seeking to learn about a Context Switch will understand. Could execution context have it's own article? SamaelBeThouMyAlly (talk) 13:59, 12 September 2017 (UTC)[reply]

A Commons file used on this page has been nominated for deletion[edit]

The following Wikimedia Commons file used on this page has been nominated for deletion:

Participate in the deletion discussion at the nomination page. —Community Tech bot (talk) 17:36, 21 September 2018 (UTC)[reply]

Incomprehensible?[edit]

This article has the Incomprehensible template applied.

It's not obvious to me whether this is appropriate. Maybe Technical would be more appropriate, but as a relative outsider (no formal CS background) I actually still find this reasonably readable.

Flinker123 (talk) 08:07, 13 July 2021 (UTC)[reply]

Definition and steps[edit]

Surely a context switch includes not only saving the context of the current thread or process, but also restoring the context of a different thread or context. --Shmuel (Seymour J.) Metz Username:Chatul (talk) 11:48, 11 May 2022 (UTC)[reply]

Example[edit]

"causing the program to wait and a wait for function call to the released setting the current statement to go to sleep and wait for the syscall to wake it up. To maintain concurrency however the program needs to re-execute the new value and the sleeping process together again."

This sentences are not easy to understand. They contain many concationations with and: "to wait, and a wait, ... and wait" Additionally it sounds wrong. CPUs usually do no execute "values". They execute instructions.

In the sentence: "[...] a wait for function call to the released setting" I think "the" should be replaced with "be". -> to be released --95.91.241.231 (talk) 09:35, 23 July 2022 (UTC)[reply]