简体   繁体   English

vim 对其他进程正在使用的文件的影响

[英]Impact of vim on a file being used by an other process

I am using SLURM for my jobs on a computing cluster.我在计算集群上为我的工作使用 SLURM。 I want to check my output file using vim in the login node when the job is running and will not do any editing.我想在作业运行时在登录节点中使用 vim 检查我的 output 文件,并且不会进行任何编辑。 Will this have any impact on my SLURM job in progress?这会对我正在进行的 SLURM 作业产生任何影响吗?

It shouldn't effect the current job.应该不会影响现在的工作。

Whenever two different programs open a file on Unix operating systems, the operating system creates different entries in the global file table.每当两个不同的程序在 Unix 操作系统上打开一个文件时,操作系统都会在全局文件表中创建不同的条目。 Since they have different context (like current position, mode, etc.) a reader won't interfere with a writer.由于它们具有不同的上下文(如当前 position、模式等),读者不会干扰作者。 You will likely just read partial information.您可能只会阅读部分信息。

If you want a safeguard to prevent writing to the file, you can use vim -R file to open the file in read-only mode.如果您想要防止写入文件的保护措施,可以使用vim -R file以只读模式打开文件。 You can also use tail -f to "follow" the file, writing output to the terminal as information is appended to the file.您还可以使用tail -f来“跟踪”文件,将 output 写入终端,因为信息已附加到文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM