Reference counting, Operating System

The idea of reference counting is to maintain, for every object, the total number of references to that object, i.e. the number of "incoming" pointers. Whenever the number of references is zero we know that the object is not accessible through any pointers, and thus it is garbage. Also, whenever we choose to delete some useless object,we have to recursively check that object to see if it contains pointers to other objects; if so, we have decrement the reference counters for those objects as well. One problem of reference counting, though, is how to deal with cycles. Suppose object A points to B, and B points to A. If these objects can only be reached through each other, we have to free them too, even though their counters are not zero! Note that cycles can common inmany data structures; for example, consider a doubly-linked list. The commonly adopted solution to this problem is to run mark-sweep now and then, in order to remove cyclic references, and then run normal reference counting on the rest of the time.

Posted Date: 3/13/2013 2:56:10 AM | Location : United States







Related Discussions:- Reference counting, Assignment Help, Ask Question on Reference counting, Get Answer, Expert's Help, Reference counting Discussions

Write discussion on Reference counting
Your posts are moderated
Related Questions
Basic concepts When a process is to be changed in, the pager guesses which pages will be used before the process is changed out again. Instead of swapping in a entire process,

Transparency : Users must be able to access remote resources as though these resources were local. Transparency should as well promote user mobility. Users must be allowed to lo

Hierarchical paging Single way is to use a two-level paging algorithm, in which the page table itself is also paged. A logical address is separated into a page number and a pag

Second chance Algorithm When the page is chosen the reference bit is checked to see whether it has been referenced before. If that is the case after that it is given a second c

Garbage collectors trade space for time. If we collect all the time (which requires a lot of processing time), the GC allocator will use the least memory possible. On the other han

Q. Explain about Deadlocks? Deadlocks for (int i = 0; i // first find a thread that can finish for (int j = 0; j if (!finish[j]) { boolean temp = true; for

Write a short note on PCB? Every process is represented in the operating system by a process control block also called a task control block. It contains more information regard

Acyclic-graph directories An acyclic graph permits directories to have shared subdirectories and files. The similar file or subdirectory may be in two dissimilar directories. A


File structure Certain files must conform to a needed structure that is understood by the operating system. The operating system may consist that an executable file has a parti