CN102722415A - Garbage collecting method based on Java system on chip (SoC) with stack system structure - Google Patents

Garbage collecting method based on Java system on chip (SoC) with stack system structure Download PDF

Info

Publication number
CN102722415A
CN102722415A CN2012101616558A CN201210161655A CN102722415A CN 102722415 A CN102722415 A CN 102722415A CN 2012101616558 A CN2012101616558 A CN 2012101616558A CN 201210161655 A CN201210161655 A CN 201210161655A CN 102722415 A CN102722415 A CN 102722415A
Authority
CN
China
Prior art keywords
java
garbage
thread
soc
collector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012101616558A
Other languages
Chinese (zh)
Other versions
CN102722415B (en
Inventor
徐永键
陆许明
刘征
杨德胜
梁猷
张煊文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Kingray Information Technology Co., Ltd.
SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE
Original Assignee
GUANGZHOU KINGRAY INFORMATION TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by GUANGZHOU KINGRAY INFORMATION TECHNOLOGY Co Ltd filed Critical GUANGZHOU KINGRAY INFORMATION TECHNOLOGY Co Ltd
Priority to CN201210161655.8A priority Critical patent/CN102722415B/en
Publication of CN102722415A publication Critical patent/CN102722415A/en
Application granted granted Critical
Publication of CN102722415B publication Critical patent/CN102722415B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a garbage collecting method based on a Java system on chip (SoC) with a stack system structure, which is used for a multi-thread dynamic scheduling garbage collector and used for recovering garbage. The life cycle of the Java SoC is divided into a system initialization stage and a real-time task stage, wherein at the Java SoC initialization stage, a Java virtual machine actively calls the garbage collector to carry out single-thread explicit called garbage collection; when an abnormity of 'memory insufficiency' happens, the Java SoC triggers and calls the garbage collector to carry out single-thread explicit called garbage collection; and at the multi-thread real-time task operation stage, a concurrent collector thread schedules the garbage collector to collect garbage in a cycle TC. The garbage collection workflow of the garbage collector comprises the following steps of: 1) scanning root set objects in the Java SoC; 2) marking; 3) copying non-garbage objects from a subspace fromespace to a subspace tospace; 4) sweeping handles; 5) emptying the subspace fromespace; and 6) turning the subspaces fromespace and tospace over.

Description

Garbage collection method based on stack system structure Java SoC system
Technical field
The present invention designs a kind of Java SoC garbage collection method, specifically, designs the garbage collection method based on the Java SoC system of stack system structure that a kind of multithreading dynamic dispatching garbage collector carries out garbage reclamation.
Background technology
In recent years, the Java technology relies on its unique professional platform independence, and good encapsulation and security etc. are widely used in the embedded system.Along with the fast development of superelevation integrated level chip technology and technology, realize that with hardware JVM (Java Virtual Machine) becomes possibility simultaneously, the Java processor arises at the historic moment.Java SoC is that Java processor core, system bus and peripheral control unit etc. are module integrated to a small chip; The travelling speed and the processing power of java applet have not only been improved significantly; And integrated abundant peripheral interface; Be Embedded System Design, particularly embedded Java calculates and uses provides a kind of good solution.
The Java technology is based upon on the basis of automatic memory management, and the application developer can free from the memory management logic of involved and abstruse complicacy, is absorbed in the design of applied business logic, and these characteristics make Java become " favorite " of large scale system exploitation.And all Java automatic memory managements all are to adopt garbage reclamation mechanism to accomplish, and the main body of bearing this function is exactly the important composition module of JVM---garbage collector (Garbage Collector is hereinafter to be referred as GC).The GC of main flow PC platform requires than higher system resource, and its running status is generally unpredictable, is not suitable for embedded and real time environment, otherwise this type systematic does not generally possess the garbage reclamation function yet.
A kind of Java card rubbish recovering method is disclosed in the patented claim " Java card system rubbish recovering method " of one Chinese patent application numbers 200710026998.2; Adopt the single-threaded explicit refuse collection of calling, promptly stop the working method of all (Stop-The-World is called for short STW);, refuse collection stops to carry out other application program when beginning; This mode can realize garbage reclamation, but is directed against the application of Embedded Real-Time environmental area, on the one hand the needed time of unpredictable refuse collection; Can't guarantee on the other hand when application program is carried out, to have reclaimed enough utilizable internal memory, so can't satisfy the high real-time requirement of built-in field.
Summary of the invention
To above deficiency; The invention provides the garbage collection method that a kind of multithreading dynamic dispatching garbage collector that can greatly guarantee the real-time of refuse collection carries out garbage reclamation based on the Java SoC system of stack system structure; It is divided into system initialisation phase and two stages of real-time task stage with the life cycle of Java SoC system; In Java SoC system initialisation phase, initiatively call garbage collector by Java Virtual Machine and carry out the single-threaded explicit refuse collection of calling; When generation " low memory " is unusual, calls garbage collector by Java SoC system triggers and carry out the single-threaded explicit refuse collection of calling; In the multithreading real-time task operation phase, by a concurrent collector thread with cycle T CThe scheduling garbage collector carries out refuse collection, and wherein, collector representes to bear the thread of concrete garbage collector logic, T CThe cycle of expression collector thread.
Three GC chained lists of handle pond definition of said Java SoC system, freeList is used to store the garbage object of not pointing to any object or its sensing and has reclaimed the handle that finishes; GreyList is used to store all by collector thread accesses mistake, but its reference to variable does not have the object handle of traversal; UsedList is used to store the handle of an object of positive sense.
The workflow of the refuse collection of said garbage collector is:
Step 1, object scan: the root set pair in the Java SoC system resembled scan; In the scanning process; Be pressed into the labeled slots that greyList constitutes to the stacked data of the object of all references in the static fields table or mutator thread; Wherein, mutator representes to bear the user thread of application task;
Step 2, mark: from labeled slots greyList, eject an object reference, from its handle, find object-type information, obtain the information GC.info of the instance data type of this object; According to the sequencing of in class, stating each corresponding instance variable of GC.info from low to high; If a certain instance variable is a reference type, then corresponding position 1, garbage collector is based on the GC.info of object type; Stacked all objects of this object reference, promptly be labeled as the grey object;
Step 3, copy: with distributing the object heap to be divided into fromspace and tospace two sub spaces in the Java SoC system; At first obtain the size that needs the copy instance objects; Upgrade the handle structure information of this object reference then; Be copied to a non-garbage object the tospace of subspace from subspace fromespace at last, accomplish the copy of instance data;
Step 4, cleaning handle: after copy finishes; Whether the handle in the inspection usedLis chained list points to subspace tospace, if not, what its sensing was described is garbage object; Can reclaim this handle to redistribute utilization, be about to it and add the freeList chained list to;
Step 5, empty subspace fromspace;
Step 6, subspace upset: the turning operation of atomicity, thus the exchange pointer value is exchanged the role of subspace fromspace and subspace tospace.
The root set pair resembles the source in the said Java SoC system has two kinds:
1) the static reference to variable object pointed in the static referring domain table in the method district;
2) the reference to variable object pointed in the mutator thread stacks,
When not enough or system initialisation phase is accomplished when Java SoC Installed System Memory, only to root collection source 1) in object scan, when getting into the multithreading real-time task stage, periodically scan root collection source 1) originate 2 with the root collection).
The marking operation of said step 2 only occurs among the fromspace of subspace, and during collector thread circulation beginning, tospace distributes new object in the subspace.
Beneficial effect of the present invention:
1, the present invention adopts the concurrent mode of thread to support increment to collect; Be divided into two types of mutator and collector to thread: mutator representes to bear the user thread of application task; Collector representes to bear concrete GC (garbage collector) logic thread; Prevent that the distribution of refuse collection work and object from interweaving to together, be directed against the difference of system's operation task simultaneously, the life cycle of Java SoC is divided into system initialisation phase and two stages of real-time task stage; Improve the efficient of processor, practiced thrift processor resource.
2, the present invention uses for reference classical " baihuixiong " trichromatic diagram algorithm of Dijkstra; 3 GC chained lists of handle pond definition with Java SoC; FreeList is used to store the garbage object of not pointing to any object or its sensing and has reclaimed the handle that finishes; GreyList is used to store all and had been visited by collector but its reference to variable does not have the object handle of traversal, and usedList is used to store the handle of an object of positive sense.In cycle, collector can begin to scan whole handle pond from the handle of some root object at GC, and all objects with adduction relationship all can experience a stage that becomes the grey object, and their handle all can be pressed among the greyList; Can copy tospace to from be hit by a bullet out grey object handle and the object that it is pointed of greyList at cleaning handle stage collector, be equivalent to black to object, and with among its handle adding usedList; When rotary movement took place, all had all become untouchable white object less than the object in usedList and have been recovered.Replace " tree " of description object adduction relationship or more complicated " graph structure " with chained list; The chain table handling and the tree-like traversal that adopt storehouse LIFO form to realize have kept compatibility; The uncertain time complexity of having avoided pure recursive call to produce satisfies the requirement of embedded GC real-time.
3, the source of root collection scanning root object comprises object and the object pointed of the reference to variable in the thread stacks pointed of the static reference to variable in the static referring domain table in the method district among the present invention; Using for reference the thought of SCJ standard simplifies threading model; The mutator that does not allow to be in the scheduling sequence carries out from blocking (self-blocking) operation; Give the collector thread the longest closing time simultaneously, promptly the collector thread operates in lowest priority, has only just to start the collector thread when waiting all mutator threads from task call separately, to return; This moment, other thread stacks all were empty; Root object only is present in the static fields, and advantage is that GC need not scan storehouse, and Java SoC also can obtain the excellent real-time performance in the GC process.
4, only need the assignment instance variable during copy object of the present invention, the handle value of upgrading then in the handle is pointed to new address, just can easily accomplish whole copy function, quickened concurrent-copy the work efficiency of gatherer.
Description of drawings
Fig. 1 is the processing flow chart of garbage collection method of the present invention;
Fig. 2 is the workflow diagram of garbage collector of the present invention;
Fig. 3 is an object storage structural representation of the present invention;
Fig. 4 is the structural drawing in the handle pond of Java SoC of the present invention system;
Fig. 5 is the processing flow chart of method of the present invention district layout signal.
Embodiment
Below in conjunction with accompanying drawing the present invention is further set forth.
Garbage collection method of the present invention is to based on the Java SoC system of stack system structure, and this system only supports Java as target language, and nation method adopts microcode or Java subroutine to realize; Microcode all realized by hardware circuit, thus need not design the nation method stack, in concrete the realization; Physical storage is divided into RAM on outer RAM of processor piece and the sheet; The former is used for the distribution of method district and heap, and the latter is used to make up the Java stack, through balance; Its method is divided into static fields table, byte code table, class formation table, character string constant table and JVM redundant information table five part, as shown in Figure 5.
As shown in Figure 1; The garbage collection method of the Java SoC system based on stack system structure of the present invention is divided into system initialisation phase and two stages of real-time task stage with the life cycle of Java SoC system; Thread is divided into two types of mutator thread and collector threads: the mutator thread is born the user thread of application task; The collector thread is born concrete GC logic; In Java SoC system initialisation phase, initiatively call garbage collector by Java Virtual Machine and carry out the single-threaded explicit refuse collection of calling; When generation " low memory " is unusual, calls garbage collector by Java SoC system triggers and carry out the single-threaded explicit refuse collection of calling; In the multithreading real-time task operation phase, by a concurrent collector thread with cycle T CThe scheduling garbage collector carries out refuse collection, wherein, and T CThe cycle of expression collector thread.
The heap space of Java SoC is divided into handle pond and two parts of object heap among the present invention; The corresponding object of each handle, object storage instance variable data, handle has comprised the pointer of a point at objects first address; Object storage is as shown in Figure 3; The agent object heap (the distributed object heap in the Java SoC system) of garbage collector is divided into fromspace and tospace two sub spaces, the object heap is divided into fromspace and tospace two sub spaces, size is respectively H FromAnd H To, M representes the memory size that distributed in the subspace, specifically uses M FromAnd M ToExpression, G representes will to be collected when the GC cycle begins the size of the garbage object that device reclaims, The size of that represent to distribute in the current GC cycle but untouchable floating object; These objects will be reclaimed by scanning in the cycle at next GC; L representes it is the size of all moving objects, and A representes the size that the mutator thread newly distributes object space in the current GC circulation, and reference copies is divided collection; Big or small H to the heap of the distributed object in the Java SoC system derives, and deriving through method of induction draws:
H=2(L max+A max)
Like this, can guarantee can not exhaust at the internal memory of any GC cycle Java SoC system.
The present invention is based on the mutator thread and confirm the cycle of collector, i.e. GC cycle T CThe maximal value L that moving object takes up room when depending on the circulation beginning MaxThe maximum memory object that distributes with mutator thread in the current circulation A that takes up room Max, set in the Java SoC sets of threads one total n mutually between independent mutator thread, the periodic table of mutator thread i is shown T i, save as a in the monocycle distribution i, use for reference based on classical thread Share Model---the producer/consumer's model, derive collector thread cycle T CAs follows:
T C ≤ H - 2 Σ i = 1 n a i l i - 2 Σ i = 1 n a i 2 Σ i = 1 n a i T i
Definition three GC chained lists in the handle pond of Java SoC system among the present invention; Chained list is as shown in Figure 4; Use for reference classical " baihuixiong " trichromatic diagram algorithm of Dijkstra; FreeList is used to store the garbage object of not pointing to any object or its sensing and has reclaimed the handle that finishes, and greyList is used to store all and visit by collector but its reference to variable does not have the object handle that travels through, and usedList is used to store the handle of an object of positive sense.In cycle, collector can begin to scan whole handle pond from the handle of some root object at GC, and all objects with adduction relationship all can experience a stage that becomes the grey object, and their handle all can be pressed among the greyList; Can copy tospace to from be hit by a bullet out grey object handle and the object that it is pointed of greyList at cleaning handle stage collector, be equivalent to black to object, and with among its handle adding usedList; When rotary movement took place, all had all become untouchable white object less than the object in usedList and have been recovered.Replace " tree " of description object adduction relationship or more complicated " graph structure " with chained list; Advantage is that the chain table handling and the tree-like traversal that adopt storehouse LIFO form to realize have kept compatibility; The uncertain time complexity of having avoided pure recursive call to produce satisfies the requirement of embedded GC real-time.
As shown in Figure 2, the workflow of garbage collector of the present invention is following:
Step 1, scanning root collection: the root set pair resembles the source among the Java SoC has two kinds: the static reference to variable object pointed in the static referring domain table in (1) method district, the reference to variable object pointed in (2) mutator thread stacks.When low memory or system initialisation phase completion, only root collection source (1) is scanned; When getting into the multithreading real-time task stage, need periodically scan root collection source (1) and (2).In the scanning process, be pressed into the labeled slots that greyList constitutes to the stacked data of all references in the static fields table or mutator thread.
Step 2, mark: from labeled slots greyList, eject an object reference; From its handle, find object-type information; Obtain the GC.info of object thus, comprised the information of object instance data type here, according to the sequencing of in class, stating each corresponding instance variable of GC.info from low to high; If a certain instance variable is a reference type, then corresponding position 1.GC is according to the GC.info of object type, and is stacked all objects (white) of this object reference, promptly is labeled as the grey object.
Step 3, copy: be copied to a non-garbage object the tospace from fromespace; At first obtain the size that needs the copy instance objects, upgrade the handle structure information of this object reference then, call the copy that nation method and hardware copy cell are accomplished instance data at last.
Step 4, cleaning handle: after copy finishes; GC can clean the handle pond; Whether the handle in the inspection usedLis chained list points to tospace (dark object), if not, what its sensing was described is garbage object; Can reclaim this handle to redistribute utilization, be about to it and add the freeList chained list to.
Step 5, empty subspace fromspace: in GC work end stage, the only remaining white object of fromspace is used the whole space of 0 initialization at last; This space of next time overturning becomes tospace, can save this operation of acquiescence initialization when redistributing object, accelerates the speed that object generates.
Step 6, subspace upset: the turning operation of atomicity, thus the exchange pointer value is exchanged fromspace and tospace role.
The mark action of step 2 only occurs among the fromspace; Collector when beginning circulation, distribute new object at tospace, the new object of having avoided in return period, being created by mutator has also reduced the quantity that copies in the step 3 because untouchable and become floating refuse.Before end cycle, carry out a simple rotary movement, exchange the role of two sub spaces, get into the recovery operation of next round, advantage is to remove most copy functions from, to real-time good guarantee effect is provided.
Can distribute the big or small H of object heap to derive to Java SoC among the present invention, for guaranteeing that at any GC Java SoC can not exhaust internal memory, promptly satisfies in the cycle
H=H From+H To≥M From+M To (1)
Derive any and once reclaim in the circulation maximal value L that moving object took up room when the upper bound of total internal memory M that each subspace has been distributed was the circulation beginning MaxThe maximum memory object that distributes with mutator thread in the current circulation A that takes up room MaxSum, promptly
M≤L max+A max (2)
Adopt method of induction that formula (2) is proved that subscript n is represented cycle index, S and E represent that respectively round-robin begins and finishes.
At first confirm following several useful equalities, of preamble, in conservative increment type is collected, the floating refuse object during the n time loop ends will become the round-robin garbage object the n+1 time, promptly
G n + 1 = G ~ E n - - - ( 3 )
Moving object when the moving object during the n time loop ends will become the n+1 time circulation beginning, promptly
L S n + 1 = L E n - - - ( 4 )
During the circulation beginning, the space M of having distributed among the fromspace FromGarbage object G and moving object L have been comprised S, promptly have
M From=G+L S (5)
All new objects all distribute in tospace, therefore require to remain unchanged at the inner memory headroom for fromspace of circulation, and all garbage object G are kept among the fromspace, only comprise floating refuse and moving object among the tospace, promptly
M To = G ~ + L - - - ( 6 )
At the beginning of the cycle, tospace is entirely sky, promptly
M To_S=0 (7)
All moving objects are copied into tospace in circulation, and all new objects also distribute in this subspace, so have
M To_E=L S+A (8)
When loop ends, initial moving object L SReach newly assigned object A or become floating refuse, or the maintenance activity, promptly
L S + A = L E + G ~ E - - - ( 9 )
Proof is for circulation for the first time below, and formula (2) is set up.There are not garbage object and moving object at first in circulation for the first time, promptly
G=0 and L S=0
Show that fromspace is empty,
Figure BDA00001669215000105
obviously satisfies formula (2).Tospace has only all newly assigned object A of this circulation 1, and A 1≤A Max, also satisfy formula (2).So formula (2) is set up for circulation for the first time.
Suppose that at present formula (2) sets up for the n time circulation, proof is also set up for the n+1 time below, promptly
M From n + 1 ≤ L max + A max
M To n + 1 ≤ L max + A max - - - ( 10 )
During the circulation beginning, turning operation is carried out in the subspace, and new tospace is cleared, and promptly has
H From n + 1 ⇐ H To n
Figure BDA00001669215000114
For fromspace, then have
M From n = G n + L S n - - - ( 12 )
M From n + 1 = G n + 1 + L S n + 1 - - - ( 13 )
= G ~ E n + L E n
= L S n + A n
In addition because L S≤L MaxAnd A n≤A MaxSo, have
M From n + 1 ≤ L max + A max - - - ( 14 )
For tospace, then have
M To n = G ~ E n + L E n - - - ( 15 )
M To n + 1 = G ~ E n + 1 + L E n + 1 - - - ( 16 )
= L S n + 1 + A n + 1
= L E n + A n + 1
In addition because L E≤L MaxAnd A N+1≤A MaxSo, have
M To n + 1 ≤ L max + A max - - - ( 17 )
So for the n+1 time circulation, formula (2) also is to set up.
In sum, formula (2) is all set up in arbitrary circulation, so be the maximum upper bound of subspace Memory Allocation.Since fromspace and tospace space equal and opposite in direction, promptly
H From = H To = H 2 - - - ( 18 )
In conjunction with formula (1) and (2), the big or small minimum of overall stack can be taken as
H=2(L max+A max) (19)
The present invention is based on the mutator thread and confirm the cycle of collector, i.e. GC cycle T CThe maximal value L that moving object takes up room when depending on the circulation beginning MaxThe maximum memory object that distributes with mutator thread in the current circulation A that takes up room MaxSet in the Java SoC sets of threads one total n mutually between independent mutator thread, the periodic table of mutator thread i is shown T i, save as a in the monocycle distribution iThen have according to supposition
L max = Σ i = 1 n a i - - - ( 20 )
Figure BDA00001669215000123
Attention formula (20) is considered worst condition, has used to round up, but has been not easy to computational analysis, therefore uses more conservative estimated value A ' MaxReplace A Max, as follows
Figure BDA00001669215000124
Formula (15) and formula (16) have provided the heap size H of gatherer MinMinimum value, i.e. H>=2 (L Max+ A Max)
≥ 2 Σ i = 1 i a i + 2 Σ i = 1 n ( T C T i ) a i - - - ( 23 )
For given H, can obtain T CThe conservative estimation value, as follows:
2A’ max≤H-2L max
2 Σ i = 1 n ( T C T i + 1 ) a i ≤ H C - 2 L max - - - ( 24 )
T C ≤ H - 2 L max - 2 Σ i = 1 n a i 2 Σ i = 1 n a i T i - - - ( 25 )
⇒ T C ≤ H - 4 Σ i = 1 n a i 2 Σ i = 1 n a i T i - - - ( 26 )
Consider the shared object that inter-thread communication is used, use for reference based on classical thread Share Model---the producer/consumer's model, producer thread has been distributed an object and has been preserved it with certain mode and quote so that other thread can be visited this object; Other thread, promptly the consumer is responsible for discharging its internal memory after using this object.Set T pExpression producer thread τ pTurnaround time, T cExpression consumer thread τ cTurnaround time; τ pEach period allocated a pMemory headroom, so consumer's thread cycle T cIn, τ pThe memory headroom that distributes altogether does
Figure BDA00001669215000134
Worst condition is T cIncipient stage in its cycle just discharges them with regard to having obtained all objects up to the end cycle stage.Therefore for this producer/consumer's combination, the maximal value L of moving object internal memory MaxFor
Figure BDA00001669215000135
Introduce a following lifetime factor l i:
Figure BDA00001669215000136
L after then expanding MaxCan be expressed as
L max = Σ i = 1 n a i l i - - - ( 27 )
Because the collector thread is responsible for the release of all object spaces, at a maximal value A who reclaims the memory headroom that distributes in the circulation MaxDo not change, so for the producer/consumer's threading model, collector thread cycle T CAs follows:
T C ≤ H - 2 Σ i = 1 n a i l i - 2 Σ i = 1 n a i 2 Σ i = 1 n a i T i
The actual address of object is kept in the handle among the present invention, and the handle that is designed aligns by 8 words, avoids producing memory fragmentation; With regard to object accesses; Handle has been realized the dereference of object with the mode of turn pointer, compares with direct visit, has introduced overhead; But, Java SoC has realized independently internal storage access unit, and address translation is accomplished by hardware circuit fast, effectively reduces time loss and makes it can not cause burden to system's operation.Advantage: 1) simplified the expression of object/array itself, object in the heap or array only need be preserved instance variable or element, and program also need not dereference method table or array size; 2) can expand very easily, to support different internal memory designs; Only need the assignment instance variable when 3) copying object, the handle value of upgrading then in the handle is pointed to new address, just can easily accomplish whole copy function, has quickened the work efficiency of concurrent-copy gatherer.
The above is merely preferred embodiments of the present invention; The present invention is not limited to above-mentioned embodiment; In implementation process, possibly there is local small structural modification; If various changes of the present invention or modification are not broken away from the spirit and scope of the present invention, and belong within claim of the present invention and the equivalent technologies scope, then the present invention also is intended to comprise these changes and modification.

Claims (5)

1. garbage collection method based on the Java SoC system of stack system structure; It is characterized in that; It is divided into system initialisation phase and two stages of real-time task stage with the life cycle of Java SoC system; In Java SoC system initialisation phase, initiatively call garbage collector by Java Virtual Machine and carry out the single-threaded explicit refuse collection of calling; When generation " low memory " is unusual, calls garbage collector by Java SoC system triggers and carry out the single-threaded explicit refuse collection of calling; In the multithreading real-time task operation phase, by a concurrent collector thread with cycle T CThe scheduling garbage collector carries out refuse collection, and wherein, collector representes to bear the thread of concrete garbage collector logic, T CThe cycle of expression collector thread.
2. the garbage collection method of the Java SoC system based on stack system structure according to claim 1; It is characterized in that; Three GC chained lists of handle pond definition of said Java SoC system, freeList is used to store the garbage object of not pointing to any object or its sensing and has reclaimed the handle that finishes; GreyList is used to store all by collector thread accesses mistake, but its reference to variable does not have the object handle of traversal; UsedList is used to store the handle of an object of positive sense.
3. the garbage collection method of the Java SoC system based on stack system structure according to claim 2 is characterized in that the workflow of the refuse collection of said garbage collector is:
Step 1, object scan: the root set pair in the Java SoC system resembled scan; In the scanning process; Be pressed into the labeled slots that greyList constitutes to the stacked data of the object of all references in the static fields table or mutator thread; Wherein, mutator representes to bear the user thread of application task;
Step 2, mark: from labeled slots greyList, eject an object reference, from its handle, find object-type information, obtain the information GC.info of the instance data type of this object; According to the sequencing of in class, stating each corresponding instance variable of GC.info from low to high; If a certain instance variable is a reference type, then corresponding position 1, garbage collector is based on the GC.info of object type; Stacked all objects of this object reference, promptly be labeled as the grey object;
Step 3, copy: with distributing the object heap to be divided into fromspace and tospace two sub spaces in the Java SoC system; At first obtain the size that needs the copy instance objects; Upgrade the handle structure information of this object reference then; Be copied to a non-garbage object the tospace of subspace from subspace fromespace at last, accomplish the copy of instance data;
Step 4, cleaning handle: after copy finishes; Whether the handle in the inspection usedLis chained list points to subspace tospace, if not, what its sensing was described is garbage object; Can reclaim this handle to redistribute utilization, be about to it and add the freeList chained list to;
Step 5, empty subspace fromspace;
Step 6, subspace upset: the turning operation of atomicity, thus the exchange pointer value is exchanged the role of subspace fromspace and subspace tospace.
4. the garbage collection method of the Java SoC system based on stack system structure according to claim 3 is characterized in that, the root set pair resembles the source in the said Java SoC system has two kinds:
1) the static reference to variable object pointed in the static referring domain table in the method district;
2) the reference to variable object pointed in the mutator thread stacks,
When not enough or system initialisation phase is accomplished when Java SoC Installed System Memory, only to root collection source 1) in object scan, when getting into the multithreading real-time task stage, periodically scan root collection source 1) originate 2 with the root collection).
5. the garbage collection method of the Java SoC system based on stack system structure according to claim 4; It is characterized in that; The marking operation of said step 2 only occurs among the fromspace of subspace, and during collector thread circulation beginning, tospace distributes new object in the subspace.
CN201210161655.8A 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure Active CN102722415B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210161655.8A CN102722415B (en) 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210161655.8A CN102722415B (en) 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure

