[Again] Help: RTEMS Threads, Preemptation and Time slicing...
Alex
kbyte at iol.pt
Sat Oct 30 08:55:19 UTC 2004
Thank you to all of you, but let me explain better what I want:
I know that my sample code is "dummy", but no problem, what I want is to make some threading tests to rtems for i386 arch, so, sometimes, the "dummy" projects are the best to test the real capabilities of the systems, right?, because, if people always write fine and objective programs we never test the system in other (dumies, may be :-) ) conditions.
So, what I want it to have one thread running (like the "dummy" for cicle I wrote) and I wat to see the other thread, executing the same dummy code, to enter in the cpu DUE to time slicing. I dont want to use bloking instructions like sleeps, "wait for single object" and somethings like these.
I already tested the rtems threads with this kind of blocking instructions and the systems work fine, but now I want to see thread switching between threads with same priority, due to time slicing.
In my sample program, I think I turned off preemptation and I turned on the time slicing right? But the system doesnt switch between the threads...
Is this a rtems scheduler bug?
Is this a bug in my code? (I thing it is, but where?)
I am a beginner in rtems and I need help from you...
Thanks once again...
Alex
----- Mensagem Original -----
De: Joel Sherrill joelOARcorpcom <joel.sherrill at OARcorp.com>
Data: Quinta-Feira, 28 de Outubro de 2004, 12:24
Assunto: Re: Help: RTEMS Threads, Preemptation and Time slicing...
> Ian Caddy wrote:
> > 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 find that often people have threads that either execute much quicker
> then the timeslicing quantum or have no scheduling points so
> unless
> timeslicing is enabled, there is no switching.
>
> Unless you configure the system differently, the timeslice quantum
> is 10
> milliseconds which is a LOT of CPU cycles on most modern CPUs.
>
> Tasking Design Rule: Find ways for your tasks to naturally block
> so they
> spent most of their life blocked.
>
> --joel
>
> > I hope this helps.
> >
> > regards,
> >
> > 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?
> >>
> >>
>
>
> --
> 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
>
>
________________________________________________________________________________
A protecção do e-mail contra vírus é cada vez mais necessária!
Proteja a sua Caixa de Correio: http://www.iol.pt/correio/rodape.php?dst=0409301
More information about the users
mailing list