winfsp / cgofuse

Cross-platform FUSE library for Go - Works on Windows, macOS, Linux, FreeBSD, NetBSD, OpenBSD
https://winfsp.dev
MIT License
511 stars 82 forks source link

Queuing OS calls #43

Closed tomcat-bit closed 4 years ago

tomcat-bit commented 4 years ago

This is a question rather than an issue: how do cgofuse manage concurrent invocations? Does each OS invocation run as a separate thread or are they queued on the same thread? For example, if I run multiple instances of echo "foo" >> file.txt, how does the library handle such a case?

billziss-gh commented 4 years ago

@thomasbn94 this is a complicated subject that depends on the underlying user-mode and kernel-mode components of the underlying FUSE implementation (recall that cgofuse runs on many different systems).

In general FUSE does not provide you with any thread-safety guarantees, unless you run with the -s option which guarantees you serialized requests. So you should assume that you may get concurrent calls on multiple threads and that you must properly protect your file system data structures using appropriate synchronization.