[RFC] Atomic Operations

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

 



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.

I have several ideas of ways to update the existing integer atomic operations to support more types. The easiest way (at least regarding code) would be to use an existing atomic operations library. My suggestion would be the libatomic_ops library, which is licensed under an MIT style license and could be added to the source tree as a git submodule (similar to the way gnulib is) or a specific version could be used and the library source itself added to the git repository. The library can be found at https://github.com/ivmai/libatomic_ops/ .

The other way of augmenting atomic operations would be to extend the existing viratomic.h file to support additional types. Personally I have experience working with GCC atomic operations and could implement that myself, but I wouldn't be able to implement the windows versions.

Again I think the easiest and most maintainable way of supporting atomic operations is via an external library, but I am not sure of the feasibility of adding another dependency to libvirt. In general atomic operations are an optimization, but they can help make multithreaded programming easier and I think libvirt would be enhanced by having more comprehensive support for atomic operations.

Tucker DiNapoli
--
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]