Link Search Menu Expand Document


Every process is associated with a process control block (PCB), containing all the information needed to manange the process at runtime. In Pintos (as in most operating systems with multithreaded user processes), each thread within a process also owns a data structure known as a Thread Control Block (TCB), which contains information relevant to that thread in particular, including its name, priority, and stack pointer. Any information which is relevant to all threads in the process (e.g. the page directory or name of the process) is instead contained in the PCB. Finally, note that the kernel associates with each user thread exactly one kernel thread to manage privileged operations relevant to the thread.

In Pintos, the TCB of a thread is stored within the same page as the thread’s stack, at the bottom of the page. This is possible because each thread has its own stack; since there is no stack owned exclusively by the process (and not by any of its child threads), the PCB instead must be stored in the process’ heap via malloc, where all of its child threads can access it via pointer.

A barebones definition of the PCB can be found in the file userprog/process.c. You will likely find it necessary to extend this definition in the course of completing the projects.

Table of contents