About Process Control Block in Os

Process Context vs Process Control Block

What you are describing is largely system dependent. Usually when one talks about the Process Context [Block], one is referring to the hardware state of the process. In other words, a memory location for saving the values of the hardware registers that are limited in scope to a single process.

A Process Control Block (or equivalent) can be anything the operating system wants it to be. It could include, for example, the user name and process quotas. If we presume that the process control block contains everything the operating system maintains about the process, it would either contain the Process Context Block or have a link to it.

Adding to the confusion here is the acronym PCB. At least in ye olde days, PCB referred to the hardware Process Context Block. Apparently some textbooks are using the same abbreviation to refer to the software Process Control Block (as does one particularly poor textbook on Operating Systems that causes so much confusion and questions on this board).

Further adding to the confusion, no system that I have worked on has a Process Control Block as described in such textbooks and Wikipedia. I suspect that this concept is the creation of textbook writers to describe the various data structures an operating system uses to manage a process collectively.

Also, how is the PCB affected during a context switch (if at all)?

If you are referring to the hardware Process Context Block, before switching out the operating system executes a SAVE PROCESS CONTEXT (or equivalent) instruction that saves the process's hardware registers to a block of memory. Some processors require multiple instructions to do this. The OS then executes a LOAD PROCESS CONTEXT instruction that reads from another Process Context Block and loads saved registers from another process. As soon a such an instruction executes, the process has been switched.

As to what may be saved in the theoretical Process Control Block, that could be anything the operating system wants. E.g., statistical information. If the Hardware PCB is part of the Software Process Control Block, the paragraph above is part of your answer.

What exactly is a process boundary?

That's a loaded question because there are, in fact multiple boundaries for a process.

From a memory perspective, in user mode, one could say a process's boundary is its user mode address space.

That changes when the process changes modes. When it goes into Kernel Mode, the process effectively has no boundaries. It can directly access the process address space and the shared system address space but it can also access the address spaces of other processes (at least indirectly).

From a disk perspectives, one could say a process's boundary is that imposed by the file system.

How is the Address Space (of a process) and Process Control Block (PCB) are related in Operating System?

Process Address space refer to memory regions the process is using. It typically consists of heap, stack, initialized data, uninitialized data and text. There are mainly two address spaces of a process -- logical and physical.
The PCB is a structure resides in kernel to track the state of process. One of the things PCB contain is memory information. In a typically system, PCB may contain information about pages the process has.
To answer your question, Process Address space is an idea built on top of PCB and many other things (such as page table).

Process control block vs process table?

A process control block (pcb) contains information about the process, I.e. registers, quantum, priority, etc.

The process table is an array of pcb's.

Process Control Block

From what I understand in Linux, PCB or Process Descriptors are dynamically allocated by the kernel and cannot directly be read from user-space.

IBM's developerWorks library has a nice article which shows you how to create a kernel module for Linux and access task_struct struct.

http://www.ibm.com/developerworks/linux/library/l-linux-process-management/index.html

Hope this helps.


edit: task_struct as defined in Linux v2.6.37 : http://lxr.linux.no/#linux+v2.6.37/include/linux/sched.h#L1182

Courtesy of google. :)



Related Topics



Leave a reply



Submit