[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] End-to-end delay question
From: |
Michael Dickens |
Subject: |
Re: [Discuss-gnuradio] End-to-end delay question |
Date: |
Wed, 23 May 2007 10:30:32 -0400 |
On May 22, 2007, at 11:46 PM, Eric Blossom wrote:
pthread_attr_setschedpolicy is not the same thing as
sched_setscheduler. It's for setting up the attribute that is passed
pthread_create.
Touché. Thanks for pointing that out ... should have been
"pthread_setschedparam()" instead. This routine is, if I'm reading
the MAN pages correctly, an exact parallel to "sched_setscheduler()",
but in pthread terms. Here's the basic code:
-------
int policy = SCHED_FIFO
pthread_t this_thread = pthread_self ();
int priority = (sched_get_priority_max (policy) +
sched_get_priority_min (policy)) / 2;
struct sched_param param;
memset (¶m, 0, sizeof (param));
param.sched_priority = priority;
int result = pthread_setschedparam (this_thread, policy, ¶m)
if (result != 0) {
printf ("Error %d doing 'pthread_setschedparam'.\n", errno);
...
-------
Compare that with "gr_realtime.cc":
----
int policy = SCHED_FIFO;
int pri = (sched_get_priority_max (policy) +
sched_get_priority_min (policy)) / 2;
int pid = 0; // this process
struct sched_param param;
memset(¶m, 0, sizeof(param));
param.sched_priority = pri;
int result = sched_setscheduler(pid, policy, ¶m);
if (result != 0){
....
--------
You'll notice that the 2 differences are (1) having to get the
current pthread instead of the PID; and (2) using
"pthread_setschedparam()" instead of "sched_setscheduler()".
Interestingly, at least on OSX 10.4.9, all policies have a (min,max)
priority of (15,47), and the default for any process is the mid-point
(31). Thus for OSX, "real time" priority needs to be closer to the
MAX than the mid-point. The default policy is "Other" (1), whatever
that is.
But, again, for some reason 'configure' isn't registering that
pthreads are available on OSX 10.4 ... which they clearly are. - MLD
- Re: [Discuss-gnuradio] End-to-end delay question, (continued)
- Re: [Discuss-gnuradio] End-to-end delay question, Eric Blossom, 2007/05/07
- Re: [Discuss-gnuradio] End-to-end delay question, Bob McGwier, 2007/05/07
- Re: [Discuss-gnuradio] End-to-end delay question, Robert McGwier, 2007/05/07
- Re: [Discuss-gnuradio] End-to-end delay question, Steve Bunch, 2007/05/20
- Re: [Discuss-gnuradio] End-to-end delay question, Eric Blossom, 2007/05/21
- Re: [Discuss-gnuradio] End-to-end delay question, Michael Dickens, 2007/05/21
- Re: [Discuss-gnuradio] End-to-end delay question, Eric Blossom, 2007/05/22
- Re: [Discuss-gnuradio] End-to-end delay question, Michael Dickens, 2007/05/22
- Re: [Discuss-gnuradio] End-to-end delay question, Eric Blossom, 2007/05/22
- Re: [Discuss-gnuradio] End-to-end delay question,
Michael Dickens <=
- [Discuss-gnuradio] Reconfigurable OFDM using the USRP - it's possible, here's a video, Keith Nolan, 2007/05/23
- Re: [Discuss-gnuradio] End-to-end delay question, Eric Blossom, 2007/05/23
- Re: [Discuss-gnuradio] End-to-end delay question, Michael Dickens, 2007/05/24
- Re: [Discuss-gnuradio] End-to-end delay question, Eric A. Cottrell, 2007/05/22
Re: [Discuss-gnuradio] End-to-end delay question, Steve R Bunch, 2007/05/08
Re: [Discuss-gnuradio] End-to-end delay question, Tarun Tiwari, 2007/05/10