CN100478895C - Dynamic refresh method and system for data - Google Patents
Dynamic refresh method and system for data Download PDFInfo
- Publication number
- CN100478895C CN100478895C CNB2007100794398A CN200710079439A CN100478895C CN 100478895 C CN100478895 C CN 100478895C CN B2007100794398 A CNB2007100794398 A CN B2007100794398A CN 200710079439 A CN200710079439 A CN 200710079439A CN 100478895 C CN100478895 C CN 100478895C
- Authority
- CN
- China
- Prior art keywords
- data
- shared
- shared data
- bit information
- zone bit
- 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.)
- Active
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
This invention discloses data dynamic brush method and system, which comprises the following steps: exploring share space and storing the data into the share space; in same source file setting parameters load function and visit function; through parameters values, brushing the process adjust load function for brush operation on share data; through denoting the parameters, using process transfer visit function for visit operations.
Description
Technical field
The present invention relates to data processing technique, particularly relate to the dynamic refresh method and the system of data.
Background technology
In various systems based on configuration driven, each application process (promptly using the process of configuration data) reads configuration data from configuration file, be loaded into then in the heap memory separately and use.But it is, very frequent to refreshing of configuration data along with the continuous adjustment of business.When needs upgrade configuration data, after configuration file upgrades, still use former configuration data for preventing application process, thereby cause data corruption and mistake occurs, so must load new configuration data respectively to each application process.
Existing technology is that zone bit is set, and each process checks at first whether described zone bit identifies needs and upgrade configuration data after the access service request.Upgrade configuration data if desired, then each process is all independent reads new configuration data from configuration file, and in the heap memory of this process of leaving in, uses for follow-up business processing.
Each application process from configuration file, read new configuration data and be loaded into heap memory during this period of time in, process can't be handled the service request that has inserted, and will cause the short interruption of business processing, and also needs to restart after configuration data has refreshed.For the transaction processing system in the financial field, because the trading volume of financial business is huge, transaction flow is very high, and this of short duration interruption will cause a large amount of transaction processing failures, influences the efficient and the success ratio of transaction processing system.
And a configuration data of all independent preservation can be wasted a large amount of memory sources in the heap memory of each process.And application process reads file operation at every turn also can consume a large amount of CPU, thereby the process performance of transaction is being handled in influence.
Summary of the invention
Technical matters to be solved by this invention provides a kind of dynamic refresh method and system of data, cause application process to wait as long for even overtime to solve the existing mode that refreshes, thereby cause the business processing short interruption, influence the problem of business processing efficient and success ratio.
For solving the problems of the technologies described above, the invention provides the dynamic refresh method of data, comprising:
Open up the communal space, shared data is left in the described communal space with object form;
Parameterized loading function and access function are set in same source file;
By to described parameter assignment, refresh the process transfer loading function described shared data is carried out refresh operation;
By to described parameter assignment, application process is called access function to the operation that conducts interviews of described shared data.
Wherein, the process that refreshes is carried out refresh operation according to following steps: create shared object again, call loading function described shared object is loaded into the communal space; Wherein, described shared object is meant the shared data of the renewal of depositing with object form.
Preferably, also comprise: in the described communal space, divide two zones and deposit shared data, and one of them regional zone bit information of sign is set; Application process reads described zone bit information, determines that the shared data of depositing in one of them zone is the shared data of current use, and operation conducts interviews; Wherein, the shared data of described current use is meant current shared data of being visited by other application processes; The process of refreshing reads described zone bit information, determines extra-regional another zone of current use is carried out the refresh operation of shared data, revises described zone bit information behind the Flushing success; Wherein, the described current zone of using is meant the current zone that is being employed the process visit.
Wherein, described zone bit information is used to indicate the shared region of the current use of application process, perhaps indication refresh that process uses at extra-regional another shared region of described current use.
Wherein, describedly refresh process and application process parallel running.
The present invention also provides the dynamic refresh system of data, comprising:
The communal space is used for depositing shared data with object form;
The Object Creation unit is used to open up the described communal space, creates the shared object of corresponding shared data;
The data load unit is used to provide parameterized loading function, and the process that refreshes is loaded into the described communal space by to described parameter assignment with shared data;
The data access unit is used to provide parameterized access function, and application process is visited shared data by to described parameter assignment.
Wherein, loading function and the access function in the data access unit in the described data load unit places same source file to compile.
Wherein, when the process that refreshes refreshes shared data at every turn, also call described Object Creation unit and create shared object again.
Preferably, the described communal space is divided into two zones and deposits shared data, and one of them regional zone bit information of sign is set; The data access unit determines that by described zone bit information the shared data of depositing in one of them zone is the shared data of current use, and application process conducts interviews; Wherein, the shared data of described current use is meant current shared data of being visited by other application processes; The process that refreshes determines extra-regional another zone of current use is carried out the refresh operation of shared data by described zone bit information, revises described zone bit information behind the Flushing success; Wherein, the described current zone of using is meant the current zone that is being employed the process visit.
Wherein, described data load unit and the parallel running of data access unit.
Wherein, described zone bit information is used to indicate the shared region of the current use of application process, perhaps indication refresh that process uses at extra-regional another shared region of described current use.
Compared with prior art, the present invention has the following advantages:
At first, the present invention adopts the method for data sharing, and the heap memory of configuration data from each application process moved on to the shared drive, and all application processes all read configuration data from described shared drive.When configuration data is refreshed, only need that shared drive is loaded a secondary data and get final product, significantly reduced the stand-by period of each process, improved the efficient and the success ratio of business processing.And the mode of shared drive has reduced the memory consumption of each application process.
Next when using shared drive, by the mode of homology compiling, is about to create the code of shared object and uses the code of shared object to compile in same source file, has solved the Virtual Function use problem of shared object in the shared drive.Compare with other settling modes, the method for the invention realizes simple.
Once more, the present invention is preferred, shared drive is divided two zones deposit two groups of configuration datas that structure is identical, and zone bit is set, and uses two set of configuration data by switching, and reaches the purpose of dynamic refresh configuration data.Refreshing process and application process can parallel running, and refresh process can not cause the interruption of application process, does not promptly need to restart application process, safely the refresh configuration data.And, data all application processes just can be used renewal immediately after the refresh operation of configuration data is finished after, more the process of using shared data is suspended running because of configuration data is refreshed time decreased to one to the negligible degree of system's normal operation, reach the purpose of dynamic refresh configuration data safely.
Description of drawings
Fig. 1 is the synoptic diagram that solves the object sharing problem among the present invention;
Fig. 2 is the data structure synoptic diagram of shared drive of the present invention;
Fig. 3 is the process flow diagram of transaction processing process in the preferred embodiment of the present invention;
Fig. 4 is the process flow diagram that configuration refreshes process in the preferred embodiment of the present invention;
Fig. 5 is the dynamic refresh system architecture diagram of data of the present invention.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
The present invention adopts the method for data sharing for addressing the above problem, and configuration data is left in the shared drive, and all service application processes all read configuration data from described shared drive, and described configuration data promptly becomes shared data.Upgrade configuration data if desired, only need once upgrade getting final product the data in the shared drive.
From time and space, shared drive is the passage of interprocess communication the most efficiently that modern operating system possesses.Shared drive is mapped to address space a plurality of processes simultaneously, and a process only need be attached to shared drive and use it as the use common memory, just can obtain and the identical internal storage data of other processes.Technical scheme of the present invention is that configuration data is left in the shared drive, all attached described shared drive of all service application processes.
Because in original refreshing in the mode, the data structure of described configuration data has adopted the OO method exploitation of C++, leaves in the heap memory with the form of object, is used by the process of creating object.Among the present invention,, directly configuration object is left in the shared drive for reducing workload and the risk of revising data store organisation.But the developer finds in implementation procedure, the configuration object of in shared drive, creating, and the process that can be created described object is normally visited, and other all process share and access can cause the application system collapse.
Through debugging repeatedly, in further investigation C++ model after the Fundamentals of Compiling of compiler, find that the shared problem that exists of object is in the embodiment of the invention: always comprise the pointer that points to various VTable (virtual table) and subobject in the C++ object, described pointer is relevant with specific process, this object can be shared, just need guarantee that the target of these pointers in all processes all resides in identical address.Owing to used Virtual Function in the described configuration object, and the C++ object model does not successfully solve the problem of virtual succession, each application process the inconsistent problem of virtual table address pointer will occur when the visit shared data.As from the foregoing, solving the problem that refreshes of data by shared drive, is not the problem that can realize easily, the technical matters of neither all technician of computer realm all knowing.And about the rudimentary knowledge of Virtual Function in C++ Fundamentals of Compiling and the object and virtual succession, not in the scope of the detailed description of the invention.
Need consider two subject matters when in shared drive, specifically using the C++ object:
The first, the VTable pointer is used to visit Virtual Function, and directly uses compiling hour offset amount to realize to data member's visit.Therefore, for all this shared objects, the VTable in all processes should have identical virtual address with Virtual Function.
The second, the object of virtual succession has the basic pointer that points to base object, and described basic pointer is quoted the data segment of process, and forever specific to process.Therefore, be difficult to guarantee that identical digital value is all arranged in other processes.
At above-mentioned two problems, following solution can be arranged: one, the compile mode of change C++ compiler, fundamentally solve the inconsistent problem of virtual address pointer, but for large-scale service application, described mode is easy to generate mistake, and implements the comparison difficulty; Its two, change the original data structure of configuration data, in object, do not use Virtual Function, and realize and the Virtual Function identical functions by additive method, if adopt this method, then realize complicatedly, and weakened the function of " object " greatly.Described two kinds of methods can solve the object sharing problem in theory, the comparison difficulty but practical operation is got up.
The present invention proposes a kind of simple solution, as long as will create the code of shared object and use the code of shared object in same source file, to compile, then create the process of shared object and the VTable of the process of visit shared object and all necessarily have identical virtual address with Virtual Function, described method is called the homology compiling.Therefore, the homology compiling can solve the Virtual Function use problem of shared object in the shared drive.In object oriented programming model, relate to the execution of process, the object sharing problem of Virtual Function all can occur using, so the solution that the present invention proposes is applicable to that all relate to the object model that process is carried out.
Below in conjunction with the embodiment of the invention solution that homology compiles being described, with reference to Fig. 1, is the synoptic diagram that solves the object sharing problem among the present invention.Wherein, loading function is used for data load to memory headroom, and access function is used for the operation that conducts interviews of data to memory headroom.Configuration data is created into configuration object (being sharing data objects) in the present embodiment, needs to hew out the communal space earlier in internal memory, calls described loading function then, and configuration data is loaded in the described shared drive, realizes the initialization of member in the object.Described configuration object is refreshed, need create configuration object again, and the configuration data that will call after described loading function will upgrade is loaded in the shared drive, promptly the member in the object uses new configuration information initialization.The access configuration object need call described access function and realize.
Because configuration data is configured to shared data,, promptly carry out by refreshing process and visit process respectively so refreshing and access function of the same process control of former cause is independent separately now.But principle according to the homology compiling, need place same source file to compile described loading function and access function, just can make the process of creating shared object and the VTable that visits the process of shared object all necessarily have identical virtual address with Virtual Function.For this reason, with the described source file parametrization that comprises loading function and access function, by to the parameter assignment, that carries out described file refreshes the process transfer loading function, carries out the application process of described file and then calls access function.
Above-mentioned when configuration data is refreshed, only need to load a secondary data and get final product shared drive, significantly reduced the stand-by period of each process, improved the efficient and the success ratio of business processing.And the mode of shared drive has reduced the memory consumption of each application process.
On the basis that has solved the object sharing problem, the present invention is preferred, described shared drive is marked off two zones deposit two groups of configuration datas that structure is identical, and zone bit is set, be used for wherein one group of data of sign, use two set of configuration data by switching, reach the purpose of dynamic refresh configuration data, and guarantee the data all application processes just can be used renewal immediately after the refresh operation of configuration data is finished after.With reference to Fig. 2, be the data structure synoptic diagram of shared drive of the present invention.
Described shared drive is divided into internal memory head and internal memory body two parts, and the internal memory body is divided into two shared regions again.Wherein, deposit the first address pointer of zone bit information and shared region A, shared region B in the described internal memory head, deposit two groups of configuration datas that structure is identical with object form in the described internal memory body.In the process of visit and shared drive,, read corresponding first address pointer then, thereby correctly obtain the memory location of shared data by reading the definite shared region that will visit of zone bit information.
For example, create a slice shared drive, and shared drive is divided into two section A and B, earlier configuration data is loaded into one of them section (for example A section) after the system start-up.When the service application process need be used configuration data, obtain the first address of A section earlier according to zone bit, configuration object is shared in visit then.In the time of needs refresh configuration data, the process of refreshing can be created in the B section and share configuration object, and new configuration data is loaded into the B section, then zone bit is revised as the first address of B section.Like this, the described application process and the process that refreshes can executed in parallel and do not disturb mutually, and the business processing process just can have been used new configuration data safely.
Transaction processing process below in conjunction with the financial field describes.With reference to Fig. 3, be the process flow diagram of transaction processing process in the preferred embodiment of the present invention, described transaction processing process is carried out sharing the accessing operation of configuration data.
With reference to Fig. 4, be the process flow diagram that configuration refreshes process in the preferred embodiment of the present invention, after the Data Update in the configuration file, carry out following operation:
Step 401, configuration refresh process and read configuration data in the configuration file.
Step 402 reads the internal memory header, obtains the zone bit information of configuration data.
Step 403 according to described zone bit information, is organized current obsolete configuration data to another and is carried out refresh operation.
Step 404, finish refresh operation after, configuration refreshes process dirty bit information.If the zone bit indication is a current set of configuration data of using, that set of configuration data that then will newly load is designated the current data of using.The transaction processing process can read up-to-date configuration data according to the sign of zone bit and handle transaction after receiving new transaction request.
Therefore, dynamic refresh method provided by the invention, guarantee the data the All Activity treatment progress just can use renewal immediately after the refresh operation of configuration data is finished after, more the process of using shared data is suspended running because of configuration data is refreshed time decreased to one to the negligible degree of system's normal operation, reach the purpose of dynamic refresh configuration data safely.
At above-mentioned Refresh Data scheme, the present invention also provides concrete realization system, with reference to Fig. 5, is the dynamic refresh system architecture diagram of data of the present invention.Described system comprises the communal space 501, Object Creation unit 502, data load unit 503 and data access unit 504.
The communal space 501 is one section public memory space of opening up out in internal memory, is used to deposit configuration data, shares for a plurality of processes and uses.In the embodiment of the invention, configuration data is to deposit with the form of object, and has used Virtual Function.
Object Creation unit 502 is used to open up the described communal space 501, and heavy duty the new operation in the C Plus Plus, with the pointed shared drive of shared object, rather than heap.Object Creation unit 502 calls described data load unit 503, configuration data is loaded in the communal space 501 of opening up member in the initialization object.
Data load unit 503 is provided with loading function, is used to carry out data loading operations, configuration data is loaded in the communal space 501 of opening up; Data access unit 504 is provided with access function, is used for the configuration data of the communal space 501 is carried out accessing operation.According to the principle of homology compiling, need will realize the loading function of data load function and realize that the access function of data access function places same source file, could produce identical virtual table after the compiling like this.Therefore described source file is arranged to parameterized calling, when certain process is carried out described file,, perhaps calls loading function, perhaps call access function by the parameter assignment.
For example, when configuration refreshes process and carries out refresh operation at every turn, open up the described communal space 501 again,, call data load unit 503 new configuration data is loaded in the communal space then to the parameter assignment by Object Creation unit 502.During transaction processing process visit shared data,, call data access unit 504 operation that conducts interviews to described parameter assignment.
The present invention is preferred, for guaranteeing that same shared data is carried out visit and the operation that refreshes can parallel running, the communal space 501 is divided into two zones deposits two groups of configuration datas that structure is identical.For guaranteeing the data all application processes just can be used renewal immediately after the refresh operation of configuration data is finished after, also be provided with zone bit and identify wherein one group of data.By reading described zone bit information, application process is called the 504 pairs of current set of configuration data of using in data access unit and is conducted interviews, refreshing process transfer data load unit 503 refreshes another and organizes current obsolete configuration data, and dirty bit information, make data access unit 504 when visiting next time, use the configuration data of renewal immediately.Wherein, described zone bit information can be indicated the shared region of application process visit, also can indicate the shared region that refreshes the process visit.
Use two set of configuration data by switching, can the dynamic refresh configuration data, and do not influence share and access to described configuration data, therefore the process of using shared data is suspended running because of configuration data is refreshed time decreased to one to the negligible degree of system's normal operation, reach the purpose of dynamic refresh configuration data safely.And, also reduced memory consumption, improved the treatment effeciency and the success ratio of system.
More than to the dynamic refresh method and the system of data provided by the present invention, be described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, part in specific embodiments and applications all can change.In sum, this description should not be construed as limitation of the present invention.
Claims (12)
1, the dynamic refresh method of data is characterized in that, comprising:
Open up the communal space, shared data is left in the described communal space with object form;
Parameterized loading function and access function are set in same source file;
By to described parameter assignment, refresh the process transfer loading function described shared data is carried out refresh operation;
By to described parameter assignment, application process is called access function to the operation that conducts interviews of described shared data.
2, method according to claim 1 is characterized in that, the process that refreshes is carried out refresh operation according to following steps: create shared object again, call loading function described shared object is loaded into the communal space; Wherein, described shared object is meant the shared data of the renewal of depositing with object form.
3, method according to claim 1 is characterized in that, also comprises:
In the described communal space, divide two zones and deposit shared data, and one of them regional zone bit information of sign is set;
Application process reads described zone bit information, determines that the shared data of depositing in one of them zone is the shared data of current use, and operation conducts interviews; Wherein, the shared data of described current use is meant current shared data of being visited by other application processes;
The process of refreshing reads described zone bit information, determines extra-regional another zone of current use is carried out the refresh operation of shared data, revises described zone bit information behind the Flushing success; Wherein, the described current zone of using is meant the current zone that is being employed the process visit.
4, method according to claim 3 is characterized in that: described zone bit information is used to indicate the shared region of the current use of application process.
5, method according to claim 3 is characterized in that: described zone bit information is used to indicate that the process that refreshes uses at extra-regional another shared region of described current use.
6, method according to claim 3 is characterized in that: describedly refresh process and application process parallel running.
7, the dynamic refresh system of data is characterized in that, comprising:
The communal space is used for depositing shared data with object form;
The Object Creation unit is used to open up the described communal space, creates the shared object of corresponding shared data;
The data load unit is used to provide parameterized loading function, and the process that refreshes is loaded into the described communal space by to described parameter assignment with shared data;
The data access unit is used to provide parameterized access function, and application process is visited shared data by to described parameter assignment.
Wherein, loading function and the access function in the data access unit in the described data load unit places same source file to compile.
8, system according to claim 7 is characterized in that: when the process that refreshes refreshes shared data at every turn, also call described Object Creation unit and create shared object again.
9, system according to claim 7 is characterized in that: the described communal space is divided into two zones and deposits shared data, and one of them regional zone bit information of sign is set; The data access unit determines that by described zone bit information the shared data of depositing in one of them zone is the shared data of current use, and application process conducts interviews; Wherein, the shared data of described current use is meant current shared data of being visited by other application processes; The process that refreshes determines extra-regional another zone of current use is carried out the refresh operation of shared data by described zone bit information, revises described zone bit information behind the Flushing success; Wherein, the described current zone of using is meant the current zone that is being employed the process visit.
10, system according to claim 7 is characterized in that: described data load unit and the parallel running of data access unit.
11, system according to claim 7 is characterized in that: described zone bit information is used to indicate the shared region of the current use of application process.
12, system according to claim 7 is characterized in that: described zone bit information is used to indicate that the process that refreshes uses at extra-regional another shared region of described current use.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2007100794398A CN100478895C (en) | 2007-03-12 | 2007-03-12 | Dynamic refresh method and system for data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2007100794398A CN100478895C (en) | 2007-03-12 | 2007-03-12 | Dynamic refresh method and system for data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101017448A CN101017448A (en) | 2007-08-15 |
CN100478895C true CN100478895C (en) | 2009-04-15 |
Family
ID=38726475
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2007100794398A Active CN100478895C (en) | 2007-03-12 | 2007-03-12 | Dynamic refresh method and system for data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100478895C (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102163164B (en) * | 2011-05-06 | 2014-06-25 | 北京华为数字技术有限公司 | Processing method and processor for critical data in shared memory |
CN106357438B (en) * | 2016-09-06 | 2019-12-06 | 杭州迪普科技股份有限公司 | Configuration switching method and device |
CN109343979A (en) * | 2018-09-28 | 2019-02-15 | 珠海沙盒网络科技有限公司 | A kind of configuring management method and system |
CN116935915A (en) * | 2022-04-08 | 2023-10-24 | 长鑫存储技术有限公司 | Semiconductor memory, refresh method, control method, and electronic apparatus |
-
2007
- 2007-03-12 CN CNB2007100794398A patent/CN100478895C/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN101017448A (en) | 2007-08-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6986069B2 (en) | Methods and apparatus for static and dynamic power management of computer systems | |
CN102736945B (en) | A kind of method and system of the Multi-instance running application | |
CN101631328B (en) | Synchronous method performing mutual exclusion access on shared resource, device and network equipment | |
CN101548268B (en) | Advanced contention detection | |
US8935491B2 (en) | Memory architecture for dynamically allocated manycore processor | |
CN105103144A (en) | Apparatuses and methods for adaptive control of memory | |
CN103180852A (en) | Distributed data processing method and apparatus | |
CN101968755B (en) | Application load change adaptive snapshot generating method | |
CN100478895C (en) | Dynamic refresh method and system for data | |
CN101552840B (en) | A method to reduce the power consumption of mobile terminals and the mobile terminals | |
CN112905365B (en) | Data processing method, device, equipment and medium | |
CN111309289A (en) | Memory pool management assembly | |
CN104102535A (en) | Process migration method and migratable operating system | |
CN117075930B (en) | Computing framework management system | |
CN102567220A (en) | Cache access control method and Cache access control device | |
CN1945541A (en) | Processing operation information transfer control system and method | |
CN108959149A (en) | A kind of multi-core processor interaction bus design method based on shared drive | |
US10545909B2 (en) | Computing system management using shared memory | |
CN102016802B (en) | Sharing operating system sub-processes across tasks | |
CN105404591A (en) | Processor system and storer control method for same | |
CN112596918B (en) | Method and memory device for sharing variable among programs in system | |
CN102339031A (en) | Method and device for calling subprogram and PLC (Programmable Logic Controller) control system | |
CN104714792A (en) | Multi-process shared data processing method and device | |
CN109507991A (en) | A kind of two axis servo control platform debugging system and method | |
CN109408226A (en) | Data processing method, device and terminal device |
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 |