From: R.E.Wolff@BitWizard.nl (Rogier Wolff)
To: linux-kernel@vger.kernel.org
Subject: Semaphores slow???
Date: Wed, 27 Dec 2000 15:15:35 +0100 (MET) [thread overview]
Message-ID: <200012271415.PAA18730@cave.bitwizard.nl> (raw)
Hi,
We have a typical semaphore application that has a producer and a
consumer.
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?
init:
sem_init (&write_sem, 1, 0);
sem_init (&write_buffer_sem, 1, 0);
producer:
while (1) {
sem_wait (&write_buffer_sem);
...
sem_post (&write_sem);
}
consumer:
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... )
Roger.
--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +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 majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next reply other threads:[~2000-12-27 14:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-27 14:15 Rogier Wolff [this message]
2000-12-27 15:26 ` Semaphores slow??? J . A . Magallon
[not found] ` <200012271545.QAA18971@cave.bitwizard.nl>
2000-12-27 16:48 ` J . A . Magallon
2000-12-28 12:27 ` Davide Libenzi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200012271415.PAA18730@cave.bitwizard.nl \
--to=r.e.wolff@bitwizard.nl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.