Scheduling without Timeslice...
joel.sherrill at OARcorp.com
Mon Dec 1 13:51:07 UTC 2003
Camilo Alejandro Arboleda wrote:
> There is a thread in the mailing list talking about the issue
> The problem is that the timeslice is reset every time a task is
> preempted. That way your first idle task never gets out of CPU time. The
> solution is using a timeslice exhaustion scheme (like Posix one).
> Joel Sherrill filled a BR (#514) and created a working patch. It has a
> small typo in taskcreate.c, but you'll see it easily.
> cedric_aubert at yahoo.fr wrote:
>> Hi all,
>> I have found some trouble with the scheduler without
>> First thing (it's just a question not a trouble), in
>> the file
>> "/c/src/lib/libbsp/shared/bsplibc.c", I have found
>> that we initialize
>> the libc in reentrant only if we have
>> ticks_per_timeslice > 0.
>> But with preemption, we could have some need of
>> reentrant without
>> timeslicing. Am I wrong ?
No. You are right.
This is an old configuration hack to be able to dynamically turn
libc reentrancy on and off. I doubt that this is useful anymore
and probably should be killed. It is better to just always have
If we want the ability to turn it off without recompiling the
BSP, then there should be another mechanism.
>> void bsp_libc_init(...)
>> if ( BSP_Configuration.ticks_per_timeslice > 0 )
>> libc_init(1); /* reentrant if
>> possible */
>> libc_init(0); /* non-reentrant
>> Second thing, in the thread idle. This thread is at
>> prio 255 (lower). I have
>> build another thread (user task) with prio 255 too.
>> But this task never been
>> executed, it was always in READY State but don't
>> start, in fact, I think,
>> the idle thread was
>> executing first and never give cpu usage to the user
>> task ( because no
>> timeslice ).
>> Am I right ? Should have some task with the same prio
>> that the idle one ?
Don't do that. It will never run. IDLE is a special
task that is always busy.
>> I try to grow a little the user task and that's works.
>> Thanks a lot
>> Do you Yahoo!?
>> Free Pop-Up Blocker - Get it now
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users