[GnomeMeeting-devel-list] Re: 2.6 vs 2.4 regression when running gnomemeeting



* Christian Meder <chris onestepahead de> wrote:

> > 	nice -19 ./loop &
> > 
> > do a couple of such loops still degrade gnomemeeting?
> 
> I found the culprit. It's sched_yield again. When I straced
> gnomemeeting even without load I saw a lot of sched_yields. [...]

this is definitely broken code. Such code already causes big CPU
overhead in certain circumstances (under 2.4 too) - but in 2.6 it also
shows up as an interactivity problem. So 2.4 hid the problem, 2.6
exposes it.

> So the questionable code in pwlib is probably: 

> > BOOL PSemaphore::Wait(const PTimeInterval & waitTime)

yeah. pwlib should be fixed. The quick fix is, instead of sched_yield(),
to do:

	{
		struct timespec timer = { 0, 1 };

		nanosleep (&timer, NULL);
	}

this does what pwlib really wants to do: sleep for the shortest amount
of time posssible, because its semaphore implementation is polling
based.

(but pwlib should perhaps use sem_timedwait(sem, abs_timeout) instead -
which does exactly what PSemaphore::Wait() tries to implement.)

	Ingo



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