Tuesday, November 01, 2005

Garbage collection

Well I was reading about shared memory in my parallel processing text. Interestingly shared memory is *not* deallocated when the program terminates. I didn't know that and unfortunately all of my programs which use shared memory don't explicitly deallocate it :(
The interesting thing is that shared memory and heap allocated memory are similar in the extent that both need to be explicitly allocated and deallocated. So I asked to myself, if that is the case can garbage collection be applied to shared memory? As in, the shared memory gets deallocated automatically when all the processes using that shared memory die. There is no need to explicitly deallocate the shared memory. If there needs to be this kind of a GC then I guess it should be built right into the operating system, so that it can conveniently keep track of the processes and the references to the shared memory.
Aw well I don't know why I wrote all this. Don't know if this is practical or of any use.

No comments: