Bill Davidsen wrote: > > I never tried binding the process to a CPU, in general the affinity > code puts one process per CPU under light load, and limits the context > switch overhead. It looks as if you are testing only the single CPU > (or core) case. > Attached is a patch that I wrote that adds cpu binding. Feel free to add it to your sources. It's not that usefull, recent linux distros include a "taskset" command that can bind a task to a given cpu. I needed it for an older distro. With regards to the multi-core case: I've always ignored them, I couldn't find a good/realistic test case. Thundering herds (i.e.: one task wakes up lots of waiting tasks) is at least for sysv msg and sysv sem lockless: the woken up tasks do not take any locks, they return immediately to user space. Additionally, I don't know if the test case is realistic: at least postgres uses one semaphore for each process/thread, thus waking up multiple tasks never happens. Another case would be to bind both tasks to different cpus. I'm not sure if this happens in real life. Anyone around who knows how other databases implement locking? Is sysv sem still used? -- Manfred