[go: up one dir, main page]

CN104571958B - A kind of task executing method and device - Google Patents

A kind of task executing method and device Download PDF

Info

Publication number
CN104571958B
CN104571958B CN201410836028.9A CN201410836028A CN104571958B CN 104571958 B CN104571958 B CN 104571958B CN 201410836028 A CN201410836028 A CN 201410836028A CN 104571958 B CN104571958 B CN 104571958B
Authority
CN
China
Prior art keywords
task
buffer
read
buffer area
priority
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
Application number
CN201410836028.9A
Other languages
Chinese (zh)
Other versions
CN104571958A (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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201410836028.9A priority Critical patent/CN104571958B/en
Publication of CN104571958A publication Critical patent/CN104571958A/en
Application granted granted Critical
Publication of CN104571958B publication Critical patent/CN104571958B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention provides a kind of task executing method and device, method therein is specifically included: receiving the task from multiple application modules;Buffer area is written into the task;And the task is read from the buffer area, and execute the task using single thread.The embodiment of the present invention can effectively save the system resources such as thread resources.Also, the task is executed using single thread can be avoided multithreading and co-operate the problems such as object caused by an object is chaotic.

Description

A kind of task executing method and device
Technical field
The present invention relates to network communication technology fields, more particularly to a kind of task executing method and device.
Background technique
The log of server is the database that recite the information of server all the time.Log can quilt according to content It is divided into application log, security log and system log etc..Wherein, application log is mainly used for recording on server The operation information of application program, security log are mainly used for recording whole behavioural informations in server user's login process, As when which webpage being had accessed, either with or without collection webpage etc.;System log is mainly used for recording server system journey The operation conditions of sequence.
In existing scheme, the operation to the disk write log of server is performed by each application module, such as each application Respectively application log is written in the operation information of corresponding application program by the corresponding application module of program, for website setting Each application module is respectively used to certain behavioural information for generating user write-in security log etc..
The scheme that journalizing is write in above-mentioned execution has the advantages that gently to couple, however, multiple application modules need to account for respectively With corresponding system resource, also, it is mixed to disk is easy to appear when the disk write log of server simultaneously in multiple application modules Random problem.
Summary of the invention
In view of the above problems, it proposes on the present invention overcomes the above problem or at least be partially solved in order to provide one kind State a kind of task executing method and device of problem.
According to one aspect of the present invention, a kind of task executing method is provided, comprising:
The task from multiple application modules of reception;
Buffer area is written into the task;And
The task is read from the buffer area, and executes the task using single thread.
Optionally, described the step of buffer area is written into the task, comprising:
According to the reception sequence of the task, buffer area is written into the task;And/or
According to the priority of the task, buffer area is written into the task;And/or
Buffer area is written in the task by the priority that application module is corresponded to according to the task;And/or
According to the attribute information of the task, buffer area is written into the task.
Optionally, described the step of reading the task from the buffer area, comprising:
According to the write sequence of the task, the task is read from the buffer area;And/or
According to the priority of the task, the task is read from the buffer area;And/or
The priority that application module is corresponded to according to the task reads the task from the buffer area;And/or
According to the attribute information of the task, the task is read from the buffer area.
Optionally, the buffer area includes: core buffer and/or lasting buffer area.
Optionally, described the step of buffer area is written into the task, comprising:
The buffer area is written into the duty cycle.
Optionally, the buffer area is lasting buffer area, and the lasting buffer area includes units chunk;
Then the method also includes:
In the reception sequence according to the task, the task is written in the lasting buffer area after units chunk, for Content generates corresponding first checking parameter in the units chunk;
After reading the task in the units chunk, corresponding second verification is generated for read task and is joined Number;
Judge whether second checking parameter and first checking parameter are consistent;
When second checking parameter is consistent with first checking parameter, read task is executed;
When second checking parameter and first checking parameter are inconsistent, read task is abandoned.
Optionally, the information of the task includes: task data frame, wherein the task data frame is that attached bag is corresponding Encapsulated frame, the attached bag are to decompose to obtain according to data packet, the task data frame include: attached bag number in the packet, Subpacket data and data end-of-packet mark.
According to another aspect of the present invention, a kind of task execution device is provided, comprising:
Receiving module, for receiving the task from multiple application modules;
Writing module, for buffer area to be written in the task;And
Execution module executes the task for reading the task from the buffer area, and using single thread.
Optionally, the write module, comprising:
First write-in submodule.For the reception sequence according to the task, buffer area is written into the task;And/or
Second write-in submodule.For the priority according to the task, buffer area is written into the task;And/or
Submodule is written in third.For corresponding to the priority of application module according to the task, the task is written slow Rush area;And/or
For the attribute information according to the task buffer area is written in the task by the 4th write-in submodule.
Optionally, the execution module, comprising:
First reading submodule reads the task for the write sequence according to the task from the buffer area; And/or
Second reading submodule reads the task for the priority according to the task from the buffer area; And/or
Third reading submodule is read from the buffer area for corresponding to the priority of application module according to the task Take the task;And/or
4th reading submodule reads the task for the attribute information according to the task from the buffer area.
A kind of task executing method and device provided according to embodiments of the present invention, by the task from multiple application modules Buffer area is written in task, the task is read from the buffer area, and execute the task using single thread;Relative to existing Scheme occupies multiple thread resources by multiple application modules to execute the task, and the embodiment of the present invention executes institute using single thread Task is stated, the system resources such as thread resources can be effectively saved.Also, it can be avoided using the single thread execution task multi-thread The problems such as object is chaotic caused by journey one object of co-operation.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention, And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can It is clearer and more comprehensible, the followings are specific embodiments of the present invention.
Detailed description of the invention
By reading the detailed description of hereafter optional embodiment, various other advantages and benefits are common for this field Technical staff will become clear.Attached drawing is only used for showing the purpose of optional embodiment, and is not considered as to the present invention Limitation.And throughout the drawings, the same reference numbers will be used to refer to the same parts.In the accompanying drawings:
Fig. 1 shows a kind of step flow diagram of task executing method according to an embodiment of the invention;
Fig. 2 shows a kind of structural schematic diagrams of buffer area according to an embodiment of the invention;And
Fig. 3 shows a kind of structural schematic diagram of task execution device according to an embodiment of the invention.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure It is fully disclosed to those skilled in the art.
Referring to Fig.1, a kind of step flow diagram of task executing method according to an embodiment of the invention is shown, It can specifically include following steps:
Step 101 receives the task from multiple application modules;
Buffer area is written in the task by step 102;And
Step 103 reads the task from the buffer area, and executes the task using single thread.
In the embodiment of the present invention, the task of multiple application modules can be related to identical operation, such as be to disk write day Operation of will etc.;It alsos relate to different operations, such as reads the operation of data from database and to the behaviour of database write data Make etc., the embodiment of the present invention is without restriction to specific task and task source.
In a kind of application example of the invention, task can be numbered according to the reception sequence of the task, so Buffer area is written into the task according to number order afterwards, and, the buffer area is scanned, according to write sequence from the buffering Task is read in area, and executes the task using single thread, so as to guarantee the quick execution of task.
In the embodiment of the present invention, buffer area can be used for storing the task from multiple application modules.Referring to Fig. 2, show A kind of structural schematic diagram of buffer area according to an embodiment of the invention, can specifically include write pointer and read pointer, In, write pointer can be used for waiting task 1, task 2, task 3 ... into write-in buffer area, and read pointer can be used for reading from the buffer area Task can realize the reading of task, and read using single thread execution in practical applications by the read pointer Task.It should be noted that the read operation of task can also be executed by single thread, the embodiment of the present invention grasps the reading of task The executing subject of work is without restriction.
By above-mentioned to for the operation of the disk write log of server, the embodiment of the present invention can be corresponding from each application program Application module, for the application modules reception such as each application module of website setting write log task accordingly, by the task Buffer area is written, the task is read from the buffer area, and execute the task using single thread;Relative to existing scheme Log task is write described in being executed by the multiple thread resources of multiple application modules occupancy, the embodiment of the present invention utilizes single thread to execute It is described to write log task, the system resources such as thread resources can be effectively saved, also, executing the task using single thread can The problems such as disk occurred during avoiding multithreading from executing task is chaotic.
To sum up, buffer area will be written from the job of multiple application modules in the embodiment of the present invention, from the buffer area It is middle to read the task, and the task is executed using single thread;It is multiple by multiple application modules occupancy relative to existing scheme Thread resources execute the task, and the embodiment of the present invention executes the task using single thread, can effectively save thread money The system resources such as source.Also, it can be avoided multithreading one object of co-operation using the single thread execution task and cause Object it is chaotic the problems such as.
In an alternative embodiment of the invention, it can be controlled by controlling the sequence of task write-in buffer area The sequence that executes of the task is made, correspondingly, described the step of buffer area is written into the task, can specifically include:
According to the reception sequence of the task, buffer area is written into the task;And/or
According to the priority of the task, buffer area is written into the task;And/or
Buffer area is written in the task by the priority that application module is corresponded to according to the task;And/or
According to the attribute information of the task, buffer area is written into the task.
Wherein, the reception sequence of task namely the sequence from corresponding application module reception task, newest received task is then It is written into buffer area at first;The priority of task can be used for indicating that the information such as the urgency level of task, significance level, priority are got over High then corresponding task is more preferentially written into buffer area;In general, the priority that task corresponds to application module is higher, then task is more excellent Buffer area is first written;The attribute information of the task can specifically include: task complexity executes the information such as time, in order to Avoiding executing time longer task influences other execution for executing time shorter tasks, a kind of applies example of the invention In, the time shorter task that executes can preferentially be written, and postpone to execute time longer task.
It is described above to by several schemes of task write-in buffer area, it will be understood that those skilled in the art Member can use any in above-mentioned writing scheme according to actual needs, alternatively, using the combination of above-mentioned several writing schemes, example Such as, the priority of application module and the attribute information of task etc. is corresponded to reception sequence, the priority of task, the task of task to appoint Business information is weighted and averaged, and according to result of weighted average by task write-in buffer area etc., in fact, this field skill Art personnel are equal come the writing scheme for controlling the execution sequence of the task by controlling the sequence that buffer area is written in the task Be it is feasible, the embodiment of the present invention to specifically by the task write-in buffer area scheme it is without restriction.
In another alternative embodiment of the invention, the suitable of the task can be read by controlling from the buffer area Sequence correspondingly described the step of reading the task from the buffer area, specifically may be used to control the sequence that executes of the task To include:
According to the write sequence of the task, the task is read from the buffer area;And/or
According to the priority of the task, the task is read from the buffer area;And/or
The priority that application module is corresponded to according to the task reads the task from the buffer area;And/or
According to the attribute information of the task, the task is read from the buffer area.
It is appreciated that those skilled in the art can use any in above-mentioned read schemes according to actual needs, alternatively, Using the combination of above-mentioned several read schemes, for example, the write sequence of task, the priority of task, task can be answered Buffer area is written in the mission bit streams such as the attribute information with the priority of module and task, and reads these from buffer area first Business information believes the attribute of priority and task that the write sequence of task, the priority of task, task correspond to application module The information such as breath are weighted and averaged, and read from the buffer area according to result of weighted average etc., in fact, this field skill Art personnel read the sequence of the task from the buffer area to control the reading side of the execution sequence of the task by control Case be it is feasible, the embodiment of the present invention is without restriction to the scheme for specifically reading the task from the buffer area.
In the concrete realization, the buffer area can specifically include: core buffer and/or lasting buffer area.Wherein, institute Stating core buffer has the advantages that read or write speed is fast;The lasting buffer area can by data persistence hereof, thus It can guarantee that data are not lost after restarting simultaneously operating.In the concrete realization, the core buffer can use queue, chained list etc. Data structure realizes that the embodiment of the present invention is without restriction to the specific data structure of the core buffer.
In an alternative embodiment of the invention, it described the step of buffer area is written into the task, specifically can wrap It includes: the buffer area is written into the duty cycle.This alternative embodiment can recycle benefit in the faster situation of writing speed With buffer area, to realize the effect for saving cache resources.In the concrete realization, in order to avoid writing speed is more than reading speed Caused data loss problem can refer to write pointer and reading before the buffer area is written in the multiple duty cycle Needle is compared, if position pointed by write pointer has exceeded position pointed by read pointer, it is written in the task Its buffer area, if institute is written without departing from position pointed by read pointer, by the duty cycle in position pointed by write pointer State buffer area.
In another alternative embodiment of the invention, the buffer area can be lasting buffer area, the lasting buffer area It may further include units chunk;
Then the method can also include:
In the reception sequence according to the task, the task is written in the lasting buffer area after units chunk, for Content generates corresponding first checking parameter in the units chunk;
After reading the task in the units chunk, corresponding second verification is generated for read task and is joined Number;
Judge whether second checking parameter and first checking parameter are consistent;
When second checking parameter is consistent with first checking parameter, read task is executed;
When second checking parameter and first checking parameter are inconsistent, read task is abandoned.
When data are stored in the lasting buffer area such as SSD (solid state hard disk, Solid State Drives), due to SSD The service life of middle flash block (block) is limited, therefore inevitably will appear some bad flash blocks in SSD, once flash block becomes Bad block, then data just will be unavailable in the flash block.
Lead to the unavailable of entire flash-block data in order to avoid data are unavailable in bad block, this alternative embodiment is by institute It states multiple tasks to be written in the lasting buffer area after units chunk, corresponding first can be generated for content in the units chunk Checking parameter, in this way, after reading the subtask and its corresponding mission bit stream in the units chunk, for read Business generates corresponding second checking parameter, by judging whether first checking parameter and the second checking parameter unanimously determine Whether the units chunk is damaged, and after determining the units chunk damage, only the data of the units chunk are unavailable, other data (such as with the units chunk other units chunks of same flash block data) can be with normal use, therefore can be improved storage The reliability of data.
In the concrete realization, can using MD5 (message digest algorithm 5, Message-Digest Algorithm 5), The identifying algorithms such as DSA (Digital Signature Algorithm, Digital Signature Algorithm) generate first checking parameter and Second checking parameter, the embodiment of the present invention are not subject to the specific method for generating first checking parameter and the second checking parameter Limitation.
In addition, those skilled in the art can the units chunk determines according to actual conditions size, the units chunk Size can be less than the size of flash block, for example, the size of flash block is in SLC (single layer cell, Single Layer Cell) 128kb, then, the size of the units chunk can be 32kb etc., and the size of the units chunk is not added in the embodiment of the present invention With limitation.
In another alternative embodiment of the invention, the information of the task be can specifically include: task data frame, In, the task data frame can be the corresponding encapsulated frame of attached bag, and the attached bag is to decompose to obtain according to data packet, the task Data frame can specifically include: number, subpacket data and the data end-of-packet mark of attached bag in the packet.This alternative embodiment In, the corresponding data packet larger (such as 128kb) in subtask and when not meeting transmission requirement, data packet can be decomposed into multiple Attached bag (32kb), and number, subpacket data and data packet in the task data frame of each attached bag encapsulation attached bag in the packet The information such as end of identification, so as to guarantee the integrality of data packet transmission.
It should be noted that in order to improve the safety of data, the embodiment of the present invention by the multiple subtask and its Before corresponding mission bit stream write-in buffer area, each subtask and its corresponding mission bit stream can be encrypted, also, From single thread can be decrypted reading of content after reading subtask and its corresponding mission bit stream in the buffer area Reason, the embodiment of the present invention are without restriction to specific Encryption Algorithm and decipherment algorithm.
Referring to Fig. 3, a kind of structural schematic diagram of task execution device according to an embodiment of the invention is shown, specifically May include following module:
Receiving module 301, for receiving the task from multiple application modules;
Writing module 302, for buffer area to be written in the task;And
Execution module 303 executes the task for reading the task from the buffer area, and using single thread.
In the concrete realization, the buffer area can specifically include: core buffer and/or lasting buffer area.
In an alternative embodiment of the invention, the write module 302 can be specifically used for writing the duty cycle Enter the buffer area.
In another alternative embodiment of the invention, the buffer area can be lasting buffer area, the lasting buffering Area may further include units chunk;
Then described device can also include:
First generation module, in the reception sequence according to the task, the lasting buffering to be written in the task In area after units chunk, corresponding first checking parameter is generated for content in the units chunk;
Second generation module, for being generated for read task after reading the task in the units chunk Corresponding second checking parameter;
Judgment module, for judging whether second checking parameter and first checking parameter are consistent;
First execution module, for when second checking parameter is consistent with first checking parameter, execution to be read Taking for task;And
Discard module, for when second checking parameter and first checking parameter are inconsistent, discarding to be read Task.
In another alternative embodiment of the invention, the information of the task be can specifically include: task data frame, Wherein, the task data frame can be the corresponding encapsulated frame of attached bag, and the attached bag is to decompose to obtain according to data packet, described Business data frame specifically can also include: number, subpacket data and the data end-of-packet mark of attached bag in the packet.
For device embodiment, since it is basically similar to the method embodiment, related so being described relatively simple Place illustrates referring to the part of embodiment of the method.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein. Various general-purpose systems can also be used together with teachings based herein.As described above, it constructs required by this kind of system Structure be obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use various Programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this hair Bright preferred forms.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention Example can be practiced without these specific details.In some instances, well known method, structure is not been shown in detail And technology, so as not to obscure the understanding of this specification.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of the various inventive aspects, Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes In example, figure or descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. required to protect Shield the present invention claims features more more than feature expressly recited in each claim.More precisely, as following Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore, Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim itself All as a separate embodiment of the present invention.
Those skilled in the art will understand that can be carried out adaptively to the module in the equipment in embodiment Change and they are arranged in one or more devices different from this embodiment.It can be the module or list in embodiment Member or component are combined into a module or unit or component, and furthermore they can be divided into multiple submodule or subelement or Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it can use any Combination is to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so disclosed All process or units of what method or apparatus are combined.Unless expressly stated otherwise, this specification is (including adjoint The claims, abstract and drawings) disclosed in each feature can with an alternative feature that provides the same, equivalent, or similar purpose come Instead of.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments In included certain features rather than other feature, but the combination of the feature of different embodiments mean it is of the invention Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed Meaning one of can in any combination mode come using.
Various component embodiments of the invention can be implemented in hardware, or to run on one or more processors Software module realize, or be implemented in a combination thereof.It will be understood by those of skill in the art that can be used in practice Microprocessor or digital signal processor (DSP) are realized in task executing method and device according to an embodiment of the present invention The some or all functions of some or all components.The present invention is also implemented as executing method as described herein Some or all device or device programs (for example, computer program and computer program product).Such reality Existing program of the invention can store on a computer-readable medium, or may be in the form of one or more signals. Such signal can be downloaded from Internet platform and be obtained, and be perhaps provided on the carrier signal or in any other forms It provides.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and ability Field technique personnel can be designed alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference symbol between parentheses should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not Element or step listed in the claims.Word "a" or "an" located in front of the element does not exclude the presence of multiple such Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real It is existing.In the unit claims listing several devices, several in these devices can be through the same hardware branch To embody.The use of word first, second, and third does not indicate any sequence.These words can be explained and be run after fame Claim.
The invention discloses A1, a kind of task executing method, comprising:
The task from multiple application modules of reception;
Buffer area is written into the task;And
The task is read from the buffer area, and executes the task using single thread.
A2, method as described in a1, described the step of buffer area is written into the task, comprising:
According to the reception sequence of the task, buffer area is written into the task;And/or
According to the priority of the task, buffer area is written into the task;And/or
Buffer area is written in the task by the priority that application module is corresponded to according to the task;And/or
According to the attribute information of the task, buffer area is written into the task.
A3, method as described in a1, described the step of reading the task from the buffer area, comprising:
According to the write sequence of the task, the task is read from the buffer area;And/or
According to the priority of the task, the task is read from the buffer area;And/or
The priority that application module is corresponded to according to the task reads the task from the buffer area;And/or
According to the attribute information of the task, the task is read from the buffer area.
A4, the method as described in A1 or A2 or A3, the buffer area include: core buffer and/or lasting buffer area.
A5, the method as described in A1 or A2 or A3, described the step of buffer area is written into the task, comprising:
The buffer area is written into the duty cycle.
A6, the method as described in A4, the buffer area are lasting buffer area, and the lasting buffer area includes units chunk;
Then the method also includes:
In the reception sequence according to the task, the task is written in the lasting buffer area after units chunk, for Content generates corresponding first checking parameter in the units chunk;
After reading the task in the units chunk, corresponding second verification is generated for read task and is joined Number;
Judge whether second checking parameter and first checking parameter are consistent;
When second checking parameter is consistent with first checking parameter, read task is executed;
When second checking parameter and first checking parameter are inconsistent, read task is abandoned.
A7, the method as described in A1 or A2 or A3, the information of the task include: task data frame, wherein the task Data frame is the corresponding encapsulated frame of attached bag, and the attached bag is to decompose to obtain according to data packet, and the task data frame includes: attached bag Number, subpacket data and data end-of-packet mark in the packet.
The invention also discloses B8, a kind of task execution device, comprising:
Receiving module, for receiving the task from multiple application modules;
Writing module, for buffer area to be written in the task;And
Execution module executes the task for reading the task from the buffer area, and using single thread.
B9, the device as described in B8, the write module, comprising:
First write-in submodule.For the reception sequence according to the task, buffer area is written into the task;And/or
Second write-in submodule.For the priority according to the task, buffer area is written into the task;And/or
Submodule is written in third.For corresponding to the priority of application module according to the task, the task is written slow Rush area;And/or
For the attribute information according to the task buffer area is written in the task by the 4th write-in submodule.
B10, the device as described in B8, the execution module, comprising:
First reading submodule reads the task for the write sequence according to the task from the buffer area; And/or
Second reading submodule reads the task for the priority according to the task from the buffer area; And/or
Third reading submodule is read from the buffer area for corresponding to the priority of application module according to the task Take the task;And/or
4th reading submodule reads the task for the attribute information according to the task from the buffer area.
B11, the device as described in B 8 or B9 or B10, the buffer area include: core buffer and/or persistently buffer Area.
B12, the device as described in B8 or B9 or B10, the write module are specifically used for duty cycle institute is written State buffer area.
B13, device as described in b11, the buffer area are lasting buffer area, and the lasting buffer area includes units chunk;
Then described device further include:
First generation module, in the reception sequence according to the task, the lasting buffering to be written in the task In area after units chunk, corresponding first checking parameter is generated for content in the units chunk;
Second generation module, for being generated for read task after reading the task in the units chunk Corresponding second checking parameter;
Judgment module, for judging whether second checking parameter and first checking parameter are consistent;
First execution module, for when second checking parameter is consistent with first checking parameter, execution to be read Taking for task;And
Discard module, for when second checking parameter and first checking parameter are inconsistent, discarding to be read Task.
B14, the device as described in B8 or B9 or B10, the information of the task include: task data frame, wherein described Business data frame is the corresponding encapsulated frame of attached bag, and the attached bag is to decompose to obtain according to data packet, and the task data frame includes: son Number, subpacket data and the data end-of-packet mark of packet in the packet.

Claims (10)

1.一种任务执行方法,包括:1. A task execution method, comprising: 接收来自多个应用模块的任务;Receive tasks from multiple application modules; 对写指针和读指针进行比较;Compare the write pointer and the read pointer; 若所述写指针所指向的位置未超出所述读指针所指向的位置,将所述任务依据任务信息的加权平均结果循环写入缓冲区,所述任务信息包括:任务的接收顺序、任务的优先级、任务对应应用模块的优先级和任务的属性信息;所述缓冲区包括:内存缓冲区和/或持久缓冲区,所述持久缓冲区能够将数据持久化在文件中;以及If the position pointed to by the write pointer does not exceed the position pointed to by the read pointer, the task is cyclically written into the buffer according to the weighted average result of task information, where the task information includes: the receiving order of the task, the the priority, the priority of the application module corresponding to the task, and the attribute information of the task; the buffer includes: a memory buffer and/or a persistent buffer, the persistent buffer can persist data in a file; and 从所述缓冲区中读取所述任务,并利用单线程执行所述任务。The task is read from the buffer and executed with a single thread. 2.如权利要求1所述的方法,其特征在于,所述将所述任务写入缓冲区的步骤,包括:2. The method of claim 1, wherein the step of writing the task into a buffer comprises: 按照所述任务的接收顺序,将所述任务写入缓冲区;和/或write the tasks into a buffer in the order in which they were received; and/or 按照所述任务的优先级,将所述任务写入缓冲区;和/或write the task to a buffer according to the priority of the task; and/or 按照所述任务对应应用模块的优先级,将所述任务写入缓冲区;和/或Write the task into the buffer according to the priority of the application module corresponding to the task; and/or 按照所述任务的属性信息,将所述任务写入缓冲区。Write the task into the buffer according to the attribute information of the task. 3.如权利要求1所述的方法,其特征在于,所述从所述缓冲区中读取所述任务的步骤,包括:3. The method of claim 1, wherein the step of reading the task from the buffer comprises: 按照所述任务的写入顺序,从所述缓冲区中读取所述任务;和/或reading the tasks from the buffer in the order in which they were written; and/or 按照所述任务的优先级,从所述缓冲区中读取所述任务;和/或read the task from the buffer according to the priority of the task; and/or 按照所述任务对应应用模块的优先级,从所述缓冲区中读取所述任务;和/或Reading the task from the buffer according to the priority of the application module corresponding to the task; and/or 按照所述任务的属性信息,从所述缓冲区中读取所述任务。The task is read from the buffer according to the attribute information of the task. 4.如权利要求1所述的方法,其特征在于,所述缓冲区为持久缓冲区,所述持久缓冲区包括单位块;4. The method of claim 1, wherein the buffer is a persistent buffer, and the persistent buffer comprises a unit block; 则所述方法还包括:Then the method further includes: 在按照所述任务的接收顺序,将所述任务写入所述持久缓冲区中单位块后,针对所述单位块中内容生成相应的第一校验参数;After the task is written into the unit block in the persistent buffer according to the receiving sequence of the task, a corresponding first verification parameter is generated for the content in the unit block; 在从所述单位块中读取所述任务后,针对所读取的任务生成相应的第二校验参数;After the task is read from the unit block, a corresponding second verification parameter is generated for the read task; 判断所述第二校验参数与所述第一校验参数是否一致;judging whether the second verification parameter is consistent with the first verification parameter; 在所述第二校验参数与所述第一校验参数一致时,执行所读取的任务;When the second verification parameter is consistent with the first verification parameter, execute the read task; 在所述第二校验参数与所述第一校验参数不一致时,丢弃所读取的任务。When the second verification parameter is inconsistent with the first verification parameter, the read task is discarded. 5.如权利要求1或2或3所述的方法,其特征在于,所述任务的信息包括:任务数据帧,其中,所述任务数据帧为子包对应的封装帧,所述子包为依据数据包分解得到,所述任务数据帧包括:子包在数据包中的编号、子包数据和数据包结束标识。5. The method according to claim 1, 2 or 3, wherein the information of the task comprises: a task data frame, wherein the task data frame is an encapsulation frame corresponding to a sub-package, and the sub-package is According to the decomposition of the data packet, the task data frame includes: the number of the sub-packet in the data packet, the data of the sub-packet and the end of the data packet. 6.一种任务执行装置,包括:6. A task execution device, comprising: 接收模块,用于接收来自多个应用模块的任务;A receiving module for receiving tasks from multiple application modules; 写入模块,用于对写指针和读指针进行比较,若所述写指针所指向的位置未超出所述读指针所指向的位置,将所述任务依据任务信息的加权平均结果循环写入缓冲区,所述任务信息包括:任务的接收顺序、任务的优先级、任务对应应用模块的优先级和任务的属性信息;所述缓冲区包括:内存缓冲区和/或持久缓冲区,所述持久缓冲区能够将数据持久化在文件中;以及The writing module is used to compare the write pointer and the read pointer, and if the position pointed to by the write pointer does not exceed the position pointed to by the read pointer, the task is cyclically written into the buffer according to the weighted average result of the task information The task information includes: the receiving order of the task, the priority of the task, the priority of the application module corresponding to the task, and the attribute information of the task; the buffer includes: a memory buffer and/or a persistent buffer, the persistent Buffers can persist data in files; and 执行模块,用于从所述缓冲区中读取所述任务,并利用单线程执行所述任务。An execution module, configured to read the task from the buffer, and use a single thread to execute the task. 7.如权利要求6所述的装置,其特征在于,所述写入模块,包括:7. The device of claim 6, wherein the writing module comprises: 第一写入子模块, 用于按照所述任务的接收顺序,将所述任务写入缓冲区;和/或a first writing submodule, configured to write the tasks into the buffer according to the receiving sequence of the tasks; and/or 第二写入子模块, 用于按照所述任务的优先级,将所述任务写入缓冲区;和/或a second writing submodule, configured to write the task into the buffer according to the priority of the task; and/or 第三写入子模块, 用于按照所述任务对应应用模块的优先级,将所述任务写入缓冲区;和/或a third writing submodule, configured to write the task into the buffer according to the priority of the application module corresponding to the task; and/or 第四写入子模块,用于按照所述任务的属性信息,将所述任务写入缓冲区。The fourth writing submodule is configured to write the task into the buffer according to the attribute information of the task. 8.如权利要求6所述的装置,其特征在于,所述执行模块,包括:8. The apparatus of claim 6, wherein the execution module comprises: 第一读取子模块,用于按照所述任务的写入顺序,从所述缓冲区中读取所述任务;和/或a first reading submodule, configured to read the tasks from the buffer according to the writing sequence of the tasks; and/or 第二读取子模块,用于按照所述任务的优先级,从所述缓冲区中读取所述任务;和/或A second reading submodule, configured to read the task from the buffer according to the priority of the task; and/or 第三读取子模块,用于按照所述任务对应应用模块的优先级,从所述缓冲区中读取所述任务;和/或a third reading submodule, configured to read the task from the buffer according to the priority of the application module corresponding to the task; and/or 第四读取子模块,用于按照所述任务的属性信息,从所述缓冲区中读取所述任务。The fourth reading submodule is configured to read the task from the buffer according to the attribute information of the task. 9.如权利要求6所述的装置,其特征在于,所述缓冲区为持久缓冲区,所述持久缓冲区包括单位块;9. The apparatus of claim 6, wherein the buffer is a persistent buffer, and the persistent buffer comprises a unit block; 则所述装置还包括:Then the device further includes: 第一生成模块,用于在按照所述任务的接收顺序,将所述任务写入所述持久缓冲区中单位块后,针对所述单位块中内容生成相应的第一校验参数;a first generation module, configured to generate a corresponding first verification parameter for the content in the unit block after the task is written into the unit block in the persistent buffer according to the receiving order of the task; 第二生成模块,用于在从所述单位块中读取所述任务后,针对所读取的任务生成相应的第二校验参数;a second generating module, configured to generate a corresponding second verification parameter for the read task after reading the task from the unit block; 判断模块,用于判断所述第二校验参数与所述第一校验参数是否一致;a judgment module for judging whether the second verification parameter is consistent with the first verification parameter; 第一执行模块,用于在所述第二校验参数与所述第一校验参数一致时,执行所读取的任务;以及a first execution module, configured to execute the read task when the second verification parameter is consistent with the first verification parameter; and 丢弃模块,用于在所述第二校验参数与所述第一校验参数不一致时,丢弃所读取的任务。A discarding module, configured to discard the read task when the second verification parameter is inconsistent with the first verification parameter. 10.如权利要求6或7或8所述的装置,其特征在于,所述任务的信息包括:任务数据帧,其中,所述任务数据帧为子包对应的封装帧,所述子包为依据数据包分解得到,所述任务数据帧包括:子包在数据包中的编号、子包数据和数据包结束标识。10. The apparatus according to claim 6, 7 or 8, wherein the information of the task comprises: a task data frame, wherein the task data frame is an encapsulation frame corresponding to a sub-package, and the sub-package is According to the decomposition of the data packet, the task data frame includes: the number of the sub-packet in the data packet, the data of the sub-packet and the end of the data packet.
CN201410836028.9A 2014-12-27 2014-12-27 A kind of task executing method and device Active CN104571958B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410836028.9A CN104571958B (en) 2014-12-27 2014-12-27 A kind of task executing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410836028.9A CN104571958B (en) 2014-12-27 2014-12-27 A kind of task executing method and device

Publications (2)

Publication Number Publication Date
CN104571958A CN104571958A (en) 2015-04-29
CN104571958B true CN104571958B (en) 2019-06-07

Family

ID=53088143

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410836028.9A Active CN104571958B (en) 2014-12-27 2014-12-27 A kind of task executing method and device

Country Status (1)

Country Link
CN (1) CN104571958B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106169979B (en) * 2015-05-19 2020-07-31 阿里巴巴集团控股有限公司 Service processing method and equipment
CN105426236A (en) * 2015-11-11 2016-03-23 上海斐讯数据通信技术有限公司 Realization method and device of high-concurrence state machine as well as system
CN105760234A (en) * 2016-03-17 2016-07-13 联动优势科技有限公司 Thread pool management method and device
CN105824533B (en) * 2016-03-21 2019-06-18 青岛海信移动通信技术股份有限公司 A kind of picture loading method, device and terminal
CN108096837A (en) * 2016-11-25 2018-06-01 盛趣信息技术(上海)有限公司 Game robot dynamic identifying method
CN107491287B (en) * 2017-08-30 2020-06-23 苏州乐麟无线信息科技有限公司 Instruction execution method and device
CN108509327A (en) * 2018-04-20 2018-09-07 深圳市文鼎创数据科技有限公司 A kind of log-output method, device, terminal device and storage medium
CN109189726B (en) * 2018-08-08 2020-12-22 奇安信科技集团股份有限公司 A processing method and device for reading and writing logs
CN113835902B (en) * 2021-09-22 2023-12-05 抖音视界有限公司 Data processing method, device, computer equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670708A (en) * 2004-03-17 2005-09-21 联想(北京)有限公司 Management method for computer log
CN101272276A (en) * 2008-04-22 2008-09-24 深圳国人通信有限公司 Log management implementing method
CN101534213A (en) * 2009-04-09 2009-09-16 成都市华为赛门铁克科技有限公司 Acquisition method of log and log server
CN103578565A (en) * 2012-07-19 2014-02-12 百富计算机技术(深圳)有限公司 Calibration method and device of NAND Flash memory chip

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670708A (en) * 2004-03-17 2005-09-21 联想(北京)有限公司 Management method for computer log
CN101272276A (en) * 2008-04-22 2008-09-24 深圳国人通信有限公司 Log management implementing method
CN101534213A (en) * 2009-04-09 2009-09-16 成都市华为赛门铁克科技有限公司 Acquisition method of log and log server
CN103578565A (en) * 2012-07-19 2014-02-12 百富计算机技术(深圳)有限公司 Calibration method and device of NAND Flash memory chip

Also Published As

Publication number Publication date
CN104571958A (en) 2015-04-29

Similar Documents

Publication Publication Date Title
CN104571958B (en) A kind of task executing method and device
US9632826B2 (en) Prioritizing deferred tasks in pending task queue based on creation timestamp
EP3369030B1 (en) Methods and apparatus for mobile computing device security in testing facilities
JP2021529386A (en) Execution of auxiliary functions on the on-demand network code execution system
CN103020537B (en) Data encrypting method, data encrypting device, data deciphering method and data deciphering device
TWI229806B (en) Method and system for data flow control of execution nodes of an adaptive computing engine (ACE)
US9298592B2 (en) Testing a software interface for a streaming hardware device
CN105843819B (en) Method and device for exporting data
US9454375B2 (en) Parallel program analysis and branch prediction
CN109726004B (en) Data processing method and device
CN104572262B (en) A kind of task executing method and device
US9507637B1 (en) Computer platform where tasks can optionally share per task resources
CN110413210B (en) Method, apparatus and computer program product for processing data
CN105095077B (en) User interface automated testing method and device
CN107729221B (en) Method and device for monitoring messages among threads, computer equipment and storage medium
CN114780215A (en) Task scheduling method, device, equipment and storage medium
CN110069217A (en) A kind of date storage method and device
US9152505B1 (en) Verified hardware-based erasure of data on distributed systems
CN104571957B (en) A kind of method for reading data and assembling device
US20130305211A1 (en) Multiple project areas in a development environment
US10558553B2 (en) Enabling non-blocking runtime application debugging for a single threaded server environment
US10324902B2 (en) Method and apparatus for locking file in memory
US8738935B1 (en) Verified erasure of data implemented on distributed systems
CN106933646B (en) A method and apparatus for creating a virtual machine
WO2018040271A1 (en) Thread processor and thread processing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220718

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.