如果进程是SIGKILLed,操作系统(POSIX)是否刷新内存映射文件? [英] Does the OS (POSIX) flush a memory-mapped file if the process is SIGKILLed?
问题描述
如果某个进程被SIGKILL杀死,对内存映射文件所做的更改是否会刷新到磁盘上?我假设如果操作系统确保在通过SIGKILL杀死进程时将内存映射文件刷新到磁盘,那么它也将使用其他终止信号(SIGABRT,SIGSEGV等)来实现.
If a process is killed with SIGKILL, will the changes it has made to a memory-mapped file be flushed to disk? I assume that if the OS ensures a memory-mapped file is flushed to disk when the process is killed via SIGKILL, then it will also do so with other terminating signals (SIGABRT, SIGSEGV, etc...).
推荐答案
这将取决于是否使用私有(MAP_PRIVATE)修改(MAP_SHARED)打开内存映射文件.如果是私人的,则否;修改将不会写回到磁盘.如果共享,则内核缓冲池将包含修改后的缓冲区,并且无论何时导致死亡,这些缓冲区都会在适当的时候写入磁盘.
It will depend on whether the memory-mapped file is opened with modifications private (MAP_PRIVATE) or not (MAP_SHARED). If private, then no; the modifications will not be written back to disk. If shared, the kernel buffer pool contains the modified buffers, and these will be written to disk in due course - regardless of the cause of death.
这篇关于如果进程是SIGKILLed,操作系统(POSIX)是否刷新内存映射文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!