context

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.

posted @ 2023-08-29 19:10  fndefbwefsowpvqfx  阅读(12)  评论(0编辑  收藏  举报