Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The nice command on Linux and Unix can be used by non-root users to set a nice v

ID: 3854987 • Letter: T

Question

The nice command on Linux and Unix can be used by non-root users to set a nice value for a process that is positive or 0, but only root (or users with the proper permission) can set a nice value that is negative. Which of the following explanations is the right one?

Regular users can abuse the nice command and could assign a high priority (and more CPU time) to a process possibly in detriment to system tasks.

The nice value is an increment to the time slice for all other processes. If negative, it increases the response time for most processes on the OS, which can slow down the UI and interactive applications.

Explanation / Answer

Let us look into each option and explore what is wrong or wright in the statement.

The nice value is an increment to the time slice for all other processes. If negative, it increases the response time for most processes on the OS, which can slow down the UI and interactive applications.

(CORRECT STATEMENT)

Explanation:

The range nice command uses is -20 (most favorable to the process) to 19(least favorable to the process)

So a process having -20 nice value will be preferred more by the cpu than a process with nice value -19.

It is not that negative nice value will give access rights to OS resources. It just during round robin of CPU time the process with larger negative nice value (eg. -20) will get more CPU time slots as compared to process with smaller negative nice value (eg. -19).

But if many processes are set to have high nice values, i.e. nice values in negative, then those processes will take up most of the CPU time thereby slowing down other UI’s including the unix terminal and other applications.

The nice field in the kernel task structure is unsigned int and cannot accept negative values.

(WRONG STATEMENT)

Explanation: As told earlier, the range nice command uses is -20 (most favorable to the process) to 19 (least favorable to the process).

A negative nice value gives a process extended access rights to OS resources, equivalent to a switch to kernel mode. This is dangerous if available to regular users.

(WRONG STATEMENT)

Explanation: Nice command only determines how often CPU time will be given to a processes during CPU time round robin. Negative value of nice does not meant that It gives extended access to OS resources, it means a process will get more time slot than the others with smaller negative value, which means the process with higher negative value will be executed faster than the other process with smaller negative value as the cpu is giving more time to the process with higher nice value.

Hope your question has been resloved.Please do not forget to give a positive like to the answer.Thank you.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote