Re: how long does a single context switch take ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Elad,

On 10/23/07, Elad Lahav <elad_lahav@xxxxxxxxxxxxxxxxxxxxx> wrote:
> What do you mean by a context switch?
> There are several terms that are sometimes confused with a context switch:
> 1. Mode switch: The switch between user mode and kernel mode that occurs,
> for example, at the beginning and end of a system call
> 2. Address-space switch: Before a thread becomes active, it needs its
> address space to be set as the current one (if it not already is). On the
> x86, this happens by setting the cr3 register and flushing the TLB.
> 3. The classic, OS course, context switch: This signifies the switch between
> two processes, and may include multilple mode switches and an address-space
> switch.

Thank you for this elaborate clarification. I was indeed interested in #3,
although #1 and #2 are also interesting.

> I'm not sure there is an easy way to measure #3, as it probably varies
> considerably depending on the scenario. The same goes for #2, as the cost
> of TLB flushes cannot be determined a-priori, and depends on how many TLB
> faults result from the switch.

But is there a rough estimation of their cost ? tens of microseconds ? hundreds
of microseconds ? several miliseconds ? I do not want accurate numbers.
I just want to understand and to have a good hunch..

> As for #1, this is more manageable. I have taken some measurements in the
> past by comparing a calculation that is performed entirely in user space,
> vs. the same computation alternating between modes.

Do you roughly remember the results ?

Thank you so much
naziir

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux