摘要 |
<p>A data processing method and apparatus are described for mark-sweep garbage collection through stored data structures defined by data objects in a multi threading environment supporting the handling of finalisers. Pipelining of the marking (MA) and sweeping (GC) states is enabled by increasing the number of mark states M to four, namely Marked, Unmarked, Pending or Deletable. The sweeping stage GC consists of a linear sweep across the heap in which any objects with M = Deletable (detected non-reacheables) are deleted at point D1, whilst objects with finalisers and M = Pending are placed on a finaliser queue and marked. The finalising stage executes finalisers for objects on the finaliser queue (D2). The method includes a synchronisation point (SP) where the results of the mark phase are passed onto the sweeping phase. The synchronisation point performs the following operation of rotating M for all objects; this operation converts the systems perception of the stored code indicating Marked to indicate Unmarked, with similar conversion for Unmarked to Pending, and Pending to Deletable. In operation, it takes two garbage collection cycles to move an Unmarked object to the Deletable state (D3), which is long enough to detect finaliser-reachability in the intervening mark phase.</p> |