Operating Systems Process Assignment: notnice

Assigned September 13, 2006

To exercise our understanding of:

  1. the process control block,
  2. system calls, and
  3. kernel structure and coding,
we will add a new system call to the linux operating system. The command is called notnice, and it is like nice in that it lowers or raises the scheduling priority of a tast (thread). Unlike nice, which can only modify it's own priority, notnice can modify any task's priority. Which can be a not nice thing to do.
   notnice pid prioriy
See man 2 nice for a description of the nice command. See also man 2 kill. Also look for sys_nice and sys_kill in the kernel sources, for help.

Note: FreeBSD users, man 3 nice.

Step One

Add the notnice system call by modifying arch/i386/kernel/entry.S. Find a suitable place to add the code for sys_notnice, and add code simply to return the priority of the current process, see include/linux/sched.h#task_struct. Figure out how to call it from a user program. Test.

Do this in the first week (due wednesday 20) and submit diffs for the code (see man diff).

Step Two

Now return the priority of a process other than the current process, according to the pid parameter.

Step Three

Now modify the prioriy of a process other than the current process, completing the assignment.

Have steps two and three done by the end of the second week of the assignment. Submit diffs and the output of appropriate ps commands as proof of success.