[lkml]   [2000]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectSemaphores slow???


We have a typical semaphore application that has a producer and a

Without the semaphores we are limited by the rest of the stuff to
10000 times around the loop per second. That's good.

When we put the "push the semaphore" call in there, the rate drops to
around 8000 per second. I'm not happy about that, but ok. When we add
the "wait for bufferspace" semaphore wait in there, the rate drops to
4000 per second. This is way too low.

Does anybody have an idea why linux semaphores are so slow?

sem_init (&write_sem, 1, 0);
sem_init (&write_buffer_sem, 1, 0);


while (1) {
sem_wait (&write_buffer_sem);

sem_post (&write_sem);

for (i=0;i<nbufs;i++) {
Create_buffer (i);
sem_post (&write_buffer_sem);

while (1) {
sem_wait (&write_sem);

sem_post (&write_buffer_sem);

(pshared == 0 doesn't work: returns error. The manpage claims that
thsi would happen for pshared != 0... )


** ** ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* There are old pilots, and there are bold pilots.
* There are also old, bald pilots.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:52    [W:0.036 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site