15

A process control block (PCB) and a Thread Control Block (TCB) are both used in linux kernels to have time on the CPU delegated to them. What are the difference between the two?

What information is generally maintained in a process control bloc (PCB)?

4
  • 1
    Seems like this answer depends highly on the OS version. Care to edit the question and ask for a Linux answer to get more specific?
    – Gray
    Feb 29, 2012 at 15:12
  • I made the change above. Thanks! Feb 29, 2012 at 18:24
  • 2
    Why not go look at the actual definitions? It's all open source, and lots of people hack on the Linux kernel, so it should be pretty easy to get into and figure out. Feb 29, 2012 at 20:39
  • I actually don't even know where to go to get into the actual Linux kernal. I actually like your comment, I am always a fan of learning how to find my own answers. Feb 29, 2012 at 22:25

3 Answers 3

18

Some notable fields that the PCB could contain are the process id, process group id, the parent process and child processes, the heap pointer, program counter, scheduling state (running, ready, blocked), permissions (what system resources the process is allowed to access), content of the general purpose registers, and open files.

TCB has a few of the same fields as the PCB (register values, stack pointer, program counter, scheduling state), in addition to a few specific values like the thread id and a pointer to the process that contains that thread. Note that there is not protection between threads.

In Linux there is a struct task_struct that stores information about a thread or process. It is declared in sched.h.

5

'A process control block (PCB) and a Thread Control Block (TCB) are both used in kernels to have time on the CPU delegated to them' - not normally, no. A PCB will have one or more TCB's linked to it. The TCB describes an execution context, (eg. stack pointer), the PCB an environment context, (eg. memory segments and permissions).

1
  • Thanks, this makes sense to me, where can I find more info on this? (your sources, maybe)
    – onlycparra
    Mar 11, 2019 at 20:36
3

The PCB stores information about the kernel process. Like adressspaces etc...

A process can include different kernel threads. Both are managed by the dispatcher and scheduler.

The TCB includes thread specific information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.