Skip to content

Conversation

linD026
Copy link
Collaborator

@linD026 linD026 commented Jun 3, 2023

Instead of using the old implementation of thread-rcu [1], let's use the newest and correct one, thread-rcu/rcu.h. And, to avoid the data race while we traverse the linked list, introduce the for loop API, list_for_each_entry_rcu.

After we changed the implementation and used the new for loop API, it doesn't report the data race:

$ make cc -o test test.c -g -Wall -std=c99 -fsanitize=thread -D'READER_NUM=10' -D'UPDATER_NUM=1' -D'TRACE_LOOP=1000' -D'CONFIG_TRACE_TIME' -lpthread $ ./test [tracer] loop 1000 : 2367069575.000000 ns [1] https://github.com/linD026/parallel-programs/blob/main/rcu/thrd-based-rcu/thrd_rcu.h 
Instead of using the old implementation of thread-rcu [1], let's use the newest and correct one, thread-rcu/rcu.h. And, to avoid the data race while we traverse the linked list, introduce the for loop API, list_for_each_entry_rcu. After we changed the implementation and used the new for loop API, it doesn't report the data race: $ make cc -o test test.c -g -Wall -std=c99 -fsanitize=thread -D'READER_NUM=10' -D'UPDATER_NUM=1' -D'TRACE_LOOP=1000' -D'CONFIG_TRACE_TIME' -lpthread $ ./test [tracer] loop 1000 : 2367069575.000000 ns [1] https://github.com/linD026/parallel-programs/blob/main/rcu/thrd-based-rcu/thrd_rcu.h
@jserv jserv merged commit 342506f into sysprog21:master Jun 4, 2023
@jserv
Copy link
Contributor

jserv commented Jun 4, 2023

Thank @linD026 for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants