As a university student majoring in CS, please read the research paper and write a reading report focussing on the following questions. In addition, the report should be consecutive and cohesive(instead of Markdown outline or bullet-point lists), include personal thoughts and viewpoints. The report is of about 3000 words.

  • What is the root cause of concurrency problems?
  • Read the following code snippet of two threads trying to synchronize and analyze the problems that may occur in modern computer systems. Based on the relevant course knowledge you have learned so far (ICS, databases, OS), try to explain the cause of the problem.
     

int v; bool v_ready = false; void threadA() { // Write the value // and set its ready flag. v = 42; v_ready = true; } void threadB() { // Await a value change and read it. if (!v_ready) { /* wait */ } else { /*do something else */ } const int my_v = v; // Do something with my_v… }

- What are the necessary technologies of modern computers that may interfere with the correctness of concurrent programming? (Hint: compilation optimization, multi-level cache, multi-core/NUMA processor structure)
- How to understand the author's meaning of "All of these complications mean that there is no consistent concept of 'now' in a multithreaded program, especially on a multi-core CPU. Creating some sense of order between threads is a team effort of the hardware, the compiler, the programming language, and your application."?
- How to understand the "enforcing law and order" and atomicity of operations required for correct concurrent programming?
- Examine the atomic computing capabilities in modern languages ​​​​C/C++ through program examples, such as stdatomic.h in C11
- What are torn reads and writes, and what harm does it cause to concurrency?
- Re-examine the read-modify-write (RMW) operation
- Is lock-free concurrency necessarily better than locked concurrency in terms of efficiency? If not completely, why do we still advocate lock-free concurrency processing?
- Methods for ensuring sequential consistency on weakly-ordered hardware (such as ARM)
- How to use load-link and store-conditional (the so-called LL/SC instructions) to implement atomic read-modify-write ) operation?
- Will LL/SC instructions cause false positives and reduce computing performance? What causes false positives?
- As a programmer, can you have precise control over the memory model? Please give an example
- Try to explain why the following compare-and-swap operations shoudl use different memory models?
    ```c
while (!foo.compare_exchange_weak(
expected, expected * by,
memory_order_seq_cst, // On success
memory_order_relaxed)) { // On failure
    /* empty loop */
}
  • In concurrent processing, what interference role does the cache play? Take the read-write lock in the following program segment as an example to explain: Will the read-write lock improve the efficiency of the program? Why? If not, what is the reason?
     

struct RWLock { int readers; bool hasWriter; // Zero or one writers };

- Verify the semantics of the volatile modifier to avoid misuse in concurrent issues
- What is "Atomic Fusion" and how should we treat it?