Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Idea 3: Custom Wait Queue

 After each worker thread issues its replication Rpcs, it will invoke `getThreadId()` to get a handle to the current thread. It will then map each of the n replication Rpc Ids to the thread ID in a map which is visible to the dispatch thread.

Finally, it will call `custom_wait`, which puts itself into a set of threads that are simply waiting for the application to wake them up.

When the dispatch thread receives a response to an Rpc, it will check the map and call `wakeup` on the value associated with the Rpc ID.

How is Idea 3 different from using a map to condition variables and then calling signal on the condition variables?

In the CV case, we have an extra layer of indirection, which could mean additional cache misses on data structure metadata. Also, CV's are centered around a state change, rather than oriented around waking up particular threads.