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 Answer
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.