Help: RTEMS Threads, Preemptation and Time slicing...

Ian Caddy ianc at
Thu Oct 28 01:48:51 UTC 2004

Hi Alex,

If your threads are the same priority, pre-emption will not cause one of 
them to stop, as it will only pre-empt for HIGHER priority threads.

In this case, you will need to configure these threads for round-robbin 
(or timeslicing) to achieve what you are asking.

In saying that though, your system design should never, in practise, 
consist of tasks that are continuously running as no other task of a 
lower priority level will ever get to run in this sort of system.  A 
normal system design will have tasks waiting on things from other tasks, 
or if not, sleeps that allow the task to yield to lower priority tasks.

I hope this helps.


Ian Caddy

Alex wrote:
> Hi all, 
> I am making little rtems programs involving threads and the POSIX API.
> I want to create a program that launchs 2 threads via posix calls. Then I want to split the 
> processor attent to both threads, i mean, both threads must execute in "parallel" and not to
> wait one from another...
> The RTEMS manual says the scheduler look to the different taks in this order:
> Priority, preemptation (when activated) and then time slicing (when activated), right?
> So, in the rtems program I launch the 2 extra threads with equal priority, priority 1! For 
> each thread, including the main thread I turn on the preemptation and time slicing, but the
> second extra thread only starts execution when the first extra thread finishs its execution.
> I cant understand why... :-(
> Note: If I use a, for example, the sleep() instruction in the body of the thread, the processor
> is switch to the other extra thread in a good way, but if i dont use functions that transfer the
> execution to other threads, the processor is never switched to other threads... 
> Can you help me? 
> How to execute the 2 extra threads at the same time while the main thread 
> is waiting for the 2 extra threads?
> by the way, is there any way to turn on preemptation and time slicing using only posix api?

More information about the users mailing list