Page 1 of 1
One scheduler question
Posted: Sun Feb 25, 2007 3:50 pm
by frank
Right now my scheduler is just round-robin. I keep intending to add priorities to it but there are some little details that confuse me:
1. Do higher priority tasks get a bigger or smaller quanta?
2. How do you prevent task starvation?
3. Should you always let a task use it's full quanta, or should you interrupt it if another task is waiting?
Thanks,
Frank
Re: One scheduler question
Posted: Sun Feb 25, 2007 6:28 pm
by AndrewAPrice
frank wrote:Right now my scheduler is just round-robin. I keep intending to add priorities to it but there are some little details that confuse me:
1. Do higher priority tasks get a bigger or smaller quanta?
2. How do you prevent task starvation?
3. Should you always let a task use it's full quanta, or should you interrupt it if another task is waiting?
Thanks,
Frank
1. I give higher priority tasks longer quanta.
2. Do some research..
3. Most of the programs Ive written for my OS, including drivers, voluntarily pause their process's state before using their full quantam. That way, say I have 10 system processes running (for drivers, memory management, etc) and 1 CPU intensive user process, the user process will have 100% of the CPU to do it's processing unless it calls another process.
Re: One scheduler question
Posted: Sun Feb 25, 2007 8:11 pm
by m
Hi.
frank wrote:Right now my scheduler is just round-robin. I keep intending to add priorities to it but there are some little details that confuse me:
1. Do higher priority tasks get a bigger or smaller quanta?
2. How do you prevent task starvation?
3. Should you always let a task use it's full quanta, or should you interrupt it if another task is waiting?
Thanks,
Frank
1.I'm not quite sure about this...Maybe it depends.
2.A general method is that the system shouldn't let some fixed,certain processes always be at high priorities and all the priorities should be adjusted dynamically according to some statistic.For example,if a high-priority process has run for some time,then when it comes to its next time piece end,it should be put in a queue for less-priority processes,and vice versa(i.e. consider raising the priorities of some processes which have been low-priority for some time already).
3.It's up to cases...For example,an interrupt suddenly responds to a high-priority process when a low-priority process is executing ,maybe you can consider about pause the current low-priority process and put it in a queue and resume the interrupt handler.But if the situation is on the contrary,you may want to just ignore the interrupt.
Hope that can help!
Posted: Sun Feb 25, 2007 9:11 pm
by frank
Thanks everybody, I was only really confused about #1. I feel higher priority tasks should have a longer quanta because they are just going to give up most of it anyway. For #2, I think I am going to save a last_ran time and when it goes above a certain threshold the task gets bumped up in the list.
Posted: Mon Feb 26, 2007 5:58 am
by AndrewAPrice
frank wrote:WHY DOESN'T THIS WORK!!!!
Whoops I forgot to press the power button.
.......................
Posted: Mon Feb 26, 2007 10:20 am
by frank
MessiahAndrw wrote:frank wrote:WHY DOESN'T THIS WORK!!!!
Whoops I forgot to press the power button.
.......................
Just a joke for the non-computer literate people in the world. Hasn't happened to me yet.