Reputation: 6065
When I call pthread_yield
or pthread_block
and the CPU does a context switch
Is the program counter stored in the thread stack (alongside its temporary registers) or in the thread control block (alongside the stack pointer)
Upvotes: 1
Views: 2617
Reputation: 61
Quoting from VxWorks:APPLICATION PROGRAMMER’S GUIDE,page 76:
Each task has its own context, which is the CPU environment and system resources that the task sees each time it is scheduled to run by the kernel. On a context switch, a task’s context is saved in the task control block(TCB).
A task’s context includes:
■a thread of execution; that is, the task’s program counter
■the tasks’ virtual memory context (if process support is included)
■the CPU registers and (optionally) coprocessor registers stacks for dynamic variables and function calls
■I/O assignments for standard input, output, and error
■a delay timer
■a time-slice timer
■kernel control structures
■signal handlers
■task variables
■error status (errno)
■debugging and performance monitoring values
Upvotes: 0
Reputation: 381
Usually it shall be in the TCB. But I beleive it is implementation specific. An example of information contained within a TCB is:
Upvotes: 4