Search code examples
linuxwindowsoperating-system

Process Control Block (PCB) in Windows and Linux


I need to know about the data stored in Windows' Process Control Block (PCB) as well as Linux PCB. I searched the web but unfortunately I couldn't find what I was looking for. Most of links do not specify what is exactly inside the structure, they only mention the general information which must be stored in a PCB data structure. What I need is the code of both PCB structures with perhaps some documentation/explanation about their fields.


Solution

  • For Windows, you can use Windows API to achieve this:

    NTSTATUS WINAPI NtQueryInformationProcess(
      _In_       HANDLE ProcessHandle,
      _In_       PROCESSINFOCLASS ProcessInformationClass,
      _Out_      PVOID ProcessInformation,
      _In_       ULONG ProcessInformationLength,
      _Out_opt_  PULONG ReturnLength
    

    A detailed explanation can be found here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684280(v=vs.85).aspx

    Linux is an open-source OS, so we have more choices for achieving this, depends upon the way you want to do, e.g. reading its source code or by programming API.