In your operating system kernel, you have a fully generalized procedure, P, that is prepared to deal with any situation. It is slow because it is always testing for conditions that are seldom true, but being a general piece of code, it always has to test for them.
Now suppose you know that, for periods of time, certain of those conditions are false, and that P doesn't have to check for them. So you specialize P for those situations. Making assumptions about asynchronous transistory conditions is called optimism. Finding all points in all the code of all the processes that can invalidate the assumption is the discipline of specifying Quasi-Invariants: "Invariant", because they are assumptions that make the code of the specialization of P correct, and "Quasi", because invalidation can happen at any time.
Any invalidation to a QI (Quasi-Invariant) is represented by writes to some data structures, called Quasi-Invariant Terms). For example, if a QI is the condition that two variables are equal, updating either of the two variables may potentially violate the condition. Guarding against writing to the two variables is able to locate all potential violations. The Synthetix Guarding Tools consist of TypeGuard, a compile-time guarding tool, and MemGuard, a virtual memory based run-time guarding tool.
MemGuard protects a quasi-invariant term by write-protecting the physical page with the term in it. Any write to the page will trigger a page protection fault, so that the system can catch all writes to the quasi-invariant term in the page and report an error to the system programmer. Then, the system programmer can insert proper code to the reported places to make sure that the specialized system always runs under correct assumptions. By iterating this procedure, the system programmer eventually finishes the specialized system testing.