Storing and retrieving process control block

后端 未结 3 1637
广开言路
广开言路 2021-02-02 03:26

When a process is in execution, the contents of the PCB (which is in kernel memory space?) are loaded onto the CPU registers, and status registers, kernel

3条回答
  •  北荒
    北荒 (楼主)
    2021-02-02 03:59

    1. PCB : it is a Data structure which could be a part of OS or User. But as it's sensitive data structure almost everywhere PCB is a part of kernel data structure
    2. PCB is mostly stored as per-process kernel stack which is in the kernel space and kernel has access to this which is kept protected from any users.
    3. Process switching is a function of scheduler and it is kernel module. There are many scheduling algorithms to define the process switching (Long / short / medium term etc.)
    4. Now the scheduler defines which process will run next and not kernel. The function of kernel is just to provide service when invoked(system calls/interrupts/traps).
    5. As a kernel module "scheduler" has access to all kernel data structures, so it defines the sequence of process (it can be preemptive or co-operative scheduler).
    6. Every process has its PCB, so active/running process gets its PCB loaded in to CPU registers and other required sections using it's previously stored PCB (mostly) before kernel stack.

    Always keep in mind : Kernel is just like a waiter serving what is asked for, who does not know anything, doing everything like donkey work (though most important) as per told.

提交回复
热议问题