Question

well,i wondered:

What complications could arise in a time-sharing/ multitasking system if two processes require access to the same file at the same time? Are there cases in which the file manager should grant such requests? Are there cases in which the file manager should deny such requests?

Was it helpful?

Solution

It depends on the type of access that the processes want to perform.

In case both of them are readers, there is tipically no issue in allowing them to read the file concurrently, since no modifications are performed on the content itself. In this situation you can think of it as a constant variable: access is not destructive. On the other hand, if at least one of the processes wants to write on the file, then generally it is granted exclusive access to it, otherwise the data received by the other processes would be inconsistent.

Of course the operating system could provide mechanisms to allow multiple readers and a writer to act concurrently by using for example buffering techniques, but the generale rule of thumb is the one expressed above.

Also, requests are generally not denied, but rather delayed, since the process would still be able to access the file at some point in the future under normal circumstances. The situations in which the access is denied is when the process has not the right privileges to access the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top