[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 362
  • Last Modified:

Process priorities question

Hi ,
   I want to propose you a small challenge for 200 points,it's a theoric question.
I want the unix law who permits to determine processes priority.

         good luck;-)
1 Solution
AFAIK , process priority="nice" value under HP-UX (as shown by ps -l) and processing time is equally distributed among processes with the same nice value (by default, every process gets the same priority)

Solaris is more sophisticated, splitting processes into 4 classes: system, real-time, time-sharing & interactive, each with its own scheduling policy. man priocntl explains this in detail!
Sounds suspiciously like a homework problem, but I'll bite anyway...

As tfewster aluded to, most modern commercial Unix flavors have multiple process classes with their own scheduling priorities.  However, within each class, things operate very similarly to the traditional mechanisms as described in the Bach and Leffer et. al books.

This is from Leffer, McKusick, Quarterman, and Karels' _The Design and Implementation of the 4.3 BSD Operating System_

    "A process's scheduling priority is directly determined by two values contained in the proc structure: p_cpu and p_nice.  The value of p_cpu provides an estimate of the recent CPU utilization of the process.  The value of p_nice is a user-settable weighting factor that ranges numerically between 020 and 20.  The normal value for p_nice is 0.  Negative values increase a processes' priority, whereas positive values decrease its priority.
    A process's user-mode scheduling priority is caluculated every four clock ticks (40 milliseconds on a VAX) by this equasion
        p_usrpri = PUSER = (p_cpu / 4) + 2 * p_nice
    Values greater than 127 are clamped to 127.  This calculation causes the priority to decrease linearly based on recent CPU utilization.  The user-controllable p_nice parameter acts as a limited weighting factor.  Negative values retard the effect of heavy CPU utilization by offsetting the additive term containing p_cpu.  Otherwise, if one ignores the second ter, p_nice shifts the priority by a constant factor.
    The CPU utilization, p_cpu is incremented each time the system clock ticks and the process is found to be executing.  In addition, p_cpu is adjusted once per second using a digital decay filter.  The decay causes abput 90 percent of the CPU usage accumulated in a 1-second interval to be forgotton over a period of time that is dependent on the system load average.  To be exact, p_cpu is adjusted according to
where the load is a sampled average of the length of the run queue over the previous 1-minute interval of the system operation."


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now