Is context switch a O(1) process or the context switch quantum is dependent on various local factors that can affect the time taken for it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, for many different reasons. The main one being that switching context between two threads of a same process, and switching context between two threads of different process imply an address-space change. Changing the address-space is always a costly operation for the caches and memory. On x86 you will need to reload the Page Directory, on PowperPC you will need to invalidate and reload the TLB, …
Changing address-space is not mandatory when going from a thread to the kernel. Just to remaind, I think Linux has always the kernel address-space loaded (using the PAE facility and having an entry of the 4-entry PDBR locked with the kernel address-space, starting at the AS higher halves, at 0xc0000000).