Could you suggest some relevant tests for CPU time necessary for temporarily changing thread priority?? (links or figures)
Thank you
Could you suggest some relevant tests for CPU time necessary for temporarily changing thread priority?? (links or figures)
Thank you
It's a system call, so it is not just a couple of instructions. The actual code to change the priority of is a simple pointer-to-structure update, with some checking around it. I'd say that on a reasonably modern processor, less than a microsecond for sure.
However, I'd question the validity of (often) switching thread priority - perhaps it should always be the higher priority then?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
So, what you are saying is that you are not actually changing the priority very often, but you want to change it when you take the mutex? And how often does that ACTUALLY happen? Once an hour, once every five seconds, or some other number?
--
Mas
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
the Linux I am using is embedded with LinuxThreads instead of NPTL (unfortunately!!)
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
i am talking of SCHED_FF or SCHED_RR threads
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Right. So I'm still 90% sure that having different priorities is the WRONG solution.
I bet one of your threads is really CPU intensive, another is IO-intensive, and the third one is just doing some other random things. This sort of scheme generally fails when the scheduler decides to schedule the tasks in a different way than you expect them to be scheduled. The way around that is to do your own scheduling enforcement [it still doesn't prevent some random process from getting in and doing stuff, but it allows you to control which of YOUR processes runs next]. The other option is to entirely disconnect the threads from each other, such as using pipes or message passing mechanisms that are (for all intents and purposes) lock-free.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.