Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jnr-fuse and mutithreading? #24

Closed
omllobet opened this issue Sep 4, 2017 · 6 comments
Closed

jnr-fuse and mutithreading? #24

omllobet opened this issue Sep 4, 2017 · 6 comments

Comments

@omllobet
Copy link

omllobet commented Sep 4, 2017

Hi SerCeman,

We see that when we open a new file operation in a mounted directory like copying two files, the amount of bandwidth is divided between the two operations. My understanding is that it is because of the jnr-fuse and that the libfuse library supports multithreading.

So is it possible to implement multithreading using jnr-fuse? Are there any limitations in jnr preventing that?

Thanks for any comments you make about the topic.

@SerCeMan
Copy link
Owner

SerCeMan commented Sep 4, 2017

Hi, @omllobet!

So is it possible to implement multithreading using jnr-fuse? Are there any limitations in jnr preventing that?

Yes, it is possible. No, there are no limitations. jnr-fuse is a direct wrapper around fuse that directly calls fuse methods. That also implies that your filesystem implementation has to be thread-safe.

@omllobet
Copy link
Author

omllobet commented Sep 5, 2017

Hi @SerCeMan
Thanks for your answer. Do you have any example of a jnr-fuse filesystem using multithreading? If not, could you give me some recommendations or hints or a general idea to get me started? For example in my mind it is not clear how a fuse operation would be translated to it's own thread in java.

Thanks

@SerCeMan
Copy link
Owner

SerCeMan commented Sep 5, 2017

Hi, @omllobet!

You can think of it as "I don't know the thread that every single fuse method will be called on and I'll have to synchronise access to all shared state.". MemoryFS is an example of a thread-safe FS. Although it is not non-blocking, it uses synchronized.

@omllobet
Copy link
Author

omllobet commented Sep 5, 2017

Hi @SerCeMan

Thanks for the information, it is a read only filesystem and not very complicated, so it should be doable. It is enough to have multithreading in the filesystem just by making it threadsafe?

The calling part is where my mind has more problems. But if I understand correctly If I do 2 copy operations on the mounted filesystem each one will go to the same thread in java or not? something like cp program-> c library -> system call -> kernel -> (fuse ) -> libfuse ->java program. Do I have to create the threads in java to be able to manage various call (like in a rest program where there are some threads waiting for incoming connections) or a thread is created by libfuse for each operation?

Thanks again!

@SerCeMan
Copy link
Owner

SerCeMan commented Sep 8, 2017

Do I have to create the threads in java to be able to manage various call

You don't have to create threads manually. Given that Java thread is a wrapper around a native thread, you'll be operating on a thread created by fuse. You can also read a discussion around a similar question: https://sourceforge.net/p/fuse/mailman/fuse-devel/thread/45D1DEC0.2090504@nortel.com/ for references.

@omllobet
Copy link
Author

Great, thanks for the information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants