From: Peter Olcott on 12 Apr 2010 16:19 I have four processes. One of these processes is to have higher priority than the others. The remaining three will have equal priority to each other. I want the high priority process to get about 80% of the CPU time available to the four processes, and the remaining three to share the remaining 20%. I already know about nice. http://en.wikipedia.org/wiki/Nice_(Unix) Someone told me that a process with a higher priority will almost starve any other process of a lower priority, is this true? If it is true to what extent is this true?
From: Scott Lurndal on 12 Apr 2010 16:41 "Peter Olcott" <NoSpam(a)OCR4Screen.com> writes: >I have four processes. One of these processes is to have >higher priority than the others. The remaining three will >have equal priority to each other. I want the high priority >process to get about 80% of the CPU time available to the >four processes, and the remaining three to share the >remaining 20%. > >I already know about nice. > http://en.wikipedia.org/wiki/Nice_(Unix) > >Someone told me that a process with a higher priority will >almost starve any other process of a lower priority, is this >true? If it is true to what extent is this true? Depends on the Scheduling class (SCHED_OTHER, SCHED_FIFO, SCHED_RR, etc.) man -k sched scott
From: Chris Friesen on 12 Apr 2010 16:42 On 04/12/2010 02:19 PM, Peter Olcott wrote: > I have four processes. One of these processes is to have > higher priority than the others. The remaining three will > have equal priority to each other. I want the high priority > process to get about 80% of the CPU time available to the > four processes, and the remaining three to share the > remaining 20%. There is no portable way to guarantee amounts of cpu time. On current linux you can do it (somewhat) with nice() since it provides pretty good guarantees about how relative cpu usage increases as nice levels decrease. Other Unices may provide similar guarantees, I'm not sure. If you wish stricter controls than nice() you can move to linux-specific tools like scheduler groups which allow much more control. > Someone told me that a process with a higher priority will > almost starve any other process of a lower priority, is this > true? If it is true to what extent is this true? Depends on the implementation. I don't think it is generally true on most current systems. Chris
From: Scott Lurndal on 12 Apr 2010 17:37 Chris Friesen <cbf123(a)mail.usask.ca> writes: >On 04/12/2010 02:19 PM, Peter Olcott wrote: >> I have four processes. One of these processes is to have >> higher priority than the others. The remaining three will >> have equal priority to each other. I want the high priority >> process to get about 80% of the CPU time available to the >> four processes, and the remaining three to share the >> remaining 20%. > >There is no portable way to guarantee amounts of cpu time. > >On current linux you can do it (somewhat) with nice() since it provides >pretty good guarantees about how relative cpu usage increases as nice >levels decrease. Other Unices may provide similar guarantees, I'm not sure. > >If you wish stricter controls than nice() you can move to linux-specific >tools like scheduler groups which allow much more control. Four[*] scheduler groups are defined by posix, and thus are avialable on any posix compliant system, including linux. man sched_setscheduler scott [*] Three are standard, SCHED_SPORADIC is part of the real-time profile.
From: David Schwartz on 12 Apr 2010 19:31
On Apr 12, 1:19 pm, "Peter Olcott" <NoS...(a)OCR4Screen.com> wrote: > Someone told me that a process with a higher priority will > almost starve any other process of a lower priority, is this > true? If it is true to what extent is this true? There are basically two concepts. First, the "priority" of a process is a combination of two things. First is the "static priority". That's the thing you can set with "nice". Second is the dynamic priority. A process that uses up its full timeslices has a very low dynamic priority. A process that blocks or yields will tend to have a higher dynamic priority. The process' priority for scheduling purposes is the static priority, adjusted by the dynamic priority. If a process becomes ready-to-run, it will generally pre-empt any process with a lower scheduling priority. However, if it keeps doing so, its dynamic priority will fall. (And then it will only continue to pre-empt processes with a lower static priority or processes that burn lots of CPU.) Among processes that are always ready-to-run, the old rule was to give the CPU to the highest-priority process that was ready-to-run. However, almost no modern operating system follows this rule (unless you specifically request it). They generally assign CPU time proportionately giving bigger slices to higher priority processes. DS |