Locking and optimistic concurrency control for CS438