Search code examples
linuxprocesslinux-kernellinux-device-driverkernel-module

What are nivcsw and nvcsw fields in task_struct?


I am studying about processes in Linux. I have a task to find some fields of PCB for a given process id in a kernel module. I found this link about task_struct and I almost did the task, but I still don't know what are the fields nivcsw and nvcsw. What do they store?


Solution

  • Both nvcsw and nivcsw are context switch counters. The first one represents the number of voluntary context switches (Number of Voluntary Context Switches) while the second represents the number of involuntary context switches (Number of InVoluntary Context Switches).