Thanks all of you for your reply! Wow, I didn't expect to have so many responses in a short amount of time. Instead of replying to each of you in separate Email, I am replying to all of you in this Email. Please see my answer to some of your questions/comments: Wouter van Ooijen: do you mean that you want to run each task at 10 ms with great accuracy on that 10 ms interval? (As opposed to long-term accuracy on that interval)? Thomas: What I want to avoid is to have one task waiting for two or more tasks to finish. Jan-Erik: Per definition, a processor like the PIC's can't do more then one thing "at the same time". Thomas: Yes, I do understand that the PIC is not an Intel's HT uP! When one task is initialized few cycles after another, I consider it "at the same time". I don't think I should use this term any more because people always give me the same comments like you did. :-) Jan-Erik: Does "the last task" KNOW it have been delayed 3 ms ? Does "the last task" even CARE it have been delayed 3 ms ? If not, what's the problem ? Are "the last task" syncronized to some external event so it have to "respond" within some specific time limit (less then 3 ms) ? Thomas: The task doesn't know that it gets delayed. Anyways, I don't think it matter much now. Jan-Erik: Well, run it at a lower speed, so each task takes 2.5 ms Thomas: Why would you want to run a task at lower speed? Are so trying to fill up the idle time so that it appears efficient... to me? Jan-Erik: Now, if a task to be run "right away" (whatever *that* is ) Thomas: OK! OK! Please don't pick on every single word I use in my Email because English is not my first language. "right away" in my term, is the OS is scheduling this task and only this task to run. Is this good enough? Bertrand: What is the OS you use? Thomas: I am trying to write my own. For everyone else: Thomas: Thank you for your effort to help me! All I am looking for was to see if there is any way I can write the OS so that it spaces out the tasks to avoid having too many waiting tasks at the same time. Regards, Thomas --- Colombain Nicolas wrote: > Hi Thomas, > > > Says my program has 4 tasks. Each of them > requires > > 1ms to execute and I want to run them every 10ms. > If > > the OS initializes all tasks at the same time > (this is > > usually the case), after 10ms, all 4 tasks are > ready > > to run. Regardless of how the OS determines which > > task to run first, the last task won't be executed > > until 3ms later. This is quite inefficient > because > > for the next 6ms, the system will sit idle, doing > > nothing. > > > > Would it be better if the OS: > > - starts the first task at time 0 > > - start the second task 2ms later > > - start the third task 4ms later > > - start the fourth task 6ms later > It would be better sure :) > > > The above example is simple because the duration a > > task is known and the executing period is the > same. > > What would happen if they are all different? What > > would you do to avoid having two or more tasks > ready > > to run at the same time? > > - Let the user specify the max duration of each > task. Then compute the best > time schedule..... > or Do nothing.... > > The best arrangement can only be done by the user > depending on each task. > Perhaps an RTOS with more options can be foreseen: > - fixed task duration + time of the task > - max task duration + min > - unknow task duration > - synchronous task > - Asynchronous task > With all these informations, you can try to find the > best time schedule. > Regards, > > Nicolas > > -- > http://www.piclist.com#nomail Going offline? Don't > AutoReply us! > email listserv@mitvma.mit.edu with SET PICList > DIGEST in the body > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu