When you schedule a single thread across different processors, does the cache have to be cleared each time? If the cache is not cleared, can't the following happen :
Suppose you have the following (pseudo) code executed by 2 processors, P1 and P2.
1. foo() {
2. int x=5;
3. x=10;
4. print x;
5. }
Initially the thread is scheduled on P1, which executes lines 1 and 2, and stores 5 in its cache for x's memory location (on the stack).
The thread is then scheduled on P2 which executes line 3, and stores 10 in its cache for x's memory location.
Finally, the thread is again scheduled on P1, and executing line 4, prints 5 (x's value in P1's cache).
Yet we clearly expect 10 to be printed.