What are the PR (priority) and NI (nice value) columns in the `top` command output? How do these values influence the scheduling of processes by the kernel?
The PR column lists the kernel's current scheduled priority for the process. The higher the number, the less likely the kernel is to schedule the process if others need CPU time. The NI column gives a hint to the scheduler and the kernel adds the nice value to the current process to determine the next slot for the process. The higher the nice value, the nicer, we are to the other processes. If we are running a big computation on our system, we can set its nice value to a higher value, so that other processes in the background aren't harmed.
PR column lists the kernel's current schedule priority for the process, The higher the number, the less likely the kernel is to schedule the process if others need CPU time.
NI column gives a hint to the kernel's scheduler. this can try to influence the kernel's decision.
The kernel adds the nice value to the current priority to determine the next time slot for the process . when you set the nice value higher, you're being "nicer" to other processes because kernel prioritize them.