








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









RCGC is naturally incremental, how about making it concurrent โฆ
๏ Steeleโs multiprocessing, compactifying collector ๏ Dijkstraโs on-the-fly collector ๏ Kung and Song improved four-color collector ๏ Yuasa sequential collector ๏ Uses snapshot-at-the-beginning write-barrier ๏ Compared using these metrics ๏ Operation of write-barrier ๏ Treatment of new objects ๏ Cost of initialization & termination of each GC cycle
๏ Kung & Song: ๏ Push roots on double-ended mark queue one at a time ๏ Incremental: mutatorโs computation is unrestricted ๏ Yuasa: ๏ Copy entire program stack to saved_stack using a fast copy method (e.g. UNIX memcpy ) ๏ Entries in saved_stack transferred to mark stack k2 at a time ๏ Reduces fragmentation
๏ Concurrent system: ๏ Multiple processes or thread execute at the same time and potentially interact with each other ๏ Collector locks mark stack while examining it
๏ Updating a RC must be atomic to avoid race conditions between threads ๏ Can lead to premature collection of objects ๏ Atomicity requires locking shared objects ๏ Increases cost of pointer assignment ๏ Increase mutator performance ๏ Run collector in separate thread ๏ Make collector responsible for updating RC fields ๏ Mutators no longer update RC but log assignments in a block of a transaction queue (figure on next slide)
Jones and Lin: Diagram 8.
๏ Distinguish assignments to local variables from assignments to global variables and heap data ๏ Only reference count shared-pointer-valued-variables ๏ RC is only lower bound of refs to object from local & shared variables
update(A, C){ LOCK mutex insert (A, C, tq) // insert in transaction queue if( tq is full){ notify_collector(tq) // send block to collector tq = gt_next_block() } *A = C }
13
collector(){ while (; ;){ tq = wait_next_block() for each thread th { LOCK mutex{ suspend(th) scan_thread(th) restart(th) } } adjust_counts(tq) free_block(tq) adjust_shared_copunts() process_ZCL() }
๏ If objectโs shared RC no longer 0, it is removed from ZCL ๏ If object is found in a thread state, it is left in ZCL ๏ It may be freed in future collection ๏ Otherwise object is removed from ZCL and recursively freed ๏ Note: Can reduce cost of assignment ๏ Use per thread transaction queue