Publications (2)

Publication Number Publication Date
CN102722415A true CN102722415A (en) 2012-10-10
CN102722415B CN102722415B (en) 2014-11-05

Family

ID=46948192

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210161655.8A Active CN102722415B (en) 2012-05-22 2012-05-22 Garbage collecting method based on Java system on chip (SoC) with stack system structure

Country Status (1)

Country Link
CN (1) CN102722415B (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559076A (en) * 2013-11-04 2014-02-05 飞天诚信科技股份有限公司 Method and device for managing object heap by using parasitic object
CN104808968A (en) * 2014-01-23 2015-07-29 腾讯科技(北京)有限公司 Global data storage and reporting method, device and system
CN105404589A (en) * 2015-10-29 2016-03-16 天脉聚源(北京)教育科技有限公司 Garbage collection method and apparatus
CN106599151A (en) * 2016-12-07 2017-04-26 Tcl集团股份有限公司 Method and system for parallel cleaning of Android engineering useless resources
WO2017167061A1 (en) * 2016-03-29 2017-10-05 阿里巴巴集团控股有限公司 Parallel marking processing method and device for garbage collection
CN108845864A (en) * 2018-06-27 2018-11-20 北京京东尚科信息技术有限公司 A kind of JVM rubbish recovering method and device based on spring frame
CN108958940A (en) * 2018-07-09 2018-12-07 苏州浪潮智能软件有限公司 A kind of computer processing method and device
CN109582590A (en) * 2017-09-28 2019-04-05 慧与发展有限责任合伙企业 Pointer in the system of memory management
CN109726078A (en) * 2018-12-28 2019-05-07 广东亿迅科技有限公司 A kind of method and device without intrusion JVM thread storehouse acquisition
CN110325969A (en) * 2017-02-01 2019-10-11 微软技术许可有限责任公司 Multistage garbage collector
CN110955611A (en) * 2018-09-27 2020-04-03 爱思开海力士有限公司 Memory system and operating method thereof
CN112114862A (en) * 2019-06-20 2020-12-22 普天信息技术有限公司 spring boot instance concurrency processing method and device
CN113360274A (en) * 2020-03-04 2021-09-07 阿里巴巴集团控股有限公司 Garbage recycling method and device and computing equipment
CN113296883B (en) * 2021-02-22 2023-08-04 阿里巴巴集团控股有限公司 Application management method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101046755A (en) * 2006-03-28 2007-10-03 郭明南 System and method of computer automatic memory management
US20110296132A1 (en) * 2010-05-31 2011-12-01 International Business Machines Corporation Garbage collection in an in-memory replication system
CN102270134A (en) * 2011-08-09 2011-12-07 北京握奇数据系统有限公司 Method and device for recycling garbage in Java card

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101046755A (en) * 2006-03-28 2007-10-03 郭明南 System and method of computer automatic memory management
US20110296132A1 (en) * 2010-05-31 2011-12-01 International Business Machines Corporation Garbage collection in an in-memory replication system
CN102270134A (en) * 2011-08-09 2011-12-07 北京握奇数据系统有限公司 Method and device for recycling garbage in Java card

Cited By (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559076B (en) * 2013-11-04 2016-09-28 飞天诚信科技股份有限公司 A kind of method and apparatus using parasitic objects management object heap
CN103559076A (en) * 2013-11-04 2014-02-05 飞天诚信科技股份有限公司 Method and device for managing object heap by using parasitic object
CN104808968B (en) * 2014-01-23 2019-04-30 腾讯科技(北京)有限公司 Storage, report method and the device and system of global data
CN104808968A (en) * 2014-01-23 2015-07-29 腾讯科技(北京)有限公司 Global data storage and reporting method, device and system
CN105404589A (en) * 2015-10-29 2016-03-16 天脉聚源(北京)教育科技有限公司 Garbage collection method and apparatus
CN105404589B (en) * 2015-10-29 2019-04-30 天脉聚源(北京)教育科技有限公司 A kind of rubbish recovering method and device
US11003578B2 (en) 2016-03-29 2021-05-11 Banma Zhixing Network (Hongkong) Co., Limited Method and system for parallel mark processing
WO2017167061A1 (en) * 2016-03-29 2017-10-05 阿里巴巴集团控股有限公司 Parallel marking processing method and device for garbage collection
CN107239406A (en) * 2016-03-29 2017-10-10 阿里巴巴集团控股有限公司 Parallel mark processing method and processing device for garbage reclamation
CN107239406B (en) * 2016-03-29 2021-03-09 斑马智行网络(香港)有限公司 Parallel marking processing method and device for garbage recovery
CN106599151A (en) * 2016-12-07 2017-04-26 Tcl集团股份有限公司 Method and system for parallel cleaning of Android engineering useless resources
CN110325969A (en) * 2017-02-01 2019-10-11 微软技术许可有限责任公司 Multistage garbage collector
CN110325969B (en) * 2017-02-01 2023-06-02 微软技术许可有限责任公司 Multi-stage garbage collector
CN109582590A (en) * 2017-09-28 2019-04-05 慧与发展有限责任合伙企业 Pointer in the system of memory management
CN109582590B (en) * 2017-09-28 2023-07-14 慧与发展有限责任合伙企业 Pointers in a memory managed system
CN108845864A (en) * 2018-06-27 2018-11-20 北京京东尚科信息技术有限公司 A kind of JVM rubbish recovering method and device based on spring frame
CN108958940A (en) * 2018-07-09 2018-12-07 苏州浪潮智能软件有限公司 A kind of computer processing method and device
CN110955611A (en) * 2018-09-27 2020-04-03 爱思开海力士有限公司 Memory system and operating method thereof
CN110955611B (en) * 2018-09-27 2023-04-07 爱思开海力士有限公司 Memory system and operating method thereof
CN109726078A (en) * 2018-12-28 2019-05-07 广东亿迅科技有限公司 A kind of method and device without intrusion JVM thread storehouse acquisition
CN112114862A (en) * 2019-06-20 2020-12-22 普天信息技术有限公司 spring boot instance concurrency processing method and device
CN112114862B (en) * 2019-06-20 2023-12-22 普天信息技术有限公司 Method and device for concurrency processing of spring boot instances
CN113360274A (en) * 2020-03-04 2021-09-07 阿里巴巴集团控股有限公司 Garbage recycling method and device and computing equipment
CN113296883B (en) * 2021-02-22 2023-08-04 阿里巴巴集团控股有限公司 Application management method and device

Also Published As

Publication number Publication date
CN102722415B (en) 2014-11-05

Similar Documents

Publication Publication Date Title
CN102722415B (en) Garbage collecting method based on Java system on chip (SoC) with stack system structure
US7937419B2 (en) Garbage collection via multiobjects
Flood et al. Parallel garbage collection for shared memory multiprocessors
US7143124B2 (en) Detection of dead regions during incremental collection
CN101221535B (en) Garbage recovery mobile communication terminal of Java virtual machine and recovery method thereof
KR20010020495A (en) Bounded-pause time garbage collection system and method including write barrier associated with source and target instances of a partially relocated object
JP4756231B2 (en) Method, computer readable medium, computer system, and memory for enhancing the effectiveness of garbage collection for cleaning
CN1687904A (en) Method for controlling smart card storage environment
US8631051B2 (en) Hybrid fragmenting real time garbage collection
JP2009037546A (en) Memory management method utilizing thread-inherent area and computer using same method
Sachindran et al. MC2: High-performance garbage collection for memory-constrained environments
US8447793B2 (en) Efficient remembered set for region-based garbage collectors
US11550714B2 (en) Compiling application with multiple function implementations for garbage collection
CN104035879A (en) Memory allocation and garbage collection method based on life-period prediction
US8990532B2 (en) Method of managing memory in computer system, computer system and memory managing program
Zhao et al. Two generational garbage collection models with major collection time
US10936483B2 (en) Hybrid garbage collection
Abhinav et al. FastCollect: offloading generational garbage collection to integrated GPUs
Hu et al. Towards Garbage Collection Mechanism for RTSJ-Oriented Embedded Java Processor
Preußer et al. An embedded GC module with support for multiple mutators and weak references
Al-Oudat An Efficient Strategy for Allocating and Placing Segments in Dynamic Storage
Morikawa et al. Adaptive scanning reduces sweep time for the lisp2 mark-compact garbage collector
Koide et al. A new memory allocation method for shared memory multiprocessors with large virtual address space
Palumbo et al. Selecting Semi-permanent Object Candidates in Dynamically-Typed Reflective Languages
Yau et al. Hardware concurrent garbage collection for short-lived objects in mobile java devices

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20160304

Address after: 510006, No. 8, Jinghu Avenue, Xinhua Street, Huadu District, Guangdong, Guangzhou

Patentee after: Guangzhou Kingray Information Technology Co., Ltd.

Patentee after: SYSU HUADU INDUSTRIAL SCIENCE AND TECHNOLOGY INSTITUTE

Address before: 510006, No. 8, Jinghu Avenue, Xinhua Street, Huadu District, Guangdong, Guangzhou

Patentee before: Guangzhou Kingray Information Technology Co., Ltd.