If we want the operating system to release a shared segment after stopping all the processes attached to it, it should me marked for deletion. But the problem here is that I want to start a new instance of the program and if I delete the shared segment, the new program will not be able to attach to the segment. Can anybody suggest a way to mark the shared segment for deletion at the same time attach to the segment?
Shared segment after stopping all the processes attached to it?
This is not possible since the instance of the program you are trying to associate is being deleted by the user so how come the program knows that you have deleted it.
However, you can do this thing by hardcore method.
1. First make a list of all the segments that are being used inside the operating system that you want to keep track off.
2. Now group them according to their features that you need to see.
3. After that start deleting them one by one so that you can yourself tracks the deletion process.
4. Once you are done with all the deletion, feed the rest of the data to the program so that it has the required number of segments that you need it to have.