Using sequence lock to record memory access order.