context

发布时间 2023-08-29 19:15:18作者: fndefbwefsowpvqfx

By providing an abstraction of the current execution state in the current thread, including:

  • the stack (with local variables)
  • stack pointer
  • all registers
  • CPU flags
  • the instruction pointer

a execution context represents a specific point in the application's execution path.

A context switch between threads requires system calls (involving the OS kernel),
which can cost more than thousand CPU cycles on x86 CPUs.
By contrast, transferring control vias callcc()/continuation requires
only few CPU cycles because it does not involve system calls as it is done within a single thread.