Date: Tue, 19 Jan 2010 11:44:08 +0100 From: Bernard van Gastel <bvgastel@bitpowder.com> To: freebsd-hackers@freebsd.org Subject: pthread_{mutex,cond} & fifo/starvation/scheduling policy Message-ID: <71A129DC-68A0-46C3-956D-C8AFF1BA29E1@bitpowder.com>
next in thread | raw e-mail | index | archive | help
--Apple-Mail-1--24675925 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi everyone, I'm curious to the exact scheduling policy of POSIX threads in relation = to mutexes and conditions. If there are two threads (a & b), both with = the following code: while (1) { pthread_mutex_lock(mutex); ... pthread_mutex_unlock(mutex); } What is the scheduling policy of the different thread libraries? Are = both threads getting an equal amount of time? Are there no starvation = issues (are they executed in alternating turns)? (a test program of mine = indicates that libpthread and libthr both have starvation issues, in = contrary to Mac OS X 10.6) Also, I'm interested in the scheduling behaviour in combination with = pthread_cond. Get a signalled thread priority to relock the mutex it is = waiting on, or is the relock operation just a normal lock operation and = is handled as such? (so different kind of starvation issues can occur in = the latter case) I have googled extensively and browsed the libthr sources, but can't = find the specs that I'm looking for. Any help will appreciated. With regards, Bernard van Gastel= --Apple-Mail-1--24675925--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?71A129DC-68A0-46C3-956D-C8AFF1BA29E1>