mmap 用于跨任意进程快速访问,
fcntl 用于共享内存区域的保护锁(读共享,写互斥)
二者可能不能共用: Shared mmap co-ordination using fcntl locks?
所以单独用锁文件就好了,简单有效
message publisher
import mmap
try:
import fcntl
except ImportError:
fcntl = None
from time import sleep, time
with open('db', "w") as f:
for i in range(1000):
f.write(1 * 1024 * 1024 * '\0')
f.close()
end = "a".encode() * 200 * 1024 * 1024
with open