All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Williams <steve@icarus.com>
To: linuxppc-embedded@ozlabs.org
Subject: Re: Embedded Linux, pthreads and scheduling
Date: Fri, 01 Oct 2004 08:39:44 -0700	[thread overview]
Message-ID: <415D7A40.5040407@icarus.com> (raw)
In-Reply-To: <BE5CEC3C-1375-11D9-86F9-000A95B15278@aimsys.nl>

Jaap-Jan Boor wrote:
> Steve,
> 
> On 30-sep-04, at 19:39, Stephen Williams wrote:
>> I have a multi-threaded (pthreads) application running on an
>> embedded PPC. One of the threads operates a scanner video input,
>> and I want to give it (and only it) high priority, so that if
>> a device driver wakes it up, it is scheduled as close to "now"
>> as possible.

> yes, if you run this program as root a priority >1 and class
> SCHED_FIFO should work as expected.

The program is run by root and I'm using the pthread interface
to set the thread policy.

>>
>> For the particular case I'm seeing, it seems to *not* have
>> any effect. My interrupt handler is activated (I see on the
>> scope) and in the first few cases the response is immediate,
>> but sometimes the response is delayed significantly.
> 
> 
> Possible. What kernel version do you use? In my experience
> a 2.4.x kernel with O(1) scheduler, preemptible kernel patch and low
> latency patch still have significant delays (> 5 ms) sometimes.
> A 2.4 kernel without these patches can have much longer response times.
> I didn't experiment with the 2.6 kernel on this particular
> system yet but 2.6 includes the O(1) scheduler and preemtible
> kernel patch.

This is linuxppc-2.4 from bitkeeper. The last pull I did was a
few months ago, I think.

The process environment should be under control. There are a
half dozen idle daemons (init, boa, syslogd, mostly busybox)
and about a dozen threads in the application at hand. The
network and serial console should be idle during the test,
only my hardware should be going.

> By the way, do you not share a lock with a lower priority thread?
> If the lower priority thread has the lock, your high priority
> thread needs to wait until it's finished (unlocks).

The program is working with in-house devices, I've written the
drivers. The device driver can be used in a pipeline-like fashion,
so the driver itself can be used for most synchronization. In
fact, The thread in question synchronizes entirely through the
driver. I guess that means its a candidate for a seperate process,
eh?

But that means, for this thread, all the synchronization is inside
the kernel. I can also see that there *should* be no cause to block
on anything at the instant I see the delay, hence my puzzlement.

Of course, I'm processing 24bit color images at 30MPixels/sec,
so I might well be hitting *PCI* scheduling issues as easily as
anything else.
-- 
Steve Williams                "The woods are lovely, dark and deep.
steve at icarus.com           But I have promises to keep,
http://www.icarus.com         and lines to code before I sleep,
http://www.picturel.com       And lines to code before I sleep."

      reply	other threads:[~2004-10-01 15:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-30 17:39 Embedded Linux, pthreads and scheduling Stephen Williams
2004-10-01  6:47 ` Jaap-Jan Boor
2004-10-01 15:39   ` Stephen Williams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=415D7A40.5040407@icarus.com \
    --to=steve@icarus.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.