public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Riesch <michael@riesch.at>
To: linux-kernel@vger.kernel.org
Cc: j.lelli@sssup.it
Subject: Question about SCHED_DEADLINE and sched_yield() usage
Date: Mon, 10 Aug 2015 22:47:35 +0200	[thread overview]
Message-ID: <55C90DE7.1000400@riesch.at> (raw)

Hi all,

I connected two analog-to-digital converters to a BeagleBoneBlack (with
kernel version 3.14.33-ti-r51.2) and tried to use the deadline scheduler
to get samples at a constant rate. In my C++/Qt application the ADCs are
represented by a class which is derived from QThread. The run() method
is basically:

run()
{
   unsigned int flags;
   struct sched_attr attr;
   attr.sched_policy = SCHED_DEADLINE;
   attr.sched_runtime = 600 * 1000;
   attr.sched_deadline = 1250 * 1000;
   attr.sched_period = 1250 * 1000;
   sched_setattr(0, &attr, flags);

   while (active) {
      /* code that gets a sample from adc, takes around 500 ms */

      sched_yield();
   }
}

to get samples at a rate of 800 Hz. However, once sched_yield() is
called, the threads do not seem to be scheduled again (no samples are
acquired and when the application shuts down the threads remain as zombies).

As far as I understand, I have to call sched_yield() if the the
execution time of one loop iteration is either not constant or unknown
(both cases being very likely), because if I do not, a new loop
iteration could be started if the time budget is not empty.

Have I missed something? Any ideas or alternative approaches are welcome!

Thanks a lot in advance!
Best regards, Michael

             reply	other threads:[~2015-08-10 20:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 20:47 Michael Riesch [this message]
     [not found] ` <55C9D32A.4030506@riesch.at>
2015-08-11 11:55   ` Question about SCHED_DEADLINE and sched_yield() usage Juri Lelli
2015-08-12  9:10     ` Michael Riesch
2015-08-12 10:52       ` Juri Lelli

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=55C90DE7.1000400@riesch.at \
    --to=michael@riesch.at \
    --cc=j.lelli@sssup.it \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox