Previous | Next --- Slide 31 of 79
Back to Lecture Thumbnails
kayvonf

Question: This is a good opportunity for someone who has taken an OS class to summarize all the things an OS needed to do to swap a thread back onto a processor during a context switch.

bojianh

Context switch (If I rmb correctly)

  1. Called from kernel scheduler

  2. Set %cr3 to point to the new page directory => Result in TLB flush

  3. Push all existing registers onto the kernel stack

  4. Switch kernel stack to the new kernel's process by changing %esp

  5. Return from context switch as the new function

[Note %eip is not changed because there is only one source of context switch]