title: Does intercepting and replaying all system calls suffice to ensure deterministic program behavior?
body: <p>On GNU/Linux it is possible to intercept all system calls of a program and its children using <code>ptrace(2)</code>. Typical software will rely exclusively on system calls to interact with other software.</p>
  
  <p><strong>What are the possible sources of non-determinism a program can utilize that do not involve system calls? And are they commonly used?</strong></p>
  
  <p>Typically, if I wanted to develop a <em>universal caching mechanism</em> which keeps track of all system calls of a program and its sub-processes, and I were to simply replay them, checking those calls return the exact same result (if not, I fallback to actually running the program), would that always behave perfectly as the genuine program?</p>
  
  <p>More practically, if I relax some of the calls to allow for different behavior (typically, <code>brk</code> and <code>mmap</code> tend to choose different addresses and <code>getpid</code> return different process id, but they don't really affect program behavior much) are there commonly used programs that would break those expectations? (typically, I assume build tools tend to be rather deterministic)</p>
  
  <p>Is there such an implementation of <em>universal caching mechanism</em> out there?</p>