[Ffmpeg-devel] native win32 threads or pthreads-win32?

Dana Hudes dhudes
Thu Oct 5 16:36:16 CEST 2006


>>>>
>>>> While making the win32 builds, I came across the decision of using
>>>> either native win32 threads (w32thread.c), or pthreads, with the
>>>> pthreads-win32 library.
>>>>
>>>> The builds at http://ffdshow.faireal.net/mirror/ffmpeg/ include
>>>> pthreads-win32, but I didn't get any answer from celtic druid about 
>>>> his
>>>> decision.
>>>>
>>>> Are there any issues that would make me prefer one over the other, 
>>>> such
>>>> as stability or performance 
You will certainly get better performance with native win32 threading if 
you are running natively on win32 rather than cygwin. Are you compiling 
with gcc somehow or are you using Microsoft's compiler? I don't have a 
current MS compiler so I can't build native win32 though I have a dual 
core PIV running win XP. pthreads (POSIX threads) run in user space, 
only. I wouldn't expect them to get scheduled on another cpu. You have 
to understand the various types of threading and indeed what threading 
IS. Threads are running in the context of the parent process -- that's 
the point. Some OS, such as recent Linux kernel and Solaris (I think at 
least Solaris 9, certainly 10 possibly 8 and I doubt 2.6) have kernel 
and user level threads. In fact, a process can be treated as a 
kernel-level thread. The question is whether the OS scheduler, the one 
running the system-wide run queues, is aware that there's this thread 
out there. Otherwise its all just the parent process activity.

You can get a good overview of threading from the Microsoft 
documentation. Back when I taught operating systems, we found a classic 
concurrency example implemened (and throughly documented) on some MS 
website -- IIRC, it was the frog and fly problem. Most of my students, 
the ones not sleeping in class or screwing off their homework, were able 
to understand MS thread model from the code and documentation (combined 
with the foundations on threading and on concurrency from my lectures 
and the textbook (Silberschatz, highly recommended) ) and were then able 
to implement the Barbershop problem at some level. Sine most folks 
reading this are presumably more advanced than junior year undergraduate 
CS students, you should be able to get a good idea of it from the MS 
website in question as well. I don't have the url handy but I'll see 
about digging it up....though this starts to wander off-topic of the list.





More information about the ffmpeg-devel mailing list