One scheduler question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

One scheduler question

Post 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
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Re: One scheduler question

Post 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.
My OS is Perception.
m
Member
Member
Posts: 67
Joined: Sat Nov 25, 2006 6:33 am
Location: PRC

Re: One scheduler question

Post 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! :)
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post 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.
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

frank wrote:WHY DOESN'T THIS WORK!!!!
Whoops I forgot to press the power button.
.......................
My OS is Perception.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post 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. :)
Post Reply