Is time stamp used in process to free its resources if it holds resources for long time ?? if yes then in process state diagram there is no connection between block(wait) state and terminate state but both are connected via running state.so here a anomaly in concept arises that if a process has to quit from wait state then it has to go via running state.
1 Answers
The OS can't indiscriminately kill a process if it holds a resource for a long time.
Would you kill a 24/7
server who waits on a socket?
Would you kill a process who keeps a file opened? After how long? What if the process actually needs to keep the file opened for days? If you think it can't possibly need that much, let me give you this scenario: a computationally intensive process who takes days to compute all it's data. Big data. It uses a file as a "cache/buffer". It writes to it and reads from it continuously. As such it holds the file open all this time.
Would you kill a process who waits on a lock? After how much time? 10 minutes? 1 hour? 10 hours? 5 days? What if the purpose of that process is to do a cleanup or smth after some other process has released the lock, be it if that other process held it for 1 second or for 2 weeks?

- 72,283
- 15
- 145
- 224
-
Let us take a instance where a process is running which contains virus , but the process has kept some resources in hold when during process execution a antivirus detects the virus and kills the process and frees the resources. – Rahul Nandi Jan 09 '16 at 18:47
-
@RahulNandi "an ativirus[...] kills the process" this does not apply to my point. I begin my post with "The OS can't indiscriminately kill a process if it holds a resource for a long time" – bolov Jan 09 '16 at 18:50