Describe the differences between optimistic and pessimistic locking, and when you would use each in a high-concurrency scheduling system.