Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: qestion about thread priorities-> suggestion



Am Samstag, 14. Februar 2004 10:56 schrieb Klaus Schmidinger:
> Guido Fiala wrote:
> > Not sure about it, but it seems, that all vdr-threads have the same
> > priority, IMHO at least something like the cutting-thread should have a
> > lower priority than a recording thread, that in case performance get's
> > critical the recording and playback get's more cpu time than the cutting
> > or other lower priority tasks as cleanup etc.
>
> Can you provide a patch that implements this?

Just had a try and although it should have been easy it actually isnit.

Theoretically it would be enough to implement another cThread::Start() like 
this in cthread.c+.h:

bool cThread::Start(int prio)
{
  if (!running) {
     running = true;
     parentPid = getpid();
     pthread_create(&thread, NULL, (void *(*) (void *))&StartThread, (void 
*)this);
     sched_param sp;
     sp.__sched_priority=prio;//set priority of thread, WARNING: may lock up 
system!
     pthread_setschedparam(thread, SCHED_RR,&sp);
     usleep(10000); // otherwise calling Active() immediately after Start() 
causes a "pure virtual method called" error
     }
  return true; //XXX return value of pthread_create()???
}

And in cutter.c:

--- Start();
+++Start(19);//+ or - ???

However - this does not set the "nice-value" but the priority of the thread, 
the posix-interface seems not to know about "nice"

Actually it did not result in a noticeable change, using top i could'nt even 
prove that the priority has actuall been changed.

Interesting enough not even calling a nice(19) in the cutting-thread did 
actually help here (although it is now visible set according to top).

xosview does not show it as niced and the result (interruptions in the 
analogtv-feed) are also still there. An external niced process (not thread) 
like noad does not produce the distortions :-(

It seems that posix-threads have some unexpected drawback here.
Any idea what the difference is?

Guido



-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index