Search code examples
multithreadingprocessoperating-systemfreebsdnetbsd

Where is TCB located on FreeBSD?


Where is the kernel thread control block (TCB) located On FreeBSD? (After the thread is interrupted, where is the context (containing %RIP/%EIP) saved?) Is it on the kernel stack or somewhere else?

In FreeBSD, are process and thread quite similar, like on Linux, or totally different abstractions?


Solution

  • Is this a homework or something?

    In general, if you need this information you know where to find it.

    However, in case this is for school: 1) process vs thread relation is immediately apparent if you actually look at the sources, including struct thread definition 2) you can start digging with from code which switches contexts. there is a standard syscall which allows giving up execution - sys_yield, you can use it as your starting point.

    All this can be found in few minutes.