acozzette / BUSE

A block device in user space for Linux
GNU General Public License v2.0
240 stars 47 forks source link

multithreading questions #10

Closed divinity76 closed 7 years ago

divinity76 commented 7 years ago

didn't know where else to ask, but it's not clear to me, do i have to account for the possibility of several threads calling any combination of buse_operations.write / buse_operations.read at the same time? or will only 1 instance of those functions be ran at any given time? (important for instance if i have a static buffer area for writes)

bandi13 commented 7 years ago

It's one at a time. There's no multithreading in this version. Request comes in via NBD, it gets sent to the write/read operation, then reply sent back to NBD. Same goes for my CPP version (https://github.com/bandi13/BUSE-CPP).

You could add multithreading if you wanted by reading requests from NBD until there's nothing left to read or there's something ready to reply, but you'll have to make sure that you send the replies in the order the requests came in.

divinity76 commented 7 years ago

thank you :)