This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nice really nice?


Robert Collins <rbcollins@cygwin.com> wrote:

> Windows has (offhand) ~ 30 scheduling levels. It has priority classes,
> which 'group' processes, and then relative priorities within each
> class.IIRC you can check sched,cc via CVS to see the actual mapping I
> used, it's not linear as such, but nearly so.

I looked through sched.cc and i see that you use the UNIX priorities -14
to +14 to map them to 15 different windows priorities on a more or less
linear scale, like you already said. Now i found these windows
priorities defined in winbase.h and i'm a bit confused:

#define THREAD_PRIORITY_ABOVE_NORMAL 1
#define THREAD_PRIORITY_BELOW_NORMAL (-1)
#define THREAD_PRIORITY_HIGHEST 2
#define THREAD_PRIORITY_IDLE (-15)
#define THREAD_PRIORITY_LOWEST (-2)
#define THREAD_PRIORITY_NORMAL 0
#define THREAD_PRIORITY_TIME_CRITICAL 15

Where do the -15 and +15 come from and what do they actually map to?
Also THREAD_PRIORITY_TIME_CRITICAL is not mapped in sched.cc to any UNIX
priority so if an application calls

SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS)
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)

what happens actually? As you already say in sched.cc: "We don't want
process's going realtime" i guess it doesn't run at -20 but some other
priority.

>  those tests show nothing other than the time it takes to push the iso
> through to a bitbucket. Unless there is serious other load on the CPU,
> the time *should* be constant.

I've run the test many times and they all give the same result,
switching from nice -0 to nice --1 always gives a horrible delay, the
cpu is not doing any other work at all during the test. But this seems
to be an application specific problem and we're still investigating
this.

While i was writing this i had the idea to do the same test with cat
instead of mkisofs with a quite interesting result:

$ time cat test.iso | nice -1 dd of=/dev/null
real    0m7.171s
user    0m2.466s
sys     0m4.733s

$ time cat test.iso | nice -0 dd of=/dev/null
real    0m7.205s
user    0m2.794s
sys     0m4.467s

$ time cat test.iso | nice --1 dd of=/dev/null
real    1m51.428s
user    0m0.107s
sys     0m0.015s


I've briefly looked through the pre-1.3x sources and i can't find
sched.cc there or sth. of the like, how was it handled back then?

thomas


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]