本文介绍了重新启动系统后,群锁是否会重置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,由于断电,系统意外断电.

Let's say the system powers down unexpectedly due to a power outage.

系统启动时,是否总是将羊群锁视为解锁"?

Are flock locks always considered to be "unlocked" when the system starts up?

提出另一种方法:系统首次启动时是否不需要手动调用flock -u <lock_filename>? (即来自cron @reboot)?

Asked another way: Is it unnecessary to manually call flock -u <lock_filename> when the system first starts up? (i.e. from cron @reboot)?

更新:

BSD群手册页说:

Locks are on files, not file descriptors.   That is, file descriptors
duplicated  through dup(2) or fork(2) do not result in multiple instances
of  a lock, but rather multiple references to a single lock.

推荐答案

我的Linux大师朋友在这里提到有一个内核锁定表(用于文件锁定)(通常存储在内存中),该表在重新启动后会消失.

My Linux guru friend here mentions that there is a kernel locks table (for file locks) (usually stored in memory) which disappears on a reboot.

只要进程正在运行,文件锁就一直存在.

And that the file lock is just there for as long as the process is running.

这篇关于重新启动系统后,群锁是否会重置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 19:19