CN107844511A - A kind of game resource caching method and system based on life cycle costing - Google Patents

A kind of game resource caching method and system based on life cycle costing Download PDF

Info

Publication number
CN107844511A
CN107844511A CN201710457845.7A CN201710457845A CN107844511A CN 107844511 A CN107844511 A CN 107844511A CN 201710457845 A CN201710457845 A CN 201710457845A CN 107844511 A CN107844511 A CN 107844511A
Authority
CN
China
Prior art keywords
page
life cycle
cost
caching
game resource
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
CN201710457845.7A
Other languages
Chinese (zh)
Other versions
CN107844511B (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 Xishanju Network Technology Co ltd
Zhuhai Kingsoft Digital Network Technology Co Ltd
Original Assignee
Western Hills Residence Guangzhou Shi You Network Technology Co Ltd
Zhuhai Kingsoft Online Game 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 Western Hills Residence Guangzhou Shi You Network Technology Co Ltd, Zhuhai Kingsoft Online Game Technology Co Ltd filed Critical Western Hills Residence Guangzhou Shi You Network Technology Co Ltd
Priority to CN201710457845.7A priority Critical patent/CN107844511B/en
Publication of CN107844511A publication Critical patent/CN107844511A/en
Application granted granted Critical
Publication of CN107844511B publication Critical patent/CN107844511B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/123Replacement control using replacement algorithms with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/126Replacement control using replacement algorithms with special data handling, e.g. priority of data or instructions, handling errors or pinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/128Replacement control using replacement algorithms adapted to multidimensional cache systems, e.g. set-associative, multicache, multiset or multilevel
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/15Use in a specific computing environment
    • G06F2212/154Networked environment

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Image Generation (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

Technical scheme includes a kind of game resource caching method and system based on life cycle costing, for realizing:Requirement command is parsed, obtains critical field;Shape library is traveled through, obtains identical with critical field or/and similar figure position, and add it to edit list;The figure position of edit list is combined, further by combination part collection using can interactive interface enter edlin and obtain multiple targeted graphical;Multiple targeted graphical is shown using interface, and picks out optimum target figure.Beneficial effects of the present invention are:Game graph demand and the making for exchanging and changing process, realize efficient game movie figure numerous and diverse in design process are simplified, greatlys save the expense of man power and material.

Description

A kind of game resource caching method and system based on life cycle costing
Technical field
The present invention relates to a kind of game resource caching method and system based on life cycle costing, belong to computer game data Process field.
Background technology
Most of Games Software all can problems faced be internal memory anxiety, in the game of limited memory, customized money Source cache is used to the data volume of extended scene, while only uses the region of memory of very little rather than disposably fill all resources Enter internal memory.During using caching system, most important factor is:Prescribed a time limit thereon when caching is filled up to, select appropriate replacement page Face is soared.When cache miss, the selection of page replacement algorithm is most important --- in the hardware of this selection and game It is directly related with efficiency to deposit the performance used.Bad algorithm often destroys the performance of game, and the algorithm that realize must well exists While not influenceing its performance, moreover it is possible to exponentially improve quality of play.Popular cache replacement algorithm is in their target environment Under operate very well, but in the case of needing more data to select to replace the page exactly, often efficiency is very low for they.
(it is referred to as when from when hosting request data, the data of reading are put into an interim region of memory by operating system Cache or caching), it can enter line access with speed more faster than main memory.Cache has a predefined chi in itself Very little, it is divided into the less internal storage set for being referred to as the page.When memory access, caching can be filled in itself, now, operation System must select a page to deposit new page data from caching.Such case, which is referred to as cache, does not order In.When the page number of needs substantially exceeds the size of caching (being usually 2 times or more), just there occurs also for caching shake It is to say, in order to will be all dropped to new whole data set vacating space, whole caching.Caching shake is considered as any slow The worst case of algorithm is deposited, and any caching replaces the focus of performance test.
When memory processing routine will obtain information from main memory, each time with the consumption of correlation.It is usually because employ It is extra, close to the memory chip of processor in itself, so the consumption read from caching is smaller.Thus, in the event of caching not Hit, when determining to remove which page of memory, one of main target is:Select one in the buffer and be not required to Want the page of effective groove.If deleted for example, randomly choosing page during failure occurs, still, this page Face is required immediately just after being deleted, and this will cause another from the performance cost for hosting reacquisition data.Target is An algorithm is established, it can be best described by the preferable page to be deleted from caching, to reduce cache miss and performance burden.
In development of games, programmer must come into contacts with the caching of hardware and software layer, especially in game machine field, Programmer ceaselessly makes great efforts to increase game content, while must meet that internal memory limits.Have as many other to solve one Body problem and replacement algorithm customized, some common game and graphics system need one and are more closely similar to memorymodel and use The replacement system of pattern.
The content of the invention
In view of the shortcomings of the prior art, the reason for the present situation that general game resource caching system is realized with causing, is subject to depth Enter analysis, analysis logical AND data have the characteristics of in which flow, and have the reusable component present invention's of which small grain size Technical scheme provides a kind of game resource caching method and system based on life cycle costing, and games system is greatly shortened to reach Construction cycle, strengthen code maintainability and reusability, greatly reinforce the operation stability and rendering efficiency and effect of game The purpose of performance.
Technical scheme includes a kind of game resource caching method based on life cycle costing, it is characterised in that should Method includes:A. the page data for obtaining new addition according to acquisition request is hosted and caching, a dimension is created in each page data Group, and created in array and initialize corresponding self-defined first integer variable;B. every time when page data used or not by Corresponding mark is recorded in the first integer variable during use, and calculates the life Cycle Percentage of the page;C. the is used Two integer variables calculate the relative cost of different types of page data;D. when the page newly added, own in traversal caching The life Cycle Percentage and relative cost of the page, the page is calculated according to life Cycle Percentage and relative cost and is substituted when institute The shake cost paid, cost will be shaken and replace with the new addition page less than the page of specified threshold.
According to the game resource caching method based on life cycle costing, this method also includes:The one-dimension array is deposited The spatial cache opened up is put in, the spatial cache can be with self-defined increase and deletion.
According to the game resource caching method based on life cycle costing, this method also includes:First integer becomes Measure and do not limited for usual variable and size for 32 integer variables, second integer variable.、
According to the game resource caching method based on life cycle costing, the step A also includes:Asked according to hosting Specified page is loaded to spatial cache, and records the type, size and load time of page data, corresponding to page creation one Individual 32 integer variables are simultaneously initialized as 1, and flag therein is 1.
According to the game resource caching method based on life cycle costing, tell that step B also includes:S51, every fixation Period, when page quilt in use, being moved to left to the flag of the first integer variable, and complimentary bit is recited as into 1, work as the page When being not used by, the flag of the first integer variable is moved to left, and complimentary bit is recited as 0;S52, when identifying lt, Life Cycle Percentage is calculated, including obtains shift number and access times, calculates the ratio of access times and shift number.
According to the game resource caching method based on life cycle costing, the relative cost is:Pass through game resource Corresponding page data amount is corresponding with sending being calculated for page data amount, for its meter of different game resource data The mode for calculating relative cost is different.
According to the game resource caching method based on life cycle costing, the step D also includes:S71 is slow to being put into The life Cycle Percentage for the game resource page of data more than preset amount deposited is detected, and by life cycle percentage It is used for the life Cycle Percentage cost that the page uses every time;S72, for more than specified threshold life Cycle Percentage cost Page creation working area, while check for life Cycle Percentage cost in working area circulation execution step S71 and be higher than The specified threshold and page is not used within a certain period of time, if deleting corresponding game resource page of data in the presence of if.
According to the game resource caching method based on life cycle costing, the step D also includes:S81 is new when having When the game resource page adds, the life Cycle Percentage cost and relative cost of all pages in caching are obtained;S82, calculate Caused shake cost when replacing the page, when result of calculation is more than default value, then retains the page, if less than if preset value The page is rejected from caching, wherein shake cost is life Cycle Percentage cost and the product of relative cost;S83, for It is located at the page of Near Threshold, the preferential page for rejecting life Cycle Percentage cost with identical shake cost and shake cost Face.
Technical scheme also includes a kind of game resource caching system based on life cycle costing, it is characterised in that The system includes:Page initialization module, for the page data for obtaining new addition according to acquisition request is hosted and caching, each Page data creates one-dimension array, and is created in array and initialize corresponding self-defined first integer variable;The page records mould Block, for corresponding mark to be recorded in the first integer variable when page data is used or is not used by every time, and Calculate the life Cycle Percentage of the page;Cost calculation module, different types of page data is calculated using the second integer variable Relative cost;Page replacement module, when the page newly added, traversal caching in all pages life Cycle Percentage and Relative cost, the shake cost paid when the page is substituted is calculated according to life Cycle Percentage and relative cost, will be shaken Cost replaces with the new addition page less than the page of specified threshold.
Beneficial effects of the present invention are:Cache comprehensive increase of page replaceability energy;Relatively low shake expense and filling is slow Deposit required cost;The operation stability and rendering efficiency and effect for strengthening game show.
Brief description of the drawings
Fig. 1 show the overview flow chart according to embodiment of the present invention;
Fig. 2 is shown rejects flow chart according to the texture of embodiment of the present invention.
Embodiment
In order that the object, technical solutions and advantages of the present invention are clearer, below in conjunction with the accompanying drawings with specific embodiment pair The present invention is described in detail.The game resource caching method and system of the life cycle costing of the present invention are applied to the place of game data Reason.
Fig. 1 show the overview flow chart according to embodiment of the present invention.A. according to hosting, acquisition request acquisition is new to be added The page data of caching, one-dimension array is created in each page data, and is created in array and initialize corresponding self-defined the One integer variable;B. corresponding mark is remembered in the first integer variable when page data is used or is not used by every time Carry, and calculate the life Cycle Percentage of the page;C. the relative of different types of page data is calculated using the second integer variable Cost;D. when the page newly added, the life Cycle Percentage and relative cost of all pages in traversal caching, according to life Period percents and relative cost calculate the shake cost paid when the page is substituted, and will shake cost less than specified threshold The page replaces with the new addition page.
Fig. 2 is shown rejects flow chart according to the texture of embodiment of the present invention.It is as follows
(1) it is easy to remove old texture, allows texture to go to prove that they are required for scene.Once demonstrate this thing Real, they are just retained.Once obtaining one more than 50% life Cycle Percentage cost, it will be difficult to be released from caching Put.
(2) working area is established.It is that useful new texture is converted into working area not prove them also, and this is One good method is higher in the probability that next frame disappears because new texture is often temporary transient.
(3) this is that the nearest of modification does not have application method.In a short period of time, there is the line of higher visible frequencies Reason, 50% life Cycle Percentage cost can be easily jumped to, but then redrop, after multiframe, their life Life period percents cost slowly falls after rise.Life cycle provides a representation that have modified of access variable, and allows volume Outer analysis.Therefore, if life Cycle Percentage cost>60%, but texture was not used in nearest several frames, then This situation can be checked and remove the texture earlier.
(4) old texture corresponding to deleting.
Technical scheme also discloses following technical characteristic:Life cycle and indicator of costs general introduction, life cycle Algorithm and the general introduction of life cycle and the indicator of costs:
(it is referred to as when from when hosting request data, the data of reading are put into an interim region of memory by operating system Cache or caching), it can enter line access with speed more faster than main memory.Cache has a predefined chi in itself Very little, it is divided into the less internal storage set for being referred to as the page.When memory access, caching can be filled in itself, now, operation System must select a page to deposit new page data from caching.Such case, which is referred to as cache, does not order In.When the page number of needs substantially exceeds the size of caching (being usually 2 times or more), just there occurs also for caching shake It is to say, in order to will be all dropped to new whole data set vacating space, whole caching.Caching shake is considered as any slow The worst case of algorithm is deposited, and any caching replaces the focus of performance test.
When memory processing routine will obtain information from main memory, each time with the consumption of correlation.It is usually because employ It is extra, close to the memory chip of processor in itself, so the consumption read from caching is smaller.Thus, in the event of caching not Hit, when determining to remove which page of memory, one of main target is:Select one in the buffer and be not required to Want the page of effective groove.If deleted for example, randomly choosing page during failure occurs, still, this page Face is required immediately just after being deleted, and this will cause another from the performance cost for hosting reacquisition data.Target is An algorithm is established, it can be best described by the preferable page to be deleted from caching, to reduce cache miss and performance burden.
In development of games, programmer must come into contacts with the caching of hardware and software layer, especially in game machine field, Programmer ceaselessly makes great efforts to increase game content, while must meet that internal memory limits.Have as many other to solve one Body problem and replacement algorithm customized, some common game and graphics system need one and are more closely similar to memorymodel and use The replacement system of pattern.
This programme is so that most of game suffer from a problem that on contemporary hardware as an example, that is, design one is self-defined Texture cache.Accomplish this point, user will retain a static one-dimension array and cache the page, can be used for loading and unloading Carry data.Assuming that a multidimensional texture caching is used in user, that is, the data for being placed on caching come from texture, because all size Multi-texturing can be contained in a single caching page, so caching be multidimensional.For example, if the caching page can hold Receive 256x256 texture, then, it can also support 4 64x64 texture, 16 32x32 texture etc., including can be with Harmoniously it is present in the multiple of each size of the same page.
The basis that standard replacement function is performed poor is shown in this simply example.Consider the situation of multidimensional caching, The page for needing to insert a new 256x256 is to a caching, and this caching is simply filled out completely with some 32x32 texture It is full.Simple LRU scheme does not possess necessary data come suitably to calculate which caching page be most preferably to replace Skip face.Meanwhile because access module is largely far above the time being finally replaced dependent on the page, it Which group 32x32 texture, which can not suitably be calculated, to be needed to be cleared.Therefore, in this case, it is optimal in order to preferably analyze The page is replaced, this paper presents a set of new replacement index.
Life cycle algorithm:
Life cycle algorithm knows the usage quantity of a page in the buffer, and replaces that in the just meeting of farthest time The page used.Most of algorithms of replacing imitate this algorithm with trying one's best with various data access patterns.In order to most The usage in future is predicted well, and life cycle algorithm simulates this by retaining the concept of a service condition in former frames Process.Need to be grasped a page in a time window and be accessed how many times.In order to complete this task, caching In each page retain the integer variable of one 32, when a page first enters into caching, this variable is initialized to 1(0x00000001)。
For each frame, all pages that enliven in the buffer move to left one, indicate its depreciation over time.If One active page is used in this frame, then the least significant bit of life cycle variable is arranged to 1, is otherwise provided as 0.This Individual displacement and Setting pattern allow to retain past 32 frame one using assessment.
For example, the page that every two frame is only used once will have a life cycle variable OxAAAAAAAA (010101010 ... 01), and one first load when be widely used but later never again by the page, will have life Periodic variable OxFFFFOOOO (1111 ... 1100000 ... 00).
To show the change of life cycle variable over time, in the time window of 8 frames, consider one first, The page that three, the 4th and the 8th frame is used.Life cycle variable will be changed as follows:
1st frame 1 (use)
2nd frame 1 (without using)
3rd frame 1 (use)
4th frame 1 (use)
5th frame 1 (without using)
6th frame 1 (without using)
7th frame 1 (without using)
8th frame 1 (use)
There is such data structure, the life Cycle Percentage cost of specified window can be calculated.By using the page Totalframes in the frame number (position be 1 number) divided by life cycle variable that are previously used, obtain a page and used and not The average frame number used.These data can be with compilation and processor is heuristic obtains, without high-level code.Although can This data is expressed in a manner of with oneself, however, it is proposed life Cycle Percentage cost change as a unit (0, 1) single value between is present, and as described in " life cycle and cost " part, this value can refer to as one relative to other Target scalar.
When using life cycle to determine that target replaces the page, the page being also not used within the regular hour is selected Face, and the general rarely needed page.For example, in a time window, the page all used per frame will have one 100% life Cycle Percentage cost, it will be the nearly that what can not possibly be substituted, and one have 25% life cycle percentage The chance more substituted than the page of cost can be higher.
Shake cost:
Relative cost is a prior index, and allows the value to be an integer variable without the upper limit.For example, such as Fruit is by continuously transmitting texture from disk to caching, and relative cost value is probably texture dimensions divided by that one is continuously transmitted from resource is small The time that texure is spent.Life Cycle Percentage cost is become as a unitization floating-point between (0,1) Amount.
User can combine the two values into a single result, wherein, life Cycle Percentage cost is as relative One scalar of cost, so that internal memory shakes cost=relative cost x life Cycle Percentage costs.This is one very good , for identifying the heuristic of the appropriate replacement page.It is several life Cycle Percentage cost/relative cost ratios below The explanation of example and alternative patterns.To following data, it is assumed that the peak of relative cost is probably 10.
Table 1
As seen by this table 1, page is may result in using simple relative cost x life Cycle Percentage value at costs There is different life Cycle Percentage cost/relative cost values in face, but with identical internal memory shake cost.This will imply that, Life Cycle Percentage cost/relative cost relation is 0.5/100 texture A, can be with life Cycle Percentage cost/relative The texture B that cost is 1.0/50 has identical cost.The either of which of the two pages is an effective target, is all wrapped Containing the potential replacement numerical value weight of identical.Texture A has higher cost, if next frame needs it, replacing it will costly. Texture B cost is relatively low, but has the life Cycle Percentage value at cost of one 100%, therefore is immediately required to the possibility of this page Property will be very big.
When multiple pages return to identical value, replacing an effect for having relatively low life Cycle Percentage value at cost will get well Much.Here it is the reason for life cycle index to be used.By analyzing use pattern and cost, it can be seen that although the page Costly, but it is less used, and it is mistakenly buffered the probability of shake with regard to relatively low.In these cases, again Scanning caching is come to find the page for having higher internal memory shake cost and relatively low life Cycle Percentage value at cost be one good Method.
Technical scheme is further extended to statement periodical algorithms and alternative costs, specific as follows:
The life cycle algorithm of extension:
Consider while be loaded into two pages (texture A and texture B) of caching, texture A is used in 50% in scene On object, and texture B is used only on 10% object.Two pages have identical life Cycle Percentage value at cost, but can To determine that the two pages have very different usage quantity.When having to find out a replacement page, it should be taken into account that, Present frame texture A is used the fact that more multiple, adds the possibility that it will also be used in subsequent frame, therefore, less The texture (texture B) used should be substituted.By storing this extra every frame data, there is provided other statistical analysis behaviour Make, to assist in the optimal page removed from caching.
It includes in detail:
(1) still may be used with the quantity divided by totalframes of the non-zero frame in time window, life Cycle Percentage cost variations To be obtained from the life cycle algorithm of extension.
(2) page at least used is found in given frame window, the page that in general at least uses will be found out, this will Aid in determining whether to replace the page.
(3) maximum analysis is utilized, it may be determined that most pages is accessed in window, to help them to avoid from caching Remove.
(4) in window, it is simple to find average second using and obtaining to be similar to life Cycle Percentage cost The variable changed is equally simple.
Extend the cost replaced
It is most of that to replace page recognizers only single heuristic using one.That is, their algorithm is special Door is made to measure for causing the access module of minimum caching page-miss.For example, LRU is only Retain the information of oldest page.However, custom software caching usually relate to second of cache miss it is heuristic --- The cost of the caching page is filled with new data.For most of hardware caches, there is a constant cost.This cost is with depositing It is related that reservoir processing routine accesses data needed for main memory and reading.
However, for Games Software need, this cost generally can the page in itself between fluctuate.Therefore, page is replaced Face is identified it is considered that actually with a given memory block come to fill the performance hit amount of a page be very wise.This Performance consumption (or simply consume) can have a variety of sources, it can with an external data collection come manual definition (for example, one Define the XML file which texture is really used), or it can define with the actual cost of the filling page.
Because larger texture has more information to be transmitted from resource, and less or simple texture is those The sub-fraction of consumption, thus larger texture have it is longer, be related to the performance time for they being put into caching.In such case Under, in page identification process is replaced, consider that it will be very wise to include the cost that may substitute a page in internal memory. If the page replaced has higher relevant cost, and ensuing a few frames need the page, then it is unnecessary to cause Expense.If on the contrary, substituted for the page for having lower cost, the performance hit that mistakenly it is removed from the cache is then low Much.Put it briefly, cost is allowed as the variable that the page is replaced to answer a question and " removes 5 less textures to 1 Individual large texture vacating space can be less expensive”
Cost can allow user's concern that one given page is reloaded into how caching can damage performance.If desired, this One extension of individual system allows to replace performance cost of the page identification function more concerned about cache miss, rather than between frame Continuity.
When shaking generation, find in the buffer and remove generally the least expensive texture.Because always there is a cheap page to deposit If load is sufficiently large, whole caching may be shaken.The very expensive page can indefinitely be stayed in caching by it.Such as Fruit thing as day sylphon texture is loaded onto caching, then this is an excellent characteristics, because day sylphon is each Frame all will be active, and due to its large scale, we are less likely to want it to be removed from the cache.
The replacement of access module algorithm identification is inclined to by using index is replaced, it is allowed to which caching finds one and replaced in the page Compromise between demand and shake.In addition, the problem of identification of access module helps to eliminate involved by the pure indicator of costs, when When the resource of high cost reaches the state no longer needed, them are allowed finally to be removed from caching.
It is described above, simply presently preferred embodiments of the present invention, the invention is not limited in above-mentioned embodiment, as long as It reaches the technique effect of the present invention with identical means, should all belong to protection scope of the present invention.In the protection model of the present invention Its technical scheme and/or embodiment can have a variety of modifications and variations in enclosing.

Claims (9)

1. a kind of game resource caching method based on life cycle costing, it is characterised in that this method includes:
A. the page data for obtaining new addition according to acquisition request is hosted and caching, one-dimension array is created in each page data, and Created in array and initialize corresponding self-defined first integer variable;
B. corresponding mark is recorded in the first integer variable when page data is used or is not used by every time, and counted Calculate the life Cycle Percentage of the page;
C. the relative cost of different types of page data is calculated using the second integer variable;
D. when the page newly added, the life Cycle Percentage and relative cost of all pages in traversal caching, according to life Period percents and relative cost calculate the shake cost paid when the page is substituted, and will shake cost less than specified threshold The page replaces with the new addition page.
2. the game resource caching method according to claim 1 based on life cycle costing, it is characterised in that this method is also wrapped Include:
The one-dimension array deposits in the spatial cache opened up, and the spatial cache can be with self-defined increase and deletion.
3. the game resource caching method according to claim 1 based on life cycle costing, it is characterised in that this method is also wrapped Include:
First integer variable is 32 integer variables, and second integer variable is usual variable and size does not limit System.
4. the game resource caching method based on life cycle costing according to claim 1 or 3, it is characterised in that the step Rapid A also includes:
According to main memory request of loading specified page to spatial cache, and the type, size and load time of page data are recorded, 32 integer variables corresponding to page creation are simultaneously initialized as 1, and flag therein is 1.
5. the game resource caching method based on life cycle costing according to claim 1 or 4, it is characterised in that tell step Rapid B also includes:
S51, every fixed time period, when page quilt in use, being moved to left to the flag of the first integer variable, and it will increase newly Position is recited as 1, when the page is not used by, the flag of the first integer variable is moved to left, and complimentary bit is recited as into 0;
S52, when identifying lt, calculate life Cycle Percentage, including obtain shift number and access times, calculate using time The ratio of number and shift number.
6. the game resource caching method according to claim 1 based on life cycle costing, it is characterised in that it is described relative into Originally it is:
It is corresponding by page data amount corresponding to game resource with sending being calculated for page data amount, for different The mode of its calculating relative cost of game resource data is different.
7. the game resource caching method according to claim 1 based on life cycle costing, it is characterised in that the step D Also include:
S71, detected to being put into the life Cycle Percentage of the game resource page of data more than preset amount of caching, And the life Cycle Percentage cost for using life Cycle Percentage every time as the page;
S72, for the page creation working area more than specified threshold life Cycle Percentage cost, while circulate and perform in working area Step S71 checks for life Cycle Percentage cost not to be made within a certain period of time higher than specified threshold and the page With if the corresponding game resource page of data of deletion in the presence of if.
8. the game resource caching method based on life cycle costing according to claim 1 or 7, it is characterised in that the step Rapid D also includes:
S81, when there is the new game resource page to add, obtain the life Cycle Percentage cost and phase of all pages in caching To cost;
S82, caused shake cost when replacing the page is calculated, when result of calculation is more than default value, then retains the page, if Then the page is rejected from caching less than preset value, wherein shake cost is multiplying for life Cycle Percentage cost and relative cost Product;
S83, the page for being located at Near Threshold with identical shake cost and shake cost are preferential to reject life cycle percentage Than the page of cost.
9. according to a kind of game resource caching system based on life cycle costing of any methods describeds of claim 1-8, its feature It is, the system includes:
Page initialization module, for the page data for obtaining new addition according to acquisition request is hosted and caching, in each page number According to establishment one-dimension array, and created in array and initialize corresponding self-defined first integer variable;
The page records module, for every time becoming corresponding mark in the first integer when page data is used or is not used by Amount is recorded, and calculates the life Cycle Percentage of the page;
Cost calculation module, the relative cost of different types of page data is calculated using the second integer variable;
Page replacement module, when the page newly added, traversal caching in all pages life Cycle Percentage and relative into This, the shake cost paid when the page is substituted is calculated according to life Cycle Percentage and relative cost, low by cost is shaken The new addition page is replaced with the page of specified threshold.
CN201710457845.7A 2017-06-16 2017-06-16 Game resource caching method and system based on cycle cost Active CN107844511B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710457845.7A CN107844511B (en) 2017-06-16 2017-06-16 Game resource caching method and system based on cycle cost

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710457845.7A CN107844511B (en) 2017-06-16 2017-06-16 Game resource caching method and system based on cycle cost

Publications (2)

Publication Number Publication Date
CN107844511A true CN107844511A (en) 2018-03-27
CN107844511B CN107844511B (en) 2021-08-17

Family

ID=61682865

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710457845.7A Active CN107844511B (en) 2017-06-16 2017-06-16 Game resource caching method and system based on cycle cost

Country Status (1)

Country Link
CN (1) CN107844511B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6421766B1 (en) * 1998-12-16 2002-07-16 Intel Corporation Method and apparatus for approximated least-recently-used algorithm memory replacement
CN1720528A (en) * 2002-12-03 2006-01-11 R·图利 Portable Internet access device back page cache
CN101398786A (en) * 2008-09-28 2009-04-01 东南大学 Method for implementing controllable cache facing embedded application software
US20130111144A1 (en) * 2011-10-28 2013-05-02 International Business Machines Corporation Efficient memory management in software caches
CN104715020A (en) * 2015-02-13 2015-06-17 腾讯科技(深圳)有限公司 Cache data deleting method and server
CN104809237A (en) * 2015-05-12 2015-07-29 百度在线网络技术(北京)有限公司 LSM-tree (The Log-Structured Merge-Tree) index optimization method and LSM-tree index optimization system
CN104822068A (en) * 2015-04-29 2015-08-05 四达时代通讯网络技术有限公司 Streaming media proxy cache replacing method and device
CN104991827A (en) * 2015-06-26 2015-10-21 季锦诚 Method for sharing GPU resources in cloud game
CN105975402A (en) * 2016-04-28 2016-09-28 华中科技大学 Caching method and system for eliminated data perception in hybrid memory environment
CN106844075A (en) * 2015-12-04 2017-06-13 阿里巴巴集团控股有限公司 A kind of data transferring method and equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6421766B1 (en) * 1998-12-16 2002-07-16 Intel Corporation Method and apparatus for approximated least-recently-used algorithm memory replacement
CN1720528A (en) * 2002-12-03 2006-01-11 R·图利 Portable Internet access device back page cache
CN101398786A (en) * 2008-09-28 2009-04-01 东南大学 Method for implementing controllable cache facing embedded application software
US20130111144A1 (en) * 2011-10-28 2013-05-02 International Business Machines Corporation Efficient memory management in software caches
CN104715020A (en) * 2015-02-13 2015-06-17 腾讯科技(深圳)有限公司 Cache data deleting method and server
CN104822068A (en) * 2015-04-29 2015-08-05 四达时代通讯网络技术有限公司 Streaming media proxy cache replacing method and device
CN104809237A (en) * 2015-05-12 2015-07-29 百度在线网络技术(北京)有限公司 LSM-tree (The Log-Structured Merge-Tree) index optimization method and LSM-tree index optimization system
CN104991827A (en) * 2015-06-26 2015-10-21 季锦诚 Method for sharing GPU resources in cloud game
CN106844075A (en) * 2015-12-04 2017-06-13 阿里巴巴集团控股有限公司 A kind of data transferring method and equipment
CN105975402A (en) * 2016-04-28 2016-09-28 华中科技大学 Caching method and system for eliminated data perception in hybrid memory environment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
R.SIVAKOUMAR ET AL.: "Dynamic caching and replacing mechanism for multiple videos over quality of service networks", 《2010 FIRST INTERNATIONAL CONFERENCE ON INTEGRATED INTELLIGENT COMPUTING》 *
刘磊等: "最小驻留价值缓存替换算法", 《计算机应用》 *

Also Published As

Publication number Publication date
CN107844511B (en) 2021-08-17

Similar Documents

Publication Publication Date Title
CN105205014B (en) A kind of date storage method and device
Aila et al. Architecture considerations for tracing incoherent rays
Loh Extending the effectiveness of 3D-stacked DRAM caches with an adaptive multi-queue policy
Sethi et al. RecShard: statistical feature-based memory optimization for industry-scale neural recommendation
US7934058B2 (en) Predictive caching of assets to improve level load time on a game console
CN105117351B (en) To the method and device of buffering write data
CN107168640A (en) The control method of storage system, information processing system and nonvolatile memory
CN107066397A (en) Caching is dissected to replace
CN104798032B (en) Device and method for the clean up time for shortening caching
CN110795363B (en) Hot page prediction method and page scheduling method of storage medium
US20210271640A1 (en) File loading method and apparatus, electronic device, and storage medium
Gaur et al. Efficient management of last-level caches in graphics processors for 3d scene rendering workloads
CN108647155A (en) A kind of method and apparatus that the multistage cache based on deep learning is shared
CN101681289A (en) Processor performance monitoring
CN111737168A (en) Cache system, cache processing method, device, equipment and medium
CN110297787A (en) The method, device and equipment of I/O equipment access memory
CN108139904A (en) Writing commands filter
CN107180118A (en) A kind of file system cache data managing method and device
Wang et al. Using data mining and machine learning techniques for system design space exploration and automatized optimization
CN106502793A (en) A kind of concocting method of game resource and equipment
CN106681830A (en) Task cache space monitoring method and device
CN107844511A (en) A kind of game resource caching method and system based on life cycle costing
DeMarle et al. Memory sharing for interactive ray tracing on clusters
CN109669881A (en) A kind of calculation method based on the space Cache reservation algorithm
CN104123243B (en) Data caching system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 519000 Room 102, 202, 302 and 402, No. 325, Qiandao Ring Road, Tangjiawan Town, high tech Zone, Zhuhai City, Guangdong Province, Room 102 and 202, No. 327 and Room 302, No. 329

Patentee after: Zhuhai Jinshan Digital Network Technology Co.,Ltd.

Patentee after: Guangzhou Xishanju Network Technology Co.,Ltd.

Address before: 519000 Jinshan software building, 8 Lanshan lane, Jida Jingshan Hill Road, Zhuhai, Guangdong

Patentee before: ZHUHAI KINGSOFT ONLINE GAME TECHNOLOGY Co.,Ltd.

Patentee before: GUANGZHOU SEASUN ENTERTAINMENT NETWORK TECHNOLOGY Co.,Ltd.

CP03 Change of name, title or address