Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204547

Question about SCHED_DEADLINE and sched_yield() usage

From Michael Riesch <michael@riesch.at>
Newsgroups linux.kernel
Subject Question about SCHED_DEADLINE and sched_yield() usage
Date 2015-08-10 23:00 +0200
Message-ID <pW2kO-Ga-9@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Question about SCHED_DEADLINE and sched_yield() usage Michael Riesch <michael@riesch.at> - 2015-08-10 23:00 +0200
  Re: Question about SCHED_DEADLINE and sched_yield() usage Juri Lelli <juri.lelli@arm.com> - 2015-08-11 14:00 +0200
    Re: Question about SCHED_DEADLINE and sched_yield() usage Michael Riesch <michael@riesch.at> - 2015-08-12 11:20 +0200
      Re: Question about SCHED_DEADLINE and sched_yield() usage Juri Lelli <juri.lelli@arm.com> - 2015-08-12 13:00 +0200

csiph-web