title: How to add thread correctly in fuse
body: <p>I'm working on a filesystem project based on FUSE. And I want to add some sort of read ahead to it. So I create a thread to process such tasks, but It seems that I made it really slower than I thought.(Even if I just add a idle thread, it makes my program become much more slower than without that, but that do not happened when I added this function to my server program, which do not use fuse)</p>
  
  <p>I did not simply use fuse_main function, instead I read the sshfs's code and try to initialize it by myself with the following functions, </p>
  
  <pre><code>fuse_parse_cmdline
  fuse_mount
  fcntl
  fuse_new
  fuse_daemonize
  fuse_set_signal_handlers
  fuse_loop_mt
  </code></pre>
  
  <p>and without add the thread, it runs pretty well, but after I add this thread in</p>
  
  <pre><code>pthread_create(&amp;tid, NULL, test, NULL); // function test is just a while(1){}
  </code></pre>
  
  <p>it get slower(Read a 100M file, without this thread it is 40s, and with that it is nearly 100s)</p>
  
  <p>Is this something to do about schedparam or something else?
  Hope you guys could give me some advice, like what things I need to check.</p>
  
  <p>Thanks again.</p>