Re: [linux-audio-dev] sound/gui interaction

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] sound/gui interaction
From: David Olofson (david_AT_gardena.net)
Date: Sat Jul 22 2000 - 02:22:36 EEST


On Sat, 22 Jul 2000, Benno Senoner wrote:
> > > But than ofcourse you loose the threading, and have
> > > to think of some communication between gui and processing.
> >
> > What's the big deal? This is pretty much required anyway... (Shared
> > memory still works, of course, if you want a simple "shared structs"
> > kind of interface.)
>
> attention: normal writing to shared structs in a threaded / multiple
> processes model is FORBIDDEN if you want that your code will
> run on SMP SPARCS. (it does not even provide 32bit read/write
> atomicity)

Yep, one should really always use the system macros for this kind
of stuff... But, anyway, that's not an issue specific to doing
lock-free communication between processes rather than threads of the
same process. Threads may make *cheating* slightly easier, but that's
only a BAD thing, obviously!

The only issue with separate processes is that you may end up with
the shared area mapped at different virtual addresses in the two
processes, so simple pointers in the shared area won't work.

For MuCoS, I consider using relative addreses instead, so that for
example the classic operation

        p = p->next;

becomes

        p += p->next;

or, more generally (not caring about structs)

        p = &(p->next) + p->next;

(The last one makes sure the *pointer* is used as offset base, rather
than, as in the middle case, the struct, which *might* not have .next
as the first element...)

In C++, you could hide it entirely, and hope that the compiler will
optimize it into the same thing. In any language, you can just say
"Do not use the relative pointers directly", and then provide macros
for all the usual stuff, including converting to/from real pointers
relative to your local mapping of the shared area.

//David

.- M u C o S --------------------------------. .- David Olofson ------.
| A Free/Open Multimedia | | Audio Hacker |
| Plugin and Integration Standard | | Linux Advocate |
`------------> http://www.linuxdj.com/mucos -' | Open Source Advocate |
.- A u d i a l i t y ------------------------. | Singer |
| Rock Solid Low Latency Signal Processing | | Songwriter |
`---> http://www.angelfire.com/or/audiality -' `-> david_AT_linuxdj.com -'


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sat Jul 22 2000 - 03:18:54 EEST