RE: atomic operations in user space
From: Li Yang-r58472 <hidden>
Date: 2006-08-29 06:42:57
-----Original Message----- From: linuxppc-embedded-bounces+leoli=3Dfreescale.com@ozlabs.org [mailto:linuxppc-embedded-bounces+leoli=3Dfreescale.com@ozlabs.org] On
Behalf Of
Xupei Liang Sent: Tuesday, August 29, 2006 8:44 AM To: linuxppc-embedded@ozlabs.org Subject: RE: atomic operations in user space =20 I think it is less expensive using atomic operation sometimes in the user space, e.g. when updating a
Atomic operations are working under strict restrictions. Generally they won't work for user space. Your best bet is to use semaphore instead.
counter. If this counter is to be updated by a lot of processes, using semaphore can potentially cause a lot of task switching. =20 Regards, =20 Terry Liang =20 =20quoted
-----Original Message----- From: Brent Cook [mailto:bcook at bpointsys.com] Sent: Thursday, August 24, 2006 10:18 PM To: linuxppc-embedded at ozlabs.org Cc: Li Yang-r58472; Terry Liang Subject: Re: atomic operations in user space On Thursday 24 August 2006 05:39, Li Yang-r58472wrote:quoted
quoted
Why do you need atomic operations in user land?IPC will be sufficientquoted
quoted
to deal with race conditions between processes.quoted
quoted
Best Regards,quoted
LeoWhat about multiple threads within a processupdating a counter? =20 Is there anything preventing semaphore to be used in threads?quoted
Of course, if you look at these functions in thekernel header, they're just 2 orquoted
3 inline assembly calls - you could easily rewritethem. Google for 'PowerPC atomicquoted
increment' and grab one of the unencumberedimplementations if you need to use itquoted
in a non-GPL program. On the other hand, I see no license at the top of my/usr/include/asm-i386/atomic.hquoted
file at all, same for PowerPC - are Linux headerfiles actually GPL or are theyquoted
more like the glibc headers, with exceptions madefor userspace programs?quoted
The atomic operations on x86 were accidentallyexported early on, so they have toquoted
hang around apparently for compatibility (there aresome mailing list threads outquoted
there to this effect.) Currently, you just have toassume in Linux that if youquoted
include something from /usr/include/linux or asmthat it will not necessarily bequoted
cross-version or cross-architecture compatible. Notevery arch in Linux even hasquoted
atomic operations of this nature, which I guess isthe main reason why they arequoted
not exported in general. - Brent=20 =20 =20 __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Linuxppc-embedded mailing list Linuxppc-embedded@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-embedded