3.1 Process: process states, Process Control Block (PCB)

22516 Operating System MSBTE CO IT 3.1 Process: process states, Process Control Block (PCB)

             A process in computing is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system, a process may be made up of multiple threads of execution that execute instructions concurrently.


Process States: During its lifecycle, a process can be in one of the following states:

  1. New: The process is being created.
  2. Ready: The process is loaded into main memory and is waiting to execute.
  3. Running: Instructions are being executed.
  4. Blocked (or Waiting): The process is waiting for some event to occur (such as an I/O operation to complete).
  5. Terminated (or Exit): The process has finished execution.

The state of a process is typically stored in a data structure called a Process Control Block (PCB).

 

Process Control Block (PCB): A PCB is a data structure maintained by the operating system for every process. It contains various details about the process, including:

  1. Process ID: A unique identifier for the process.
  2. Process State: The current state of the process (new, ready, running, etc.).
  3. Process Priority: Information about the process's priority.
  4. CPU Registers: The values of the processor's registers.
  5. CPU Scheduling Information: Information required for scheduling the process. This may include the priority of the process, pointers to scheduling queues, and other scheduling parameters.
  6. Memory Management Information: This may include information such as the base and limit registers and page tables, depending on the memory system used by the OS.
  7. Accounting Information: This includes the amount of processor and clock time used, time limits, account numbers, job or process numbers, etc.
  8. I/O Status Information: This includes the list of I/O devices allocated to the process, a list of open files, etc.

When a process is switched out of the CPU (during a context switch), its PCB is used to save the state of the process so it can be restarted later from where it left off.


Post a Comment

Previous Post Next Post