Adaptive Locks for Frequently Scheduled Tasks With Unpredictable Runtimes