Blockquote
how does O.S know that writer is still writing. ?... What is workflow of EOF for file(closing file handle like ^D or ^z) ? what happens if EOF is never written ?
what happens if readers reading rate is faster than writer's writing speed ? Can a rate mismatch result in deadlock ?
what can be other unwanted scenarios ?
How does O.S calculate EOF while reading file ?
-Nikhil
P.S: Current Operating system is windows but I don't mind learning interesting feature for the same on unix too.
Blockquote
More Edits and More info on the Question
Now that I know EOF is no character,So it cannot be written on the data of file. IF O.S. determines the EOF using File_size like what even @saurabh pointed.
(->) EOF while Reading ( Would probably be determined from file size which would stored in drive table of appropriate File system) )
- So does process keeps polling File table for file size to determine EOF as there could be cases of not-fixed files size.
- To my little knowledge, EOF is encountered when you read beyond the EOF(in our case file-size). Assume a situation where writer is writing intermittently and reader is reading blocks. SO if reader tries to read more than the available chunk would EOF be thrown ? But Writer has not signalled EOF yet ?