Please complete the required studio exercises listed below, along with any of the (optional) enrichment exercises that interest you.
As you work through the exercises, please record your answers in a file, and upon completion please e-mail your answers to the email@example.com course e-mail account with Lock Free Data Structures Studio in the subject line.
Please make sure that the name of each person who worked on these exercises is listed in the first answer, and that you number your answers so they are easy for us to match up with the appropriate exercise.
In the main C++ source code file for the project (which should be named something like
lock_free.cpp) please modify the main function signature so that it
looks like the standard (i.e., portable between Windows and Linux) main function entry point
int main (int, char * )
Implement the basic lock free stack shown in Listing 7.2 of [Williams], declare an instance of it
int in your main function, call its push method a few times
with different integer values, and then have main return 0 to indicate success. Build and run your
program, and as the answer to this exercise please explain why the push method's
loop does not need to repeat the statement just before it that loaded the value of the atomic head
pointer into the new node's next pointer (i.e, why does it only contain an invocation of the
Build and run your program and as the answer to this exercise please indicate whether you saw evidence of the threads' pushes and pops interleaving in interesting ways. For example, did either of the containers end up with both even and odd numbers? Please describe what you saw and what it means for how the threads accesses to the lock free stack were interleaved.
Build and run your program, and as the answer to this exercise describe whether you saw any differences in the program's behavior compared to in the previous exercise, and if so what they were.
Build and run your program, and as the answer to this exercise describe whether you saw any differences in the program's behavior compared to in the previous exercise, and why you think there were or were not.
Build and run your program and as the answer to this exercise describe what you implemented and what results you saw (and any interesting behaviors you noticed) when you did that.