mulithread rework

Con Kolivas <[email protected]>
Newsgroups gmane.comp.video.xvid.devel
Message-ID <[email protected]>
Hi all

I see not a lot of activity has been going on for a while, but I noticed there 
was multithread code in the cvs repo. I downloaded it and gave it a shot and 
found it did speed up maybe 40% but that's not a great improvement for a 4 
core machine. So I had a look at the code to see if I could help.

Now within the code I see each P frame is sliced up and encoded by different 
threads. What I also found was the sched_yield was used as a locking 
primitive which unfortunately is less than ideal. Turning the sched_yield 
into a noop makes it spin on wait burning cpu cycles doing nothing and 
actually slows the encoding down a lot. I'd like to help improve this 
threading code with some proper locking in the hope I could speed it up. 
However, I was hoping someone could tell me, exactly what is it that the 
sched_yield is giving time to; ie by yielding, what is it waiting on 
happening.

I could poke around indefinitely and I'll probably eventually find it but at 
the moment it's too obscure for me to decipher from this:

				if (current_mb >= max_mbs) {
					/* current workload is zero */
					x--;
					sched_yield();
					continue;
				}

Hopefully someone can enlighten me because I'd love to see if I could help 
make this multithreaded code scale better.

Regards.
-- 
-ck
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.