Conservative garbage collection, Operating System

Assignment Help:

Conservative GC can be used for languages such as C and C++, which were not explicitly designed for garbage collection. This is a non-copying technique. A conservative garbage collector is one that, instead of knowing the exact location of each object, discovers the set of live objects by scanning a region of memory, looking for areas that may be objects. Because C and C++ allow casting, anything that can hold a pointer could conceivably be a pointer, such as an unsigned long which is cast as a pointer, or a ?oating-point type which is cast as a pointer, etc. Conservative GC more or less uses the "duck test", paraphrased here as "if it looks like a pointer and acts like a pointer, it's probably a pointer". Starting from the roots, we can ?nd all objects which look like pointers, and the objects to which they would point if they were in fact pointers, and mark those objects as live. By doing this, we can provide garbage collection to languages which otherwise would not support it.

The possible objects found may or may not actually be objects, but we are ensured that all live objects referred to from that particular area are found by the garbage collector. Since we must discover the areas that might be objects, we also have to know how to identify pointers; usually, if something looks like a pointer, we assume it is a pointer. Then, conservative GC traces through those "pointers", marking everything that is still live.

Some of the drawbacks of this method are: 1) areas of memory that look like pointers to objects, but aren't, cause garbage objects to be retained as long as the fake pointer exists; this increases memory usage of the garbage collector, and can cause other limited resources to be exhausted; and 2) the methods of ?nding exactly which areas to trace aren't always portable.


Related Discussions:- Conservative garbage collection

Write a note on the usage of semaphores, Write a note on the usage of semap...

Write a note on the usage of semaphores. Semaphore is a synchronization tool and it is a variable having integer values. It is accessed only by two standard atomic operations w

Illustrate advantages and inconveniences of klt, ADVANTAGES AND INCONVENIEN...

ADVANTAGES AND INCONVENIENCES OF KLT Advantages: the kernel be able to simultaneously schedule many threads of the same process on many processors blocking

Explain the scheduleworktodo function used in netware, Explain the Schedule...

Explain the ScheduleWorkToDo Function used in Netware ScheduleWorkToDo(MyThread Function, arg, workToDo) The ScheduleWorkToDo ( ) function is specific to NetWare 4.0. This c

What is indexed allocation, What is indexed allocation? Every file has ...

What is indexed allocation? Every file has its own block of pointers to the sectors of the file.

Software Support (Introducing Operating Systems), The questions ask List fo...

The questions ask List four major functions of an OS. My answer: Function 1: Provide a user interface Function 2: Manage files Function 3: Manage hardware Function 4: Manage appli

Determine a critical section is a program segment, Determine a critical sec...

Determine a critical section is a program segment  Critical section is where shared resources are accessed

What is internal fragmentation?, What is internal fragmentation? Consid...

What is internal fragmentation? Consider holes of 20k assume the process requests 18 bites. If we allocate accurately the request block, we are left with a hole of 2k. The over

What is the purpose of system calls, Q. What is the purpose of system calls...

Q. What is the purpose of system calls? Answer: System calls permit user-level processes to request services of the operating system.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd