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

Support OS-specific FileExt traits. #7

Open
songzhi opened this issue Oct 29, 2020 · 2 comments
Open

Support OS-specific FileExt traits. #7

songzhi opened this issue Oct 29, 2020 · 2 comments

Comments

@songzhi
Copy link

songzhi commented Oct 29, 2020

Unix FileExt and Windows FileExt. They are useful when using .read_at(buf, offset) instead of .seek(pos); .read(buf). Because it calls pread(2) instead of lseek(2) + read(2) which is more efficient.

@mainrs
Copy link

mainrs commented Oct 5, 2022

I'd be willing to work on this (at least for linux), I need it for a project. Would it be possible to get some guidance on how to properly implement this?

I do have a question about this feature though: would this allow one to make multiple read_at,write_at calls in parallel? Or is this, on the kernel level, still a sync operation? Even if the offsets do not collide with each other?

@songzhi
Copy link
Author

songzhi commented Oct 9, 2022

@mainrs See this docs for pread(2)/pwrite(2):

The pread() and pwrite() system calls are especially useful in multithreaded applications. They allow multiple threads to perform I/O on the same file descriptor without being affected by changes to the file offset by other threads.

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

No branches or pull requests

2 participants