zsh-workers
 help / color / mirror / code / Atom feed
* History file lock contention
@ 2015-01-23 11:46 ondra
  2015-01-23 12:13 ` Peter Stephenson
  0 siblings, 1 reply; 6+ messages in thread
From: ondra @ 2015-01-23 11:46 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-25 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 11:46 History file lock contention ondra
2015-01-23 12:13 ` Peter Stephenson
2015-01-23 20:49   ` Peter Stephenson
2015-01-23 21:00     ` Peter Stephenson
2015-01-23 21:28       ` Peter Stephenson
2015-01-25 20:33         ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).