Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Immutability - cli()/save_flags()/restore_flags()

4 views
Skip to first unread message

Les Cargill

unread,
Jan 26, 2012, 2:01:24 PM1/26/12
to

So I need a shmem between a couple of processes. Targets are some
desktop distro* for testing, Tiny Linux for deployment. Both are very
very uniprocessor environments.

*sorry, don't recall, no NNTP at work, so...


I would *like* to simply use a byte of the resulting shmem
to "lock" it - if the byte is zero , it's not locked. If it's
nonzero, then that is the index of the guy who locked it.

So one simple way to do this is simply turn off interrupts globally,
then read or write the byte. Then, of course turn them back on.

I gather that for Linux, this is verboten for user processes? Indeed,
for some reason not very clear to me (multiprocessor?) , it's
deprecated? I would just as soon not make a driver for
the shmem, although I can... (it's a deployment
irritation) and I would very much prefer not
to use the standard shmem driver because I can make all kinds of
simplifying assumptions.

Obviously, I can use spinlocks* or semaphores for mutexes, but seems
a lot of trouble. I'm not cycle-squeezing, it's just that turning
off interrupts seems somehow more elegant, lighter-weight and
more appropriate.

*indeed, I am implementing a spinlock of very low order.

Thanks for any information you can provide... Google searches
are surprisingly noisy on this subject.

--
Les Cargill

Les Cargill

unread,
Jan 27, 2012, 9:57:11 PM1/27/12
to
Les Cargill wrote:
>
<snip>
System V semaphores proved sufficiently simple that I used those...

--
Les Cargill

0 new messages