The Process Control Block

download The Process Control Block

of 1

Transcript of The Process Control Block

  • 8/16/2019 The Process Control Block

    1/1

    The process control block (PCB)

    When a process gives up the processor when an interrupt occurs, the OS saves or maintains the

     process details or information within the system in a data structure called a PCB so that later,

    execution would resume from exactly the same place when process execution was interrupted.

    PCB contains the following information

    Process I !uni"ue process identifier#• Current process state !ready, running, $loc%ed !suspended##

    • &o$ priority or other scheduling information

    • Program counter 

    • 'egister save area, where the current contents of all registers are saved $efore they are ta%en

    over $y the next process

    • ( pointer to the processor)s allocated memory area

    • Pointers to other allocated resources !open files, dis%, printer etc.#

    • CP* time used so far 

    • +stimated time to completion

    • in%s to other PCBs

    -hreads

    • ( thread is a lightweight su$process

    • ( thread is a path of execution within a process

    • ( process can have one or more processes

    • +ach thread has a scheduling state !ready, running or $loc%ed#

    • (ll threads in a process share most of their environment

    • -hreads from the same process have the same virtual address space for instructions and glo$al

    varia$les, $ut they have their own local varia$les, program counter, registers and stac% pointer 

    • +ach thread has its own thread control $loc% !-CB#

    • -he PCB holds references to one or more -CBs

    • -his means less main memory is used and it re"uires less wor% to create or delete threads than

    separate processes $ecause threads share virtual address space

    • ( good programmer must design the program in such a way that all threads can run

    concurrently without interfering with each other