Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

History file lock contention



Hi,
when running zsh from a terminal multiplexer like tmux, it is possible
(and not uncommon) to close several processes at the exact same moment.
In that case, all of them try to sync their history and all but one fail
to acquire the lock. So far so good.

However, all of these call nanosleep({1,0}), and since we might be on a
multicore system, they might just be scheduled at the same time again,
only one of them will progress and the scenario repeats. What the user
sees is the terminals not disappearing immediately, but one after the
other, a second per process.

A common solution to this problem is to randomize the back-off, for
example in the interval (0, 1s). On a decent system without load, this
would make it more responsive (all of them would be likely to finish
within a second of the user's request if possible) while not causing
any undue increase in the load on the machine.

Let me know what you think. I am not (yet) subscribed to this list, so
please copy me in your discussion.

Thanks,
Ondrej



Messages sorted by: Reverse Date, Date, Thread, Author