Previous | Next --- Slide 32 of 63
Back to Lecture Thumbnails
lexicologist

Intrinsics for hardware-supported atomic operations can be used to create unexpected atomic actions.

compare_and_swap is an atomic operation (used to implement semaphores and mutezes) that compares a mem location's value to a given value and swaps that location to a different given value when the first two values are the same.

This operation can actually be used to create an atomic increment/decrement! More here: https://en.wikipedia.org/wiki/Compare-and-swap

swkonz

When we write ISPC code, do we need to include locks or in order to enforce access control across tasks? Is the syntax for this the same in ISPC as it is normally for c++?

nickbowman

@swkonz My understanding of tasks in ISPC is that they must identify chunks of work that can be done independently, so there wouldn't be a need to introduce locks for synchronization, because synchronization is not necessary. I think that is an interesting question though regarding whether or not multithreading primitives in C++ would be compatible with ISPC code.

blipblop

Are "mutual exclusion" and "atomicity" synonymous for the purpose of this course?

Please log in to leave a comment.