alternative batching: use locks so batching processes cannot interfer with each other