On Mon, 2007-10-01 at 09:49 -0700, David Schwartz wrote:This used to be true, and still is if you want to be portable. But the point of futexes was precisely to attack this use case: whereas sched_yield() says "I'm waiting for something, but I won't tell you what" the futex ops tells the kernel what you're waiting for. While the time to do a futex op is slightly slower than sched_yield(), futexes win in so many cases that we haven't found a benchmark where yield wins. Yield-lose cases include: 1) There are other unrelated process that yield() ends up queueing behind. 2) The process you're waiting for doesn't conveniently sleep as soon as it releases the lock, so you wait for longer than intended, 3) You race between the yield and the lock being dropped. In summary: spin N times & futex seems optimal. The value of N depends on the number of CPUs in the machine and other factors, but N=1 has shown itself pretty reasonable. Hope that helps, Rusty. -
| Junio C Hamano | [ANNOUNCE] GIT 1.6.0 |
| Linus Torvalds | Re: [ANNOUNCE] mdb: Merkey's Linux Kernel Debugger 2.6.27-rc4 released |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Paul Menage | Re: [RFC][PATCH 6/7] Account for the number of tasks within container |
git: | |
| Nicolas Pitre | Re: pack operation is thrashing my server |
| Scott Chacon | Git Community Book |
| Greg KH | Re: [ANNOUNCE] pg - A patch porcelain for GIT |
| Lars Hjemli | [PATCH] git-merge: add option --no-ff |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Nick Guenther | Re: Real men don't attack straw men |
| Travers Buda | Re: Important OpenBSD errata |
| Gregory Edigarov | How to re-build openssl with SHA1 support? |
| Al Boldi | [RFC] VM: I have a dream... |
| Dave Kleikamp | Re: [RFC] Heads up on sys_fallocate() |
| Jörn | Review status (Re: [PATCH] LogFS take three) |
| Chris Mason | [ANNOUNCE] Btrfs v0.12 released |
