Mailing List archive

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

[vdr] Re: [ANNOUNCE] vdr-softdevice-0.0.7pre2



On Sat, Aug 07, 2004 at 02:16:52PM +0200, Stefan Lucke wrote:
> On Donnerstag, 5. August 2004 12:37, Dr. Werner Fink wrote:
> [ .. ]
> >        As some applications  require  much  more  precise  pauses
> >        (e.g.,  in  order to control some time-critical hardware),
> >        nanosleep is also capable of short high-precision  pauses.
> >        If  the process is scheduled under a real-time policy like
> >        SCHED_FIFO or SCHED_RR, then pauses of up to 2 ms will  be
> >        performed as busy waits with microsecond precision.
> > 
> > ...
> > 
> > In other words ... usleep(1 ... 2000) do _not_ trigger the scheduler
> > to get other thread/processes at work, for this a simple sched_yield(2)
> > or pthread_yield(no man page) should be used.
> 
> NO. I played around the usleep(1) in vd1.3.12 transfer.c line 127.
> Using (kernel 2.4.27-pre5):

I'm talking about NPTL and 2.6.x Kernels ;^)

>  phtread_yield() -> cpu 100%
>  sched_yield() -> stream corrupted, every now and then some single blocks decoded.
>  usleep(1) -> live stream plays fine.
> 
> So if "usleep(1)" is bad, it should be replaced by something other not yet mentioned. 

*_yield() only give the scheduler a hint to do a reschedule but if there is no
other process/thread which want some CPU time then the caller of *_yield() is
back immediately.

I'd like to have a pointer to a funktion which will be set in case of
non-NPTL threads to usleep(1) and if NPTL threads is used then to phtread_yield().

     
       Werner

-- 
AC3 loop through sound card http://bitstreamout.sourceforge.net/
Howto http://www.vdr-portal.de/board/thread.php?threadid=1958
------------------------------------------------------------------
 "Having a smoking section in a restaurant is like having
         a  peeing section in a swimming pool." -- Edward Burr




Home | Main Index | Thread Index