CN104571958A - Task execution method and task execution device - Google Patents
Task execution method and task execution device Download PDFInfo
- Publication number
- CN104571958A CN104571958A CN201410836028.9A CN201410836028A CN104571958A CN 104571958 A CN104571958 A CN 104571958A CN 201410836028 A CN201410836028 A CN 201410836028A CN 104571958 A CN104571958 A CN 104571958A
- Authority
- CN
- China
- Prior art keywords
- task
- buffer zone
- described task
- write
- buffer
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0656—Data buffering arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0659—Command handling arrangements, e.g. command buffers, queues, command scheduling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling 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
本发明实施例提供了一种任务执行方法和装置,其中的方法具体包括:接收来自多个应用模块的任务;将所述任务写入缓冲区;以及从所述缓冲区中读取所述任务,并利用单线程执行所述任务。本发明实施例能够有效节省线程资源等系统资源。并且,利用单线程执行所述任务能够避免多线程共同操作一个对象而导致的对象混乱等问题。
An embodiment of the present invention provides a task execution method and device, wherein the method specifically includes: receiving tasks from multiple application modules; writing the tasks into a buffer; and reading the tasks from the buffer , and utilize a single thread to perform said tasks. The embodiments of the present invention can effectively save system resources such as thread resources. Moreover, using a single thread to execute the task can avoid problems such as object confusion caused by multiple threads jointly operating an object.
Description
技术领域 technical field
本发明涉及网络通信技术领域,特别是涉及一种任务执行方法和装置。 The present invention relates to the technical field of network communication, in particular to a task execution method and device.
背景技术 Background technique
服务器的日志是记载着服务器每时每刻的信息的一个数据库。日志按照内容可被分为应用程序日志、安全性日志和系统日志等。其中,应用程序日志主要用于记录服务器上应用程序的运行信息,安全性日志主要用于记录服务器用户登录过程中的全部行为信息,如什么时间访问了哪个网页,有没有收藏网页等等;系统日志主要用于记录服务器系统程序的运行状况。 The server's log is a database that records the information of the server at all times. Logs can be divided into application logs, security logs, and system logs according to their content. Among them, the application program log is mainly used to record the running information of the application program on the server, and the security log is mainly used to record all the behavior information of the server user during the login process, such as when and which web page is accessed, whether there is a favorite web page, etc.; the system The log is mainly used to record the running status of the server system program.
现有方案中,向服务器的磁盘写日志的操作是由各应用模块来执行的,如各应用程序对应的应用模块分别将对应应用程序的运行信息写入应用程序日志,针对网站设置的各应用模块分别用于将用户产生的某行为信息写入安全性日志等等。 In the existing solution, the operation of writing logs to the disk of the server is performed by each application module. For example, the application modules corresponding to each application program respectively write the operation information of the corresponding application program into the application program log. The modules are respectively used to write certain behavior information generated by the user into the security log and so on.
上述执行写日志操作的方案具有轻耦合的优点,然而,多个应用模块需要分别占用相应的系统资源,并且,在多个应用模块同时向服务器的磁盘写日志时容易出现磁盘混乱的问题。 The above solution for performing log writing operations has the advantage of light coupling. However, multiple application modules need to occupy corresponding system resources, and when multiple application modules write logs to the server's disk at the same time, it is easy to cause disk confusion.
发明内容 Contents of the invention
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的一种任务执行方法和装置。 In view of the above problems, the present invention is proposed to provide a task execution method and device that overcome the above problems or at least partly solve the above problems.
依据本发明的一个方面,提供了一种任务执行方法,包括: According to one aspect of the present invention, a task execution method is provided, including:
接收来自多个应用模块的任务; Receive tasks from multiple application modules;
将所述任务写入缓冲区;以及 write said tasks to a buffer; and
从所述缓冲区中读取所述任务,并利用单线程执行所述任务。 The task is read from the buffer and executed with a single thread.
可选地,所述将所述任务写入缓冲区的步骤,包括: Optionally, the step of writing the task into the buffer includes:
按照所述任务的接收顺序,将所述任务写入缓冲区;和/或 writing the tasks into a buffer in the order in which they were received; and/or
按照所述任务的优先级,将所述任务写入缓冲区;和/或 writing the task into a buffer according to the priority of the task; and/or
按照所述任务对应应用模块的优先级,将所述任务写入缓冲区;和/或 Writing 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.
可选地,所述从所述缓冲区中读取所述任务的步骤,包括: Optionally, the step of reading the task from the buffer includes:
按照所述任务的写入顺序,从所述缓冲区中读取所述任务;和/或 reading said tasks from said buffer in the order in which said tasks were written; and/or
按照所述任务的优先级,从所述缓冲区中读取所述任务;和/或 reading 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
按照所述任务的属性信息,从所述缓冲区中读取所述任务。 Read the task from the buffer according to the attribute information of the task.
可选地,所述缓冲区包括:内存缓冲区和/或持久缓冲区。 Optionally, the buffer includes: a memory buffer and/or a persistent buffer.
可选地,所述将所述任务写入缓冲区的步骤,包括: Optionally, the step of writing the task into the buffer includes:
将所述任务循环写入所述缓冲区。 Writing the task loop to the buffer.
可选地,所述缓冲区为持久缓冲区,所述持久缓冲区包括单位块; Optionally, the buffer is a persistent buffer, and the persistent buffer includes a unit block;
则所述方法还包括: Then described method also comprises:
在按照所述任务的接收顺序,将所述任务写入所述持久缓冲区中单位块后,针对所述单位块中内容生成相应的第一校验参数; After writing the task into the unit block in the persistent buffer according to the order in which the task is received, generating a corresponding first verification parameter for the content in the unit block;
在从所述单位块中读取所述任务后,针对所读取的任务生成相应的第二校验参数; After reading the task from the unit block, generating a corresponding second verification parameter for the read task;
判断所述第二校验参数与所述第一校验参数是否一致; judging whether the second verification parameter is consistent with the first verification parameter;
在所述第二校验参数与所述第一校验参数一致时,执行所读取的任务; Execute the read task when the second verification parameter is consistent with the first verification parameter;
在所述第二校验参数与所述第一校验参数不一致时,丢弃所读取的任务。 When the second verification parameter is inconsistent with the first verification parameter, the read task is discarded.
可选地,所述任务的信息包括:任务数据帧,其中,所述任务数据帧为子包对应的封装帧,所述子包为依据数据包分解得到,所述任务数据帧包括:子包在数据包中的编号、子包数据和数据包结束标识。 Optionally, the task information includes: a task data frame, wherein the task data frame is an encapsulation frame corresponding to a subpackage, the subpackage is obtained by decomposing a data packet, and the task data frame includes: a subpackage Number in the packet, subpacket data, and end-of-packet identifier.
根据本发明的另一方面,提供了一种任务执行装置,包括: According to another aspect of the present invention, a task performance device is provided, comprising:
接收模块,用于接收来自多个应用模块的任务; a receiving module, configured to receive tasks from multiple application modules;
写入模块,用于将所述任务写入缓冲区;以及 a write module for writing the task into a buffer; and
执行模块,用于从所述缓冲区中读取所述任务,并利用单线程执行所述任务。 The execution module is used to read the task from the buffer and execute the task with a single thread.
可选地,所述写入模块,包括: Optionally, the writing module includes:
第一写入子模块。用于按照所述任务的接收顺序,将所述任务写入缓冲区;和/或 First write to the submodule. for writing the tasks into a buffer in the order in which they are received; and/or
第二写入子模块。用于按照所述任务的优先级,将所述任务写入缓冲区;和/或 The second writes to the submodule. for writing the task into a buffer according to the priority of the task; and/or
第三写入子模块。用于按照所述任务对应应用模块的优先级,将所述任务写入缓冲区;和/或 The third writes to the submodule. For writing the task into the buffer according to the priority of the application module corresponding to the task; and/or
第四写入子模块,用于按照所述任务的属性信息,将所述任务写入缓冲区。 The fourth writing submodule is used to write the task into the buffer according to the attribute information of the task.
可选地,所述执行模块,包括: Optionally, the execution module includes:
第一读取子模块,用于按照所述任务的写入顺序,从所述缓冲区中读取所述任务;和/或 The first reading submodule is used to read the tasks from the buffer according to the order in which the tasks are written; and/or
第二读取子模块,用于按照所述任务的优先级,从所述缓冲区中读取所述任务;和/或 The second reading submodule is used to read the task from the buffer according to the priority of the task; and/or
第三读取子模块,用于按照所述任务对应应用模块的优先级,从所述缓冲区中读取所述任务;和/或 The third reading submodule is 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.
根据本发明实施例提供的一种任务执行方法和装置,将来自多个应用模块的任务任务写入缓冲区,从所述缓冲区中读取所述任务,并利用单线程执行所述任务;相对于现有方案由多个应用模块占用多个线程资源来执行所述任务,本发明实施例利用单线程执行所述任务,能够有效节省线程资源等系统资源。并且,利用单线程执行所述任务能够避免多线程共同操作一个对象而导致的对象混乱等问题。 According to a task execution method and device provided by an embodiment of the present invention, write tasks from multiple application modules into a buffer, read the tasks from the buffer, and execute the tasks using a single thread; Compared with the existing solution in which multiple application modules occupy multiple thread resources to perform the task, the embodiment of the present invention uses a single thread to perform the task, which can effectively save system resources such as thread resources. Moreover, using a single thread to execute the task can avoid problems such as object confusion caused by multiple threads jointly operating an object.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技 术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。 The above description is only an overview of the technical solution of the present invention. In order to understand the technical means of the present invention more clearly, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and easy Understand, the specific embodiment of the present invention is enumerated below.
附图说明 Description of drawings
通过阅读下文可选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出可选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中: Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the alternative embodiments. The drawings are only for purposes of illustrating alternative embodiments and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:
图1示出了根据本发明一个实施例的一种任务执行方法的步骤流程示意图; FIG. 1 shows a schematic flowchart of steps of a task execution method according to an embodiment of the present invention;
图2示出了根据本发明一个实施例的一种缓冲区的结构示意图;以及 Fig. 2 shows a schematic structural diagram of a buffer according to an embodiment of the present invention; and
图3示出了根据本发明一个实施例的一种任务执行装置的结构示意图。 Fig. 3 shows a schematic structural diagram of a task execution device according to an embodiment of the present invention.
具体实施方式 Detailed ways
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。 Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
参照图1,示出了根据本发明一个实施例的一种任务执行方法的步骤流程示意图,具体可以包括如下步骤: Referring to FIG. 1 , it shows a schematic flow chart of the steps of a task execution method according to an embodiment of the present invention, which may specifically include the following steps:
步骤101、接收来自多个应用模块的任务; Step 101, receiving tasks from multiple application modules;
步骤102、将所述任务写入缓冲区;以及 Step 102, writing the task into a buffer; and
步骤103、从所述缓冲区中读取所述任务,并利用单线程执行所述任务。 Step 103, read the task from the buffer, and execute the task with a single thread.
本发明实施例中,多个应用模块的任务可以涉及相同的操作,如均为向磁盘写日志的操作等等;也可以涉及不同的操作,如从数据库读数据的操作及向数据库写数据的操作等等,本发明实施例对具体的任务及任务来源不加以限制。 In the embodiment of the present invention, the tasks of multiple application modules may involve the same operation, such as the operation of writing logs to the disk, etc.; they may also involve different operations, such as the operation of reading data from the database and writing data to the database. Operation, etc., the embodiment of the present invention does not limit specific tasks and task sources.
在本发明的一种应用示例中,可以按照所述任务的接收顺序对任务进行 编号,然后按照编号顺序将所述任务写入缓冲区,以及,扫描所述缓冲区,按照写入顺序从所述缓冲区中读取任务,并利用单线程执行所述任务,从而能够保证任务的快速执行。 In an application example of the present invention, the tasks can be numbered according to the order in which they are received, and then the tasks are written into the buffer according to the order of numbering, and the buffer is scanned to read from the Read the task in the above buffer, and execute the task with a single thread, so as to ensure the fast execution of the task.
本发明实施例中,缓冲区可用于存储来自多个应用模块的任务。参照图2,示出了根据本发明一个实施例的一种缓冲区的结构示意图,其具体可以包括写指针和读指针,其中,写指针可用于将任务1、任务2、任务3…等写入缓冲区,读指针可用于从所述缓冲区读取任务,在实际应用中,可以通过所述读指针来实现任务的读取,并利用单线程执行所读取的任务。需要说明的是,也可由单线程来执行任务的读取操作,本发明实施例对任务的读取操作的执行主体不加以限制。 In the embodiment of the present invention, the buffer can be used to store tasks from multiple application modules. Referring to FIG. 2 , it shows a schematic structural diagram of a buffer according to an embodiment of the present invention, which may specifically include a write pointer and a read pointer, wherein the write pointer may be used to write task 1, task 2, task 3..., etc. Into the buffer, the read pointer can be used to read tasks from the buffer, in practical applications, the reading of tasks can be realized through the read pointer, and the read tasks can be executed by using a single thread. It should be noted that the reading operation of the task may also be performed by a single thread, and the embodiment of the present invention does not limit the execution subject of the reading operation of the task.
以上述向服务器的磁盘写日志的操作为例,本发明实施例可以从各应用程序对应的应用模块、针对网站设置的各应用模块等应用模块接收相应的写日志任务,将所述任务写入缓冲区,从所述缓冲区中读取所述任务,并利用单线程执行所述任务;相对于现有方案由多个应用模块占用多个线程资源来执行所述写日志任务,本发明实施例利用单线程执行所述写日志任务,能够有效节省线程资源等系统资源,并且,利用单线程执行所述任务能够避免多线程执行任务过程中出现的磁盘混乱等问题。 Taking the above-mentioned operation of writing logs to the disk of the server as an example, the embodiment of the present invention may receive corresponding log writing tasks from application modules corresponding to application programs, application modules set for websites, etc., and write the tasks into Buffer, read the task from the buffer, and use a single thread to execute the task; Compared with the existing solution where multiple application modules occupy multiple thread resources to perform the log writing task, the present invention implements For example, using a single thread to execute the log writing task can effectively save system resources such as thread resources, and using a single thread to execute the task can avoid problems such as disk confusion during multi-threaded execution of the task.
综上,本发明实施例将来自多个应用模块的任务任务写入缓冲区,从所述缓冲区中读取所述任务,并利用单线程执行所述任务;相对于现有方案由多个应用模块占用多个线程资源来执行所述任务,本发明实施例利用单线程执行所述任务,能够有效节省线程资源等系统资源。并且,利用单线程执行所述任务能够避免多线程共同操作一个对象而导致的对象混乱等问题。 In summary, the embodiment of the present invention writes tasks from multiple application modules into a buffer, reads the tasks from the buffer, and executes the tasks using a single thread; The application module occupies multiple thread resources to execute the task, and the embodiment of the present invention uses a single thread to execute the task, which can effectively save system resources such as thread resources. Moreover, using a single thread to execute the task can avoid problems such as object confusion caused by multiple threads jointly operating an object.
在本发明的一种可选实施例中,可以通过控制将所述任务写入缓冲区的顺序来控制所述任务的执行顺序,相应地,所述将所述任务写入缓冲区的步骤,具体可以包括: In an optional embodiment of the present invention, the execution order of the tasks may be controlled by controlling the order in which the tasks are written into the buffer, and correspondingly, the step of writing the tasks into the buffer, Specifically can include:
按照所述任务的接收顺序,将所述任务写入缓冲区;和/或 writing the tasks into a buffer in the order in which they were received; and/or
按照所述任务的优先级,将所述任务写入缓冲区;和/或 writing the task into a buffer according to the priority of the task; and/or
按照所述任务对应应用模块的优先级,将所述任务写入缓冲区;和/或 Writing 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.
其中,任务的接收顺序也即从对应应用模块接收任务的顺序,最新接收的任务则最先被写入缓冲区;任务的优先级可用于表示任务的紧急程度、重要程度等信息,优先级越高则对应的任务越优先被写入缓冲区;通常,任务对应应用模块的优先级越高,则任务越优先写入缓冲区;所述任务的属性信息具体可以包括:任务复杂程度、执行时间等信息,为了避免执行时间较长的任务影响其它执行时间较短任务的执行,在本发明的一种应用示例中,可以优先写入执行时间较短的任务,而延迟执行时间较长的任务。 Among them, the receiving order of tasks is the order in which tasks are received from the corresponding application modules, and the latest received tasks are first written into the buffer; The higher the priority, the corresponding task is written into the buffer; usually, the higher the priority of the task corresponding to the application module, the higher the priority of the task is written into the buffer; the attribute information of the task can specifically include: task complexity, execution time and other information, in order to prevent tasks with a long execution time from affecting the execution of other tasks with a short execution time, in an application example of the present invention, tasks with a short execution time can be written first, and tasks with a long execution time can be delayed .
以上对将所述任务写入缓冲区的几种方案进行了介绍,可以理解,本领域技术人员可以根据实际需求采用上述写入方案中的任一,或者,采用上述几种写入方案的组合,例如,对任务的接收顺序、任务的优先级、任务对应应用模块的优先级和任务的属性信息等任务信息进行加权平均,并依据加权平均结果将所述任务写入缓冲区等等,实际上,本领域技术人员通过控制将所述任务写入缓冲区的顺序来控制所述任务的执行顺序的写入方案均是可行的,本发明实施例对具体的将所述任务写入缓冲区的方案不加以限制。 Several schemes for writing the task into the buffer have been introduced above, and it can be understood that those skilled in the art can adopt any of the above writing schemes according to actual needs, or use a combination of the above several writing schemes , for example, weighted average of task information such as task receiving order, task priority, task corresponding application module priority and task attribute information, and write the task into the buffer according to the weighted average result, etc., the actual In general, it is feasible for those skilled in the art to control the execution order of the tasks by controlling the order in which the tasks are written into the buffer. The embodiment of the present invention is specific to writing the tasks into the buffer The programs are not limited.
在本发明的另一种可选实施例中,可以通过控制从所述缓冲区读取所述任务的顺序来控制所述任务的执行顺序,相应地,所述从所述缓冲区中读取所述任务的步骤,具体可以包括: In another optional embodiment of the present invention, the execution order of the tasks can be controlled by controlling the order in which the tasks are read from the buffer, and correspondingly, the reading from the buffer The steps of the task may specifically include:
按照所述任务的写入顺序,从所述缓冲区中读取所述任务;和/或 reading said tasks from said buffer in the order in which said tasks were written; and/or
按照所述任务的优先级,从所述缓冲区中读取所述任务;和/或 reading 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
按照所述任务的属性信息,从所述缓冲区中读取所述任务。 Read the task from the buffer according to the attribute information of the task.
可以理解,本领域技术人员可以根据实际需求采用上述读取方案中的任一,或者,采用上述几种读取方案的组合,例如,可以将任务的写入顺序、任务的优先级、任务对应应用模块的优先级和任务的属性信息等任务信息写入缓冲区,并首先从缓冲区中读取这些任务信息,对任务的写入顺序、任务 的优先级、任务对应应用模块的优先级和任务的属性信息等信息进行加权平均,并依据加权平均结果从所述缓冲区中读取等等,实际上,本领域技术人员通过控制从所述缓冲区读取所述任务的顺序来控制所述任务的执行顺序的读取方案均是可行的,本发明实施例对具体的从所述缓冲区中读取所述任务的方案不加以限制。 It can be understood that those skilled in the art can adopt any of the above-mentioned reading schemes according to actual needs, or use a combination of the above-mentioned several reading schemes, for example, the writing order of tasks, the priority of tasks, and the corresponding tasks The task information such as the priority of the application module and the attribute information of the task is written into the buffer, and the task information is first read from the buffer, and the writing order of the task, the priority of the task, the priority and Information such as the attribute information of the task is weighted averaged, and read from the buffer according to the weighted average result, etc. In fact, those skilled in the art control the order in which the tasks are read from the buffer. The reading scheme of the execution order of the above tasks is feasible, and the embodiment of the present invention does not limit the specific scheme of reading the tasks from the buffer.
在具体实现中,所述缓冲区具体可以包括:内存缓冲区和/或持久缓冲区。其中,所述内存缓冲区具有读写速度快的优点;所述持久缓冲区能够将数据持久化在文件中,从而能够保证重启同步操作后数据不丢失。在具体实现中,所述内存缓冲区可以用队列、链表等数据结构实现,本发明实施例对所述内存缓冲区的具体数据结构不加以限制。 In a specific implementation, the buffer may specifically include: a memory buffer and/or a persistent buffer. Wherein, the memory buffer has the advantage of fast reading and writing speed; the persistent buffer can persist data in the file, so as to ensure that the data will not be lost after restarting the synchronization operation. In a specific implementation, the memory buffer can be implemented with data structures such as a queue and a linked list, and the embodiment of the present invention does not limit the specific data structure of the memory buffer.
在本发明的一种可选实施例中,所述将所述任务写入缓冲区的步骤,具体可以包括:将所述任务循环写入所述缓冲区。本可选实施例可以在写入速度较快的情况下循环利用缓冲区,从而实现节省缓存资源的效果。在具体实现中,为了避免写入速度超过读取速度引起的数据丢失问题,在将所述多个任务循环写入所述缓冲区之前,可以对写指针和读指针进行比较,如果写指针所指向的位置超出了读指针所指向的位置,则将所述任务写入其它缓冲区,若写指针所指向的位置未超出读指针所指向的位置,则将所述任务循环写入所述缓冲区。 In an optional embodiment of the present invention, the step of writing the task into the buffer may specifically include: cyclically writing the task into the buffer. In this optional embodiment, the buffer can be recycled when the writing speed is fast, so as to achieve the effect of saving cache resources. In a specific implementation, in order to avoid the problem of data loss caused by the writing speed exceeding the reading speed, before the multiple tasks are cyclically written into the buffer, the write pointer and the read pointer can be compared. If the position pointed to exceeds the position pointed to by the read pointer, then write the task into other buffers, if the position pointed to by the write pointer does not exceed the position pointed to by the read pointer, then write the task into the buffer cyclically district.
本发明的另一种可选实施例中,所述缓冲区可以为持久缓冲区,所述持久缓冲区可以进一步包括单位块; In another optional embodiment of the present invention, the buffer may be a persistent buffer, and the persistent buffer may further include a unit block;
则所述方法还可以包括: Then described method can also comprise:
在按照所述任务的接收顺序,将所述任务写入所述持久缓冲区中单位块后,针对所述单位块中内容生成相应的第一校验参数; After writing the task into the unit block in the persistent buffer according to the order in which the task is received, generating a corresponding first verification parameter for the content in the unit block;
在从所述单位块中读取所述任务后,针对所读取的任务生成相应的第二校验参数; After reading the task from the unit block, generating a corresponding second verification parameter for the read task;
判断所述第二校验参数与所述第一校验参数是否一致; judging whether the second verification parameter is consistent with the first verification parameter;
在所述第二校验参数与所述第一校验参数一致时,执行所读取的任务; Execute the read task when the second verification parameter is consistent with the first verification parameter;
在所述第二校验参数与所述第一校验参数不一致时,丢弃所读取的任务。 When the second verification parameter is inconsistent with the first verification parameter, the read task is discarded.
当数据存储在SSD(固态硬盘,Solid State Drives)等持久缓冲区中时,由于SSD中闪存块(block)的寿命是有限的,故SSD中难免会出现一些坏的闪存块,一旦闪存块成为坏块,则该闪存块中数据就将不可用。 When data is stored in persistent buffers such as SSDs (Solid State Drives), since the lifespan of flash memory blocks (blocks) in SSDs is limited, some bad flash memory blocks will inevitably appear in SSDs. Once the flash memory blocks become If there is a bad block, the data in the flash memory block will be unavailable.
为了避免坏块中数据不可用导致整个闪存块数据的不可用,本可选实施例在将所述多个任务写入所述持久缓冲区中单位块后,可以针对所述单位块中内容生成相应的第一校验参数,这样,在从所述单位块中读取所述子任务及其对应任务信息后,针对所读取的任务生成相应的第二校验参数,通过判断所述第一校验参数和第二校验参数是否一致来确定所述单位块是否损坏,在确定所述单位块损坏后,只是所述单位块的数据不可用,其它数据(如与所述单位块在同一闪存块的其它单位块的数据)还可以正常使用,因此能够提高存储数据的可靠性。 In order to avoid the unavailability of the data in the bad block and cause the unavailability of the data of the entire flash memory block, after the multiple tasks are written into the unit block in the persistent buffer in this optional embodiment, the content in the unit block can be generated. Corresponding first verification parameters, in this way, after reading the subtasks and their corresponding task information from the unit block, generate corresponding second verification parameters for the read tasks, by judging the first Whether the first check parameter is consistent with the second check parameter determines whether the unit block is damaged. After it is determined that the unit block is damaged, only the data of the unit block is unavailable, and other data (such as those in the unit block) The data of other unit blocks of the same flash memory block) can also be used normally, so the reliability of stored data can be improved.
在具体实现中,可以采用MD5(信息摘要算法5,Message-Digest Algorithm 5)、DSA(数字签名算法,Digital Signature Algorithm)等认证算法生成所述第一校验参数和第二校验参数,本发明实施例对生成所述第一校验参数和第二校验参数的具体方法不加以限制。 In a specific implementation, authentication algorithms such as MD5 (Information Digest Algorithm 5, Message-Digest Algorithm 5), DSA (Digital Signature Algorithm, Digital Signature Algorithm) can be used to generate the first verification parameter and the second verification parameter. The embodiment of the invention does not limit the specific method for generating the first verification parameter and the second verification parameter.
另外,本领域技术人员可以根据实际情况确定所述单位块的大小,所述单位块的大小可以小于闪存块的大小,例如,SLC(单层单元,Single Layer Cell)中闪存块的大小为128kb,那么,所述单位块的大小可以为32kb等等,本发明实施例对所述单位块的大小不加以限制。 In addition, those skilled in the art can determine the size of the unit block according to the actual situation, the size of the unit block can be smaller than the size of the flash memory block, for example, the size of the flash memory block in SLC (Single Layer Cell, Single Layer Cell) is 128kb , then, the size of the unit block may be 32kb, etc., and the embodiment of the present invention does not limit the size of the unit block.
在本发明的再一种可选实施例中,所述任务的信息具体可以包括:任务数据帧,其中,所述任务数据帧可以为子包对应的封装帧,所述子包为依据数据包分解得到,所述任务数据帧具体可以包括:子包在数据包中的编号、子包数据和数据包结束标识。本可选实施例中,在子任务对应的数据包较大(如128kb)而不符合传输要求时,可以将数据包分解为多个子包(32kb),并在每个子包的任务数据帧封装子包在数据包中的编号、子包数据和数据包结束标识等信息,从而能够保证数据包传输的完整性。 In yet another optional embodiment of the present invention, the task information may specifically include: a task data frame, wherein the task data frame may be an encapsulation frame corresponding to a subpacket, and the subpacket is a basis data packet After being decomposed, the task data frame may specifically include: the number of the subpacket in the data packet, subpackage data, and an end identifier of the data packet. In this optional embodiment, when the data packet corresponding to the subtask is relatively large (such as 128kb) and does not meet the transmission requirements, the data packet can be decomposed into multiple subpackages (32kb), and encapsulated in the task data frame of each subpackage The number of the subpacket in the data packet, the data of the subpacket, the end identifier of the data packet and other information can ensure the integrity of the data packet transmission.
需要说明的是,为了提高数据的安全性,本发明实施例在将所述多个子任务及其对应任务信息写入缓冲区之前,可以将每个子任务及其对应任务信息进行加密处理,并且,在单个线程从所述缓冲区中读取子任务及其对应任务信息后可以对读取内容进行解密处理,本发明实施例对具体的加密算法和解密算法不加以限制。 It should be noted that, in order to improve data security, before writing the plurality of subtasks and their corresponding task information into the buffer in this embodiment of the present invention, each subtask and its corresponding task information may be encrypted, and, After a single thread reads subtasks and their corresponding task information from the buffer, the read content can be decrypted. The embodiment of the present invention does not limit the specific encryption algorithm and decryption algorithm.
参照图3,示出了根据本发明一个实施例的一种任务执行装置的结构示意图,具体可以包括如下模块: Referring to FIG. 3 , it shows a schematic structural diagram of a task execution device according to an embodiment of the present invention, which may specifically include the following modules:
接收模块301,用于接收来自多个应用模块的任务; A receiving module 301, configured to receive tasks from multiple application modules;
写入模块302,用于将所述任务写入缓冲区;以及 A writing module 302, configured to write the task into a buffer; and
执行模块303,用于从所述缓冲区中读取所述任务,并利用单线程执行所述任务。 The execution module 303 is configured to read the task from the buffer and execute the task with a single thread.
在具体实现中,所述缓冲区具体可以包括:内存缓冲区和/或持久缓冲区。 In a specific implementation, the buffer may specifically include: a memory buffer and/or a persistent buffer.
在本发明的一种可选实施例中,所述写入模块302,可具体用于将所述任务循环写入所述缓冲区。 In an optional embodiment of the present invention, the writing module 302 may be specifically configured to write the task cycle into the buffer.
在本发明的另一种可选实施例中,所述缓冲区可以为持久缓冲区,所述持久缓冲区可以进一步包括单位块; In another optional embodiment of the present invention, the buffer may be a persistent buffer, and the persistent buffer may further include a unit block;
则所述装置还可以包括: The device may also include:
第一生成模块,用于在按照所述任务的接收顺序,将所述任务写入所述持久缓冲区中单位块后,针对所述单位块中内容生成相应的第一校验参数; The first generation module is configured to generate a corresponding first verification parameter for the content in the unit block after writing the task into the unit block in the persistent buffer according to the order in which the tasks are received;
第二生成模块,用于在从所述单位块中读取所述任务后,针对所读取的任务生成相应的第二校验参数; 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 judging module, configured to judge 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.
在本发明的再一种可选实施例中,所述任务的信息具体可以包括:任务 数据帧,其中,所述任务数据帧可以为子包对应的封装帧,所述子包为依据数据包分解得到,所述任务数据帧具体可也包括:子包在数据包中的编号、子包数据和数据包结束标识。 In yet another optional embodiment of the present invention, the information of the task may specifically include: a task data frame, wherein the task data frame may be an encapsulation frame corresponding to a subpackage, and the subpackage is a basis data packet After being decomposed, the task data frame may specifically include: the number of the subpacket in the data packet, subpackage data, and the end identifier of the data packet.
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。 As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for related parts, please refer to the part of the description of the method embodiment.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。 The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。 In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.
类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。 Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或 者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。 Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings), as well as any method or method so disclosed, may be used in any combination, unless at least some of such features and/or processes or units are mutually exclusive. or all processes or units of equipment. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。 Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的任务执行方法和装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网平台上下载得到,或者在载体信号上提供,或者以任何其他形式提供。 The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the task execution method and apparatus according to the embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet platform, or provided on a carrier signal, or provided in any other form.
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。 It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.
本发明公开了A1、一种任务执行方法,包括: The invention discloses A1. A task execution method, comprising:
接收来自多个应用模块的任务; Receive tasks from multiple application modules;
将所述任务写入缓冲区;以及 write said tasks to a buffer; and
从所述缓冲区中读取所述任务,并利用单线程执行所述任务。 The task is read from the buffer and executed with a single thread.
A2、如A1所述的方法,所述将所述任务写入缓冲区的步骤,包括: A2, the method as described in A1, the described step of writing described task into buffer zone, comprises:
按照所述任务的接收顺序,将所述任务写入缓冲区;和/或 writing the tasks into a buffer in the order in which they were received; and/or
按照所述任务的优先级,将所述任务写入缓冲区;和/或 writing the task into a buffer according to the priority of the task; and/or
按照所述任务对应应用模块的优先级,将所述任务写入缓冲区;和/或 Writing 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.
A3、如A1所述的方法,所述从所述缓冲区中读取所述任务的步骤,包括: A3. The method as described in A1, the step of reading the task from the buffer comprises:
按照所述任务的写入顺序,从所述缓冲区中读取所述任务;和/或 reading said tasks from said buffer in the order in which said tasks were written; and/or
按照所述任务的优先级,从所述缓冲区中读取所述任务;和/或 reading 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
按照所述任务的属性信息,从所述缓冲区中读取所述任务。 Read the task from the buffer according to the attribute information of the task.
A4、如A1或A2或A3所述的方法,所述缓冲区包括:内存缓冲区和/或持久缓冲区。 A4. The method described in A1 or A2 or A3, wherein the buffer includes: a memory buffer and/or a persistent buffer.
A5、如A1或A2或A3所述的方法,所述将所述任务写入缓冲区的步骤,包括: A5. The method as described in A1 or A2 or A3, the step of writing the task into the buffer includes:
将所述任务循环写入所述缓冲区。 Writing the task loop to the buffer.
A6、如A4所述的方法,所述缓冲区为持久缓冲区,所述持久缓冲区包括单位块; A6, the method as described in A4, the buffer is a persistent buffer, and the persistent buffer includes a unit block;
则所述方法还包括: Then described method also comprises:
在按照所述任务的接收顺序,将所述任务写入所述持久缓冲区中单位块后,针对所述单位块中内容生成相应的第一校验参数; After writing the task into the unit block in the persistent buffer according to the order in which the task is received, generating a corresponding first verification parameter for the content in the unit block;
在从所述单位块中读取所述任务后,针对所读取的任务生成相应的第二校验参数; After reading the task from the unit block, generating a corresponding second verification parameter for the read task;
判断所述第二校验参数与所述第一校验参数是否一致; judging whether the second verification parameter is consistent with the first verification parameter;
在所述第二校验参数与所述第一校验参数一致时,执行所读取的任务; Execute the read task when the second verification parameter is consistent with the first verification parameter;
在所述第二校验参数与所述第一校验参数不一致时,丢弃所读取的任务。 When the second verification parameter is inconsistent with the first verification parameter, the read task is discarded.
A7、如A1或A2或A3所述的方法,所述任务的信息包括:任务数据帧,其中,所述任务数据帧为子包对应的封装帧,所述子包为依据数据包分解得到,所述任务数据帧包括:子包在数据包中的编号、子包数据和数据包结束标识。 A7, the method as described in A1 or A2 or A3, the information of the task includes: a task data frame, wherein the task data frame is an encapsulation frame corresponding to a subpackage, and the subpackage is obtained by decomposing a data packet, The task data frame includes: the number of the subpacket in the data packet, the subpacket data and the end mark of the data packet.
本发明还公开了B8、一种任务执行装置,包括: The present invention also discloses B8, a task performing device, comprising:
接收模块,用于接收来自多个应用模块的任务; a receiving module, configured to receive tasks from multiple application modules;
写入模块,用于将所述任务写入缓冲区;以及 a write module for writing the task into a buffer; and
执行模块,用于从所述缓冲区中读取所述任务,并利用单线程执行所述任务。 The execution module is used to read the task from the buffer and execute the task with a single thread.
B9、如B8所述的装置,所述写入模块,包括: B9, the device as described in B8, the writing module includes:
第一写入子模块。用于按照所述任务的接收顺序,将所述任务写入缓冲区;和/或 First write to the submodule. for writing the tasks into a buffer in the order in which they are received; and/or
第二写入子模块。用于按照所述任务的优先级,将所述任务写入缓冲区;和/或 The second writes to the submodule. for writing the task into a buffer according to the priority of the task; and/or
第三写入子模块。用于按照所述任务对应应用模块的优先级,将所述任务写入缓冲区;和/或 The third writes to the submodule. For writing the task into the buffer according to the priority of the application module corresponding to the task; and/or
第四写入子模块,用于按照所述任务的属性信息,将所述任务写入缓冲区。 The fourth writing submodule is used to write the task into the buffer according to the attribute information of the task.
B10、如B8所述的装置,所述执行模块,包括: B10, the device as described in B8, the execution module includes:
第一读取子模块,用于按照所述任务的写入顺序,从所述缓冲区中读取所述任务;和/或 The first reading submodule is used to read the tasks from the buffer according to the order in which the tasks are written; and/or
第二读取子模块,用于按照所述任务的优先级,从所述缓冲区中读取所述任务;和/或 The second reading submodule is used to read the task from the buffer according to the priority of the task; and/or
第三读取子模块,用于按照所述任务对应应用模块的优先级,从所述缓 冲区中读取所述任务;和/或 The third reading submodule is used 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.
B11、如B 8或B9或B10所述的装置,所述缓冲区包括:内存缓冲区和/或持久缓冲区。 B11, the device as described in B8 or B9 or B10, described buffer comprises: memory buffer and/or persistent buffer.
B12、如B8或B9或B10所述的装置,所述写入模块,具体用于将所述任务循环写入所述缓冲区。 B12. The device as described in B8 or B9 or B10, the writing module is specifically configured to write the task into the buffer cyclically.
B13、如B11所述的装置,所述缓冲区为持久缓冲区,所述持久缓冲区包括单位块; B13. The device as described in B11, the buffer is a persistent buffer, and the persistent buffer includes a unit block;
则所述装置还包括: The device then also includes:
第一生成模块,用于在按照所述任务的接收顺序,将所述任务写入所述持久缓冲区中单位块后,针对所述单位块中内容生成相应的第一校验参数; The first generation module is configured to generate a corresponding first verification parameter for the content in the unit block after writing the task into the unit block in the persistent buffer according to the order in which the tasks are received;
第二生成模块,用于在从所述单位块中读取所述任务后,针对所读取的任务生成相应的第二校验参数; 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 judging module, configured to judge 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.
B14、如B8或B9或B10所述的装置,所述任务的信息包括:任务数据帧,其中,所述任务数据帧为子包对应的封装帧,所述子包为依据数据包分解得到,所述任务数据帧包括:子包在数据包中的编号、子包数据和数据包结束标识 。 B14, the device as described in B8 or B9 or B10, the information of the task includes: a task data frame, wherein the task data frame is an encapsulation frame corresponding to a subpackage, and the subpackage is obtained by decomposing a data packet, The task data frame includes: the number of the subpacket in the data packet, the subpacket data and the end mark of the data packet.
Claims (10)
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 true CN104571958A (en) | 2015-04-29 |
CN104571958B 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) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
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 |
CN105824533A (en) * | 2016-03-21 | 2016-08-03 | 青岛海信移动通信技术股份有限公司 | Method and device for loading picture and terminal |
CN106169979A (en) * | 2015-05-19 | 2016-11-30 | 阿里巴巴集团控股有限公司 | A kind of method for processing business and equipment |
CN107491287A (en) * | 2017-08-30 | 2017-12-19 | 苏州乐麟无线信息科技有限公司 | The execution method and device of instruction |
CN108096837A (en) * | 2016-11-25 | 2018-06-01 | 盛趣信息技术(上海)有限公司 | Game robot dynamic identifying method |
CN108509327A (en) * | 2018-04-20 | 2018-09-07 | 深圳市文鼎创数据科技有限公司 | A kind of log-output method, device, terminal device and storage medium |
CN109189726A (en) * | 2018-08-08 | 2019-01-11 | 北京奇安信科技有限公司 | A kind of processing method and processing device for reading and writing log |
CN113835902A (en) * | 2021-09-22 | 2021-12-24 | 北京字节跳动网络技术有限公司 | Data processing method and device, computer equipment and storage medium |
Citations (4)
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 |
-
2014
- 2014-12-27 CN CN201410836028.9A patent/CN104571958B/en active Active
Patent Citations (4)
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 |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106169979A (en) * | 2015-05-19 | 2016-11-30 | 阿里巴巴集团控股有限公司 | A kind of method for processing business and equipment |
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 |
CN105824533A (en) * | 2016-03-21 | 2016-08-03 | 青岛海信移动通信技术股份有限公司 | Method and device for loading picture 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 |
CN107491287A (en) * | 2017-08-30 | 2017-12-19 | 苏州乐麟无线信息科技有限公司 | The execution method and device of instruction |
CN108509327A (en) * | 2018-04-20 | 2018-09-07 | 深圳市文鼎创数据科技有限公司 | A kind of log-output method, device, terminal device and storage medium |
CN109189726A (en) * | 2018-08-08 | 2019-01-11 | 北京奇安信科技有限公司 | A kind of processing method and processing device for reading and writing log |
CN109189726B (en) * | 2018-08-08 | 2020-12-22 | 奇安信科技集团股份有限公司 | A processing method and device for reading and writing logs |
CN113835902A (en) * | 2021-09-22 | 2021-12-24 | 北京字节跳动网络技术有限公司 | Data processing method and device, computer equipment and storage medium |
CN113835902B (en) * | 2021-09-22 | 2023-12-05 | 抖音视界有限公司 | Data processing method, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN104571958B (en) | 2019-06-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104571958A (en) | Task execution method and task execution device | |
CN104219316B (en) | A kind of call request processing method and processing device in distributed system | |
CN103559443B (en) | The virus scan method and apparatus of device for multi-core | |
US9298593B2 (en) | Testing a software interface for a streaming hardware device | |
US8996925B2 (en) | Managing error logs in a distributed network fabric | |
CN102982121B (en) | A kind of file scanning method, file scanning device and file detection system | |
CN102098227B (en) | Packet capture method and kernel module | |
US10733165B1 (en) | Distributed processing using a node hierarchy | |
CN104572262B (en) | A kind of task executing method and device | |
EP2840576A1 (en) | Hard disk and data processing method | |
JP2017512340A (en) | Modified memory compression | |
US9219800B2 (en) | Method and system for a web server transmitting a response to an access request | |
US10896001B1 (en) | Notifications in integrated circuits | |
US12050719B2 (en) | Preemption of a container in a secure computation environment | |
CN105262680A (en) | Multi-threaded NAS Gateway applied to cloud storage system | |
CN105095077B (en) | User interface automated testing method and device | |
US20180018469A1 (en) | Encrypting system level data structures | |
CN103678573A (en) | Method and system for achieving cache acceleration | |
WO2016202113A1 (en) | Queue management method, apparatus, and storage medium | |
US9575723B2 (en) | Software interface for a specialized hardware device | |
CN112825041A (en) | Memory isolation device, memory isolation method and related equipment | |
WO2019136840A1 (en) | Bullet screen posting time control method and system, and storage medium and electronic device | |
JP6034368B2 (en) | Authentication information processing | |
US9766940B2 (en) | Enabling dynamic job configuration in mapreduce | |
EP3396553B1 (en) | Method and device for processing data after restart of node |
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 |
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. |
|
TR01 | Transfer of patent right |