The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Omer Zak
I have a riddle for you. Given a system with real time processes. One process (process M) monitors some quantity (say, temperature) and makes measured values of the quantity available for another process (process A). Process A retrieves the measured temperature once in a while and takes some acti

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Shachar Shemesh
On 13/04/11 16:07, Omer Zak wrote: The riddle: 1. If the operating system being used is Linux, what other mechanisms (besides turning off interrupts) are available to single-processor systems to accomplish this? 2. If the system has a multi-core processor or several processors, which low overhead

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Omer Zak
A full fledged queue would force the consuming process (process A) to read and process all data written by the producing process (process M) even when process A needs only the most recent value whenever it reads process M's data. On Wed, 2011-04-13 at 16:21 +0300, Shachar Shemesh wrote: > On 13/04

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Moish
On 13/04/2011 15:41, Omer Zak wrote: A full fledged queue would force the consuming process (process A) to read and process all data written by the producing process (process M) even when process A needs only the most recent value whenever it reads process M's data. On Wed, 2011-04-13 at 16:21 +

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Baruch Siach
Hi Omer, On Wed, Apr 13, 2011 at 04:07:42PM +0300, Omer Zak wrote: > The system has several such processes, so it is desirable to have an > inter-process mechanism having the absolute minimum overhead for > unidirectional data transfers from measuring processes (like process M) > to action taking

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Ori Berger
On 04/13/2011 09:41 AM, Omer Zak wrote: A full fledged queue would force the consuming process (process A) to read and process all data written by the producing process (process M) even when process A needs only the most recent value whenever it reads process M's data. I forgot how this scheme

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Omer Zak
On Wed, 2011-04-13 at 16:40 -0400, Ori Berger wrote: > On 04/13/2011 09:41 AM, Omer Zak wrote: > > > A full fledged queue would force the consuming process (process A) to > > read and process all data written by the producing process (process M) > > even when process A needs only the most recent v

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread Ori Berger
On 04/13/2011 05:04 PM, Omer Zak wrote: If the counter is one byte wide, then any updates to it would be atomic by definition (of course, the context is that only process M ever modifies it). While that is true, I was wrong in asserting that "atomic" is enough. It needs to be ordered with res

Re: The riddle of atomic data transfer from process A to process B

2011-04-13 Thread guy keren
Omer, you did not specify the timing constraints you have, so the very basic thing mechanism is to use a posix semaphore for mutual exclusion access to this memory. this will work both on single-core and multi-core systems. note that disabling interrupts is not possible from user space - so it