From: Philippe Gerum <rpm@xenomai.org>
To: Jan-Erik Lange <jan0385@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] Synchronization of shared memory with mutexes
Date: Tue, 10 Jan 2012 16:22:11 +0100 [thread overview]
Message-ID: <4F0C57A3.9030304@domain.hid> (raw)
In-Reply-To: <BLU166-W84625BB37F4B5F9C29FB6C4990@domain.hid>
On 01/10/2012 04:04 PM, Jan-Erik Lange wrote:
>
> Hello,
>
> I have a question about basics of the synchronization of shared memory
> with mutexes.
>
> The situation: The Sender is a RT task (primary domain) and the
> recipient is a non-RT task (usually in the secondary domain). Namely,
> the receiver is used to interact with a Web server. He calls to syscalls
> and stuff and because of that he's usually in the secondary mode.
>
> Suppose the sender has written something to the shared memory: He uses
> mutex for synchronization, so he calls the rt_mutex_release() function.
>
> The receiver will now get time to work from the scheduler. He calls
> rt_mutex_acquire() function to lock the shared memory. Then a context
> switch occurs from the secondary mode in the primary mode. He has now
> the resource for himself.
>
> Now the scheduler lets sender-task to work and it wants to write
> something. So it calls rt_mutex_acquire() function. And now comes my
> question: Provides rt_mutex_acquire() a mechanism to signal the cheduler
> to immediately continue with the recipient-task? If so, how does the
> rt_mutex_acquire() function tells the scheduler that?
There are two tasks controlled by the same (Xenomai) scheduler. One is
trying to grab a mutex the other one holds, so it is put to sleep on
that mutex. The scheduler will simply switch to the next ready-to-run
task since the sender task cannot run anymore, and that next task may be
the receiver task. There is no special signaling magic required.
>
> I came out because I in the documention I read the term "Rescheduling:
> always".
>
The documentation for rt_mutex_acquire is "Rescheduling: always unless
the request is immediately satisfied or
timeout specifies a non-blocking operation.".
> Best regards
> Jan
>
>
>
> _______________________________________________
> Xenomai-core mailing list
> Xenomai-core@domain.hid
> https://mail.gna.org/listinfo/xenomai-core
--
Philippe.
prev parent reply other threads:[~2012-01-10 15:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 15:04 [Xenomai-core] Synchronization of shared memory with mutexes Jan-Erik Lange
2012-01-10 15:22 ` Philippe Gerum [this message]
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=4F0C57A3.9030304@domain.hid \
--to=rpm@xenomai.org \
--cc=jan0385@domain.hid \
--cc=xenomai@xenomai.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.