Re: Re: [Rtlinuxgpl] Interrupt Prioritization

Victor Yodaiken <[email protected]> Tue, 03 Jan 2006 15:27:29 -0700
Newsgroups gmane.linux.real-time.rtlinux.general
Message-ID <[email protected]>
On Tue, 2006-01-03 at 17:24 -0500, Calin A. Culianu wrote:
> 
> On Tue, 3 Jan 2006, Victor Yodaiken wrote:
> 
> > Set the priorities right. The logic is, or should be,
> > take an interrupt on whatever task is running
> > call sem post
> > if waking a thread of higher priority then switch immediately.
> >
> > So what you need is to make sure your higher priority thread has been
> > set to a higher priority.
> >
> > Does that work?
> >
> >
> 
> Umm.. oh I get it.  So my ISR needs to have higher priority than my 
> bottom-half worker thread?
> 

No, I explained it badly.
You have (A) short ISR code and (B) lower priority fill thread and (C)
high priority other thread.
SEt the priority of C to be high.

Then if C is running the worst case is an interrupt (A), then sem_post
which wakes (B) and the scheduler realizes (C) should still run.
But if B is running and C becomes runnable, C preempts B.


> Well how to I 'set' the priority of an ISR?!  I figured instinctively ISRs 
> always have the highest priority.. no?
> 
> Should I just set the priority of my bottom-half worker thread to 
> something negative?
> 
> 
> Also how does one set priority?  Is the following correct:
> 
>    sched_param.sched_priority = 3;
>    pthread_attr_setschedparam(&attr, &sched_param);
>    error = pthread_create(&thread, &attr, isrWorkerThread, 0);

Yes.


_______________________________________________
Rtl mailing list
[email protected]
http://hq.fsmlabs.com/mailman/listinfo/rtl
http:/www.rtlinux-gpl.org/