From: "Anil Kumar" <anilk@subexgroup.com>
To: "Mihai Moise" <mmoise@giref.ulaval.ca>, <linux-kernel@vger.kernel.org>
Subject: RE: semaphores and noatomic flag
Date: Tue, 5 Jun 2001 11:58:17 +0530 [thread overview]
Message-ID: <NEBBIIKAMMOCGCPMPBJOCEGICEAA.anilk@subexgroup.com> (raw)
In-Reply-To: <3B1BC6BF.8098111A@giref.ulaval.ca>
Will it not be a very specialized case rather than being general call type?
-----Original Message-----
From: linux-kernel-owner@vger.kernel.org
[mailto:linux-kernel-owner@vger.kernel.org]On Behalf Of Mihai Moise
Sent: Monday, June 04, 2001 11:05 PM
To: linux-kernel@vger.kernel.org
Subject: semaphores and noatomic flag
I write this to discuss the reasons why the semop system call should
have an IPC_NOATOMIC flag.
Suppose we have two processes, called client and server, which
communicate through a shared memory segment and two semaphores, and need
to synchonize their activities so that they don't operate simultaneously
except at startup.
The server would do,
down(smephore 0)
to wait for a message from the client. When the client needs the server
to execute, it would,
up(semaphore 0) /* wake up server */
down(semaphore 1) /* put itself to sleep */
after the server has completed its portion of the task, it would,
up(semaphore 1) /* wake up client */
down(semaphore 0) /* put iself to sleep */
The problem is that the two system calls make the whole process twice as
slow as it needs to be, and they are both needed because the semop
system call is implemented in an atomic manner. If the semop system call
had an IPC_NOATOMIC flag, then the each process would only have to do
one call,
semop(up semaphore 0 & down semaphore 1, IPC_NOATOMIC)
which would be interpreted in the kernel as the sequence of two system
calls I have written previously.
I want to know what other people think about this idea.
Mihai
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-06-05 6:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-04 17:34 Mihai Moise
2001-06-05 6:28 ` Anil Kumar [this message]
2001-06-05 10:37 ` Daniel Phillips
2001-06-05 17:26 ` davide.rossetti
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=NEBBIIKAMMOCGCPMPBJOCEGICEAA.anilk@subexgroup.com \
--to=anilk@subexgroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mmoise@giref.ulaval.ca \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®