0

On Linux (with ext4) I can open a video file for playback as it is being downloaded via another program (my browser, wget, a torrent client with sequential downloading enabled, etc). My media player will happily play it back for me without any hiccups, so long as the file streams in faster than I can play it back. On the other hand, Windows pretty much won't let you do anything with a file while another program is writing to it. What about ext4 makes this possible that isn't present on filesystems like NTFS?

1
  • What is your Windows setup? At one point I recall I had a video file downloading in CyberFox in PM and I was able to play the file in vlc.
    – user494585
    Commented Mar 24, 2017 at 21:14

1 Answer 1

0

It's not so much about "features" of ext4 or any other Linux filesystem that makes it possible, it's about the defaults when opening files using application programmer's interface (API) on each platform.

On Windows, CreateFile without further options prevents any other processes from opening it at the same time. You have to explicitely specify a FILE_SHARE option if you want to allow other processes to do so.

On Linux, creating a file with fopen using mode w or w+ allows all other processes to read and write it. You have to explicetely use other system calls like flock to prevent that.

That's the reason why a newly created file (by your browser, wget etc.) can be read by default on Linux, while it is not shared by default on Windows. In principle, if the programmers had wanted, they could also do it the other way round. But that would require additional effort.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .