|
|
|
|
|
by verdagon
1583 days ago
|
|
It's tricky but it is possible, if we: 1. Don't allow any undefined behavior or `unsafe` code in the language. 2. Record all inputs from FFI. 3. Carefully track the orderings of interactions across threads. The article goes into the first two, but the third one is the most interesting IMO: When we unlock a mutex or send a message, we assign a "sequence number" (similar to what we see in TCP packets). Whenever we lock a mutex or receive a message, we read the sequence number and record it to this thread's "recording". When replaying, we use that sequence number and that file to make sure we're reading in the same order as the previous execution. |
|
An unexpected state would seem to break the memory model, and lead to corrupted data, wouldn't it?