= Atomic Operations = [[TOC(Projects/GSoC/Atomic_Operations, depth=2)]] '''Mentors:''' * Chris Johns '''Students:''' * Deng Hengyi '''Status:''' * [http://www.google-melange.com/gsoc/project/google/gsoc2012/a007_weiy/10001 Gsoc2012 project] '''Introduction:''' Candidate APIs / Implementations * [http://concurrencykit.org/ ConcurrencyKit]: A solution for concurrency problems that includes atomic operations. * [http://www.freebsd.org/cgi/man.cgi?query=atomic&apropos=0&sektion=0&manpath=FreeBSD+8.0-RELEASE&format=html FreeBSD Atomic Operations] * [http://netbsd.gw.com/cgi-bin/man-cgi?atomic_ops+3+NetBSD-current NetBSD Atomic Operations] * [http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1349.htm C11 atomic primitives definition] * [http://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/_005f_005fatomic-Builtins.html#g_t_005f_005fatomic-Builtins GCC4.7 or newer built-in atomic functions] '''Goal:''' To provide RTEMS with core services to solve synchronization problems on multicore platforms. '''Requirements:''' * Advanced C and assembly language programming * Familiarity with RTEMS kernel software architecture * Understand concurrency problems and solutions '''Resources:''' * https://www.rtems.org/bugzilla/show_bug.cgi?id=1455 '''Acknowledgements''' * [https://docs.google.com/document/d/11O3i5dWlH4BmwY9SAycvARf40omeLJ-aD0Eg6E4fuh0/edit# Gsoc2012 project proposal] = References of atomic implementation = = ConcurrencyKit = A candidate for this project is the ConcurrencyKit (ck). Among other targets, ck works on the 32-bit x86 architecture, so a first step would be to try compiling ck with rtems for pc386 and run a sample application under QEMU. Once a sample application is working, the next step would be to get as much of the ck regression suite to run as possible. Beyond that are many possible directions. Potential students should ask on the mailing list and work with potential mentors to design a project that suits their abilities and goals. = FreeBSD Atomic = The FreeBSD Atomic Operations API defines a set of atomic operations that can then be used to build solutions to concurrency problems. The FreeBSD implementations support a lot of target architectures, so there is more freedom to pick a starting point. = NetBSD Atomic = The NetBSD kernel implements seven classes of atomic memory operations. In the NetBSD kernel if the architecture provides compare and swap (CAS) each atomic operations is built on CAS. If the architecture does not provide hardware support for atomic compare and swap (CAS), atomicity is provided by a restartable sequence or by a spinlock. = C11 and C++11 Atomic = The end of 2011 brought new releases of both the C and C++ standards for the first time both of which contain a new set of atomic types and operations. The older versions of C and C++ had no support for atomic operations at all. The older versions of GCC and Clang provide the _sync_* family of built-in functions, which provide some atomic operations support. The GCC 4.7(or newer) and latest version Clang has provided built-in functions approximately match the requirements for C++11 memory model. = Linux Atomic = The Linux kernel mainly implements two class of atomic primitives: one without return value and the other with return value. In the Linux kernel any the atomic operation that modifies some state in memory and returns information about the state (old or new) implies an SMP-conditional general memory barrier (smp_mb()) on each side of the actual operation (with the exception of explicit lock operations). = References = * TBD '''Other sections:''' If you have more to say about the project that doesn't fit in the proposed sections of this template, feel free to add other sections at will.