Re: [RFC] Atomic Operations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 04, 2014 at 08:16:16AM -0400, Tucker DiNapoli wrote:
> I'm working on job control which involves a lot of locking and unlocking,
> often for operations that could be done atomically. I use the existing
> atomic integer operations in viratomic.h where possible, but there are a
> lot of parameters involved in jobs (such as time, thread id's, progress
> information, etc) which don't fit in an integer.

If there are many different data items which need updating then I'd
really think this is better done with mutexes. I wouldn't even assume
that atomic ops are neccessarily going to be faster. When I optimized
our logging routines recently I tried to make use of atomic ops for
a bunch of variables but found it was actually quicker to use mutexes
since one mutex lock can protect many variable writes, whereas every
atomic op read/write has a cost.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]