CN118245211A - Preemption method, preemption device, preemption equipment and preemption medium for task terminal - Google Patents

Preemption method, preemption device, preemption equipment and preemption medium for task terminal Download PDF

Info

Publication number
CN118245211A
CN118245211A CN202410277645.3A CN202410277645A CN118245211A CN 118245211 A CN118245211 A CN 118245211A CN 202410277645 A CN202410277645 A CN 202410277645A CN 118245211 A CN118245211 A CN 118245211A
Authority
CN
China
Prior art keywords
task
preemption
terminal
preempted
determining
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.)
Pending
Application number
CN202410277645.3A
Other languages
Chinese (zh)
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.)
Guangdong Baolun Electronics Co ltd
Original Assignee
Guangdong Baolun Electronics 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 Guangdong Baolun Electronics Co ltd filed Critical Guangdong Baolun Electronics Co ltd
Priority to CN202410277645.3A priority Critical patent/CN118245211A/en
Publication of CN118245211A publication Critical patent/CN118245211A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a preemption method, a preemption device, preemption equipment and preemption media of a task terminal. Wherein the method comprises the following steps: if a task preemption request is received, determining preemption tasks and target terminals required to preempt the preemption tasks according to the task preemption request; further determining a preemption result; determining an execution terminal corresponding to the preemption task according to preemption results of the terminals corresponding to the preemption task; determining an execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task; and determining absolute account book data in the memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and updating the absolute account book data in the database. According to the scheme, the absolute account book data for the control terminal are placed in the database, so that the task preemption process is realized, the data in the database can be used as a recovery basis when a memory has a problem, and the problem of data loss is avoided.

Description

Preemption method, preemption device, preemption equipment and preemption medium for task terminal
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for preempting a task terminal.
Background
When task preemption is carried out, the current technical scheme is that relevant data is placed in a memory after a preemption result is determined, and under the condition that a server is down and the like, the problems that the data is lost and cannot be recovered are caused.
Disclosure of Invention
The invention provides a preemption method, a preemption device, preemption equipment and a preemption medium of a task terminal, which can avoid the problem of preemption data loss after preemption of the task.
According to one aspect of the invention, there is provided a preemption method of a task terminal, the method comprising:
If a task preemption request is received, determining preemption tasks and target terminals to be preempted by the preemption tasks according to the task preemption request; the preemption task corresponds to at least one target terminal;
determining a preemption result according to the preemption task being executed on the target terminal and the priority of the preemption task;
determining an execution terminal corresponding to the preemption task according to preemption results of the terminals corresponding to the preemption task;
Determining an execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task;
Determining absolute account book data in a memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and updating the absolute account book data in a database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal.
According to another aspect of the present invention, there is provided a preemption device for a task terminal, including:
The preemption task determining module is used for determining preemption tasks according to the task preemption request and target terminals required to be preempted by the preemption tasks if the task preemption request is received; the preemption task corresponds to at least one target terminal;
the preemption result determining module is used for determining preemption results according to the priority of the preempted task and the preemption task which are being executed on the target terminal;
The first execution terminal determining module is used for determining the execution terminal corresponding to the preemption task according to the preemption result of each terminal corresponding to the preemption task;
the second execution terminal determining module is used for determining the execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task;
The absolute account book data updating module is used for determining absolute account book data in the memory according to the execution terminal corresponding to the preempted task and updating the absolute account book data in the database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the preemption method of a task terminal according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement the preemption method of a task terminal according to any of the embodiments of the present invention when executed.
The technical scheme of the embodiment of the application comprises the following steps: if a task preemption request is received, determining preemption tasks and target terminals to be preempted by the preemption tasks according to the task preemption request; the preemption task corresponds to at least one target terminal; determining a preemption result according to the preemption task being executed on the target terminal and the priority of the preemption task; determining an execution terminal corresponding to the preemption task according to preemption results of the terminals corresponding to the preemption task; determining an execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task; determining absolute account book data in a memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and updating the absolute account book data in a database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal. According to the technical scheme, absolute account book data are placed in the database, the terminal is controlled based on the absolute account book data through other services, the task preemption process on the terminal is achieved, the data in the database can be used as a recovery basis when a memory is in a problem, and the problem of data loss is avoided.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a preemption method of a task terminal according to a first embodiment of the present application;
fig. 2 is a flowchart of a preemption method of a task terminal according to a second embodiment of the present application;
Fig. 3 is a schematic structural diagram of a preemption device for a task terminal according to a third embodiment of the present application;
Fig. 4 is a schematic structural diagram of an electronic device for implementing a preemption method of a task terminal according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," "target," and the like in the description and claims of the present invention and in the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a task terminal preemption method provided in an embodiment of the present application, where the embodiment of the present application is applicable to a situation where an audio terminal is preempted after receiving a preemption task, where the method may be performed by a preemption device of the task terminal, where the preemption device of the task terminal may be implemented in hardware and/or software, and where the preemption device of the task terminal may be configured in an electronic device with data processing capabilities. As shown in fig. 1, the method includes:
S110, if a task preemption request is received, determining a preemption task and a target terminal which needs preemption of the preemption task according to the task preemption request; and the preemption task corresponds to at least one target terminal.
The task preemption request can be a request sent by other services or a notification; the task preemption request reflects that task preemption needs to be performed on the terminal, and the preemption task may be a task that preemption is performed on an existing task, and the preemption task may specifically be an audio preemption task, where the preemption task may include: preemption time, priority, preemption content, terminal information to be preempted, etc.
The target terminal may be any of the terminals that need to be preempted by the preemption task.
Specifically, after receiving the preemption task request through the corresponding interface, the request may include preemption task information, so that the preemption task may be read from the preemption task information, and a target terminal to be preempted by the preemption task.
Taking terminal 1 as an example, terminal 1 plays task a, when preemption task B is received, preemption task B needs to be played on terminal 1, and preemption task B has a higher priority than task a, where a subsequent preemption step can be performed. In the embodiment of the application, the task preemption process is performed in the electronic equipment, namely, after the preemption is successful, the absolute account book data comprising the preemption result is required to be placed in the database, and other services read the information in the database, so that the preemption process is performed on the terminal.
S120, determining a preemption result according to the preemption task and the priority of the preemption task which are being executed on the target terminal.
In the embodiment of the application, the memory is provided with the information of the task to be executed and the task being executed of each terminal, and the information of the executing terminal corresponding to each task, so that the information of a certain task and the information of a certain terminal can be directly used when being obtained later.
Specifically, after the target terminal is determined, checking the task which corresponds to the target terminal and is being executed, wherein the task is the preempted task, judging the preempted task and the priority of the preempted task, and further determining whether the preempting is successful or not, namely generating a preempting result.
Specifically, if the priority of the preempted task is higher than the priority of the preempted task, the target terminal should continue to execute the preempted task, and the preemption result in this case is a preemption failure. If the priority of the preempted task is lower than the priority of the preempted task, the preempted result can be determined as the preempted success.
Further, after the preemption result corresponding to the target terminal is obtained, traversing each terminal in the same way to obtain the preemption result of each terminal.
It should be noted that, if the target terminal is not in the audio mixing playing mode, that is, the target terminal can only execute one task (play one music) at the same time, the preemption result may be determined according to the priority of the preempted task and the preemption task being executed on the target terminal.
In the embodiment of the present application, optionally, in the case that the target terminal is a mixed audio playing, determining the preemption result according to the priority of the preempted task and the preempted task being executed on the target terminal includes: if the preempted task and the preempted task belong to the same audio channel, determining a preempted result according to the priority of the preempted task and the preempted task being executed on the target terminal; the method further comprises the steps of: if the preempted task and the preempted task do not belong to the same audio channel, determining that the preempted task and the preempted task occupy the corresponding audio channels in the target terminal respectively.
Note that, mixing refers to that one terminal performs a plurality of tasks simultaneously, for example, channel 1 performs a task, channel B performs a task, and so on (for example, one terminal plays a plurality of pieces of music simultaneously, respectively, foreground sound, background sound, and so on).
Specifically, for the situation of mixing, if the preempted task and the preempted task belong to the same audio channel, determining a preempted result according to the priority of the preempted task and the preempted task being executed on the target terminal. If the preempted task and the preempted task do not belong to the same audio channel, i.e. no task exists on the channel to be preempted by the preempted task, the preempted task and the preempted task can be determined to occupy the corresponding audio channels in the target terminal respectively.
S130, determining the execution terminal corresponding to the preemption task according to the preemption result of each terminal corresponding to the preemption task.
In the embodiment of the present application, optionally, determining an execution terminal corresponding to a preemption task according to preemption results of terminals corresponding to the preemption task, including: determining whether the preemption of the preemption task to the terminal is successful or not according to the preemption result; if the preemption task is successful in preempting the terminal, the terminal is determined to be an executing terminal corresponding to the preemption task.
For example, if the terminal corresponding to the preemption task is: terminal 2, terminal 3 and terminal 4; the preemption task needs to preempt the terminal, if the preemption results of the preemption task on the terminal 2 and the terminal 3 are successful, the executing terminal corresponding to the preemption task is determined as follows: terminal 2 and terminal 3. Namely: and determining the terminal which is successfully preempted as the executing terminal based on the preempted result.
S140, determining the execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task.
Specifically, since the preempted task may correspond to a plurality of terminals, a part of terminals corresponding to the preempted task may be preempted, and a part of terminals not preempted, that is, the preempted terminal information needs to be removed from the terminal information of the preempted task (the preempted terminal information is determined according to the preempted results of the terminals corresponding to the preempted task), so as to obtain the execution terminal corresponding to the preempted task.
In the embodiment of the present application, optionally, determining an execution terminal corresponding to a preempted task according to a preempted result of each terminal corresponding to the preempted task and terminal information of the preempted task, including: if the preemption task is determined to be successful to the first terminal according to the preemption result, and the terminal information of the preempted task comprises the first terminal, the first terminal is removed from the terminal information of the preempted task to obtain a residual terminal; and taking the remaining terminals as executing terminals corresponding to the preempted tasks.
Specifically, terminal information of the preempted task is obtained to obtain a terminal corresponding to the preempted task, if the preempted terminal exists in the terminal corresponding to the preempted task, the preempted terminal is removed from the terminal corresponding to the preempted task, and the rest terminal is determined to be an executing terminal corresponding to the preempted task.
For example, if the terminal corresponding to the preemption task B is: terminal 2, terminal 3 and terminal 4; the terminals corresponding to the preempted task a are terminal 1 and terminal 2. If the preemption task B preempts the terminal 2 successfully, the executing terminal corresponding to the preempted task A is the terminal 1.
S150, determining absolute account book data in a memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and updating the absolute account book data in the database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal.
The absolute account book data reflect the information such as the preemption result of each task, the latest execution terminal corresponding to each task is stored in the absolute account book data, and the absolute account book data in the database are used for controlling the actual terminal. For example, the absolute ledger data includes the task being executed and the execution terminal corresponding to the task being executed, and it should be noted that, the channel information, the execution time, and the like of the terminal corresponding to the task may be located in the absolute ledger data.
In the embodiment of the application, the absolute account book data in the database can be read by other services, and the other services can control the terminal according to the absolute account book data.
Specifically, after the execution terminal corresponding to the preemption task and the execution terminal corresponding to the preempted task are obtained, the execution terminal corresponding to the preemption task and the execution terminal corresponding to the preempted task are placed in the absolute account book data in the memory, and then the absolute account book data in the database is updated based on the absolute account book data in the memory, so that the absolute account book data in the database comprises the latest task and the terminal to be executed, and other services can control the terminal according to the absolute account book data.
The technical scheme of the embodiment of the application comprises the following steps: if a task preemption request is received, determining preemption tasks and target terminals to be preempted by the preemption tasks according to the task preemption request; the preemption task corresponds to at least one target terminal; determining a preemption result according to the preemption task being executed on the target terminal and the priority of the preemption task; determining an execution terminal corresponding to the preemption task according to preemption results of the terminals corresponding to the preemption task; determining an execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task; determining absolute account book data in a memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and updating the absolute account book data in a database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal. According to the technical scheme, absolute account book data are placed in the database, the terminal is controlled based on the absolute account book data through other services, the task preemption process on the terminal is achieved, the data in the database can be used as a recovery basis when a memory is in a problem, and the problem of data loss is avoided.
Example two
Fig. 2 is a flowchart of a preemption method of a task terminal according to a second embodiment of the present application, where the embodiment of the present application is optimized based on the foregoing embodiment.
As shown in fig. 2, the method in the embodiment of the present application specifically includes the following steps:
S210, if a task preemption request is received, determining a preemption task and a target terminal which needs preemption of the preemption task according to the task preemption request; and the preemption task corresponds to at least one target terminal.
When the preemption service obtains preemption task data through the interface, the preemption task data is decomposed, information such as a terminal set and priority corresponding to the preemption task is obtained respectively, and after each terminal corresponding to the preemption task is obtained, the data of each terminal is added into the terminal list data set and the task terminal data set, so that the follow-up use of the terminal data is facilitated.
S220, determining a preemption result according to the priority of the preempted task and the preemption task being executed on the target terminal.
Preemption for the target terminal may be to judge the priority of the preempted task and the preempted task being executed in different audio channels (background sound/foreground sound), if the priority of the preempted task is higher, the preemption is successful, otherwise the preemption fails.
S230, determining the execution terminal corresponding to the preemption task according to the preemption result of each terminal corresponding to the preemption task.
If the preemption is successful, the target terminal with the successful preemption is determined as the execution terminal corresponding to the preemption task. And storing the preemption tasks to an execution task set corresponding to the target terminal aiming at the target terminal with successful preemption, then clearing the tasks to be executed of the target terminal, carrying out priority sequencing on the tasks (except the preemption tasks) corresponding to the target terminal, and determining the tasks to be executed corresponding to the target terminal according to the sequencing result. The task to be executed corresponding to the target terminal can be used for the recovery process of other tasks after the subsequent execution task is finished.
S240, determining an executing terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task.
S250, determining absolute account book data in a memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and updating the absolute account book data in a database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal.
After the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task are obtained, the execution terminal is used as absolute account book data, and the absolute account book data is updated to the redis service. And updating the data in the relative account book into redis, wherein the relative account book data is the original data of the task, such as task information, terminal information corresponding to the task, and the like.
In one particular embodiment, the process of determining absolute ledger data and updating the absolute ledger data into the database may be: if task 1 exists, task 2 corresponds to terminal 1, task 2 corresponds to terminal 2 and terminal 3. When task 3 corresponds to a total of 3 terminals, terminal 1 and terminal 2, and terminal 4, task 3 is ready to preempt task 1 and task 2 at this time and has a higher priority than both tasks. In this time, the task 3 is successfully preempted, data is ready to be pushed to redis, the terminals 1 in the task 1 are deleted and updated one by one, no terminals are in the task 1, but the task is reserved, the terminals 2 in the task 2 are deleted and updated, and only one terminal of the terminals 3 is reserved; task 3 has terminals 1,2,4, respectively, where absolute ledger data is obtained, after which the absolute ledger data is updated into redis.
It should be noted that, in updating absolute account book data, relative account book data basically does not change, unless the data in the task is updated after the task is established, the information in the memory is synchronized to the redis server in real time at this time. The relative ledger data may be used for re-recovery after data loss.
S260, when the task end information is received, the end task and the end terminal corresponding to the end task are obtained from the relative ledger data.
In the embodiment of the application, if the task ending information sent by the center service is received, the ending task is determined, and then the ending task is obtained from the relative account data, in this case, if the server is normal all the time, the ending task can be directly obtained from the memory, if the server has a problem before, the ending task can be obtained from the relative account data in the database, after the ending task is obtained, the ending terminal corresponding to the ending task is obtained, that is, the ending task is not executed on the ending terminal any more is needed to be realized later.
S270, determining the task with the highest priority from the tasks to be executed corresponding to the ending terminal.
Specifically, the tasks to be executed corresponding to the end terminal are subjected to priority ranking, and then the task with the highest priority is determined, wherein the task with the highest priority is the next task to be executed after the end task on the end terminal is ended.
S280, updating the execution terminal corresponding to the task with the highest priority in the absolute account book data in the memory, and deleting the execution terminal corresponding to the ending task.
It should be noted that, if the memory has no absolute account book data (e.g., the server is down), the absolute account book data may be extracted from the database into the memory.
Specifically, after determining the task with the highest priority through S270, the task with the highest priority needs to be executed by the ending terminal, and then the ending terminal is determined as the executing terminal corresponding to the task with the highest priority.
In an embodiment of the present application, optionally, before updating the absolute account book data in the memory, the method further includes: acquiring first attribute information of the ending terminal from the terminal list set and acquiring second attribute information of the ending terminal from the relative account data; the terminal list set stores information corresponding to each terminal; and if the first attribute information and the second attribute information are matched, executing the step of updating the absolute account book data in the memory.
Wherein the first attribute information and the second attribute information each reflect attribute information of the terminal, for example, identification information of the terminal.
Specifically, the first attribute information of the terminal is obtained from the terminal list set, the second attribute information of the terminal is obtained from the relative account book data, then the two attribute information are matched, and the subsequent steps are carried out after the matching is successful, so that the problem of mistaken terminal caused by too much data in the memory can be avoided.
S290, updating the absolute account book data in the database based on the absolute account book data in the memory.
After the execution terminal corresponding to the task with the highest priority is obtained, the task with the highest priority is updated in absolute account book data in a memory, and the ending task is deleted in the absolute account book data, at this time, the latest execution terminal corresponding to each task is stored in the absolute account book data, and then the absolute account book data in a database is updated based on the absolute account book data in the memory, so that other services control the terminal according to the absolute account book data in the database.
In an embodiment of the present application, optionally, the method further includes: if the information corresponding to the preemption task is obtained, updating the relative account information in the memory according to the information corresponding to the preemption task; the relative account book information reflects terminal information corresponding to each task respectively; if the information corresponding to the ending task is obtained from the relative account book data, deleting the information corresponding to the ending task from the relative account book information in the memory; based on the relative account information in the memory, updating the relative account information in the database to re-read the data from the database after the data in the memory is lost.
In the embodiment of the application, when the preemptive task is obtained, or the modification request for the task is obtained, a certain task is modified, or the request for ending the task is obtained, namely, various changes for the task such as ending the task are not executed later, the relative account book data in the database can be synchronously updated, so that the latest task data are stored in the relative account book data, and the lost data can be read from the database under the condition that the data in the memory are lost.
According to the scheme, on a data processing structure, terminals are taken as the root, each terminal corresponds to a task, a plurality of tasks exist, storage ordering is performed according to data priority, when the tasks are sent, only the terminals in the tasks needing to be operated are operated, terminal operation under the tasks is greatly reduced, tasks which are still being executed in a memory are restored after the current tasks are finished, and the integrity of the data is guaranteed to form a closed loop. In the distributed architecture, the processed data is stored in redis, the uniqueness of the data in the data is ensured by adopting a key value pair mode, and the data can be shared with other services.
Example III
Fig. 3 is a schematic structural diagram of a preemption device for a task terminal according to a third embodiment of the present application, where the preemption device can execute the preemption method for a task terminal according to any embodiment of the present application, and the preemption device has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 3, the apparatus includes:
The preemption task determining module 310 is configured to determine a preemption task and a target terminal that needs preemption according to the task preemption request if a task preemption request is received; the preemption task corresponds to at least one target terminal;
the preemption result determining module 320 is configured to determine a preemption result according to the priority of the preempted task and the preempted task being executed on the target terminal;
The first execution terminal determining module 330 is configured to determine an execution terminal corresponding to the preemption task according to the preemption result of each terminal corresponding to the preemption task;
a second execution terminal determining module 340, configured to determine an execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task;
The absolute account book data updating module 350 is configured to determine absolute account book data in the memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and update the absolute account book data in the database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal.
The technical scheme of the embodiment of the application comprises the following steps: the preemption task determining module 310 is configured to determine a preemption task and a target terminal that needs preemption according to the task preemption request if a task preemption request is received; the preemption task corresponds to at least one target terminal; the preemption result determining module 320 is configured to determine a preemption result according to the priority of the preempted task and the preempted task being executed on the target terminal; the first execution terminal determining module 330 is configured to determine an execution terminal corresponding to the preemption task according to the preemption result of each terminal corresponding to the preemption task; a second execution terminal determining module 340, configured to determine an execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task; the absolute account book data updating module 350 is configured to determine absolute account book data in the memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and update the absolute account book data in the database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal. According to the technical scheme, absolute account book data are placed in the database, the terminal is controlled based on the absolute account book data through other services, the task preemption process on the terminal is achieved, the data in the database can be used as a recovery basis when a memory is in a problem, and the problem of data loss is avoided.
Optionally, in the case that the target terminal is a mixed audio playing, the preemption result determining module 320 includes:
The first preemption result determining unit is used for determining preemption results according to the priority of the preempted task and the preemption task being executed on the target terminal if the preempted task and the preemption task belong to the same audio channel;
the apparatus further comprises: and the second preemption result determining unit is used for determining that the preemption result is that the preempted task and the preempted task occupy the corresponding audio channels in the target terminal respectively if the preempted task and the preempted task do not belong to the same audio channel.
Optionally, the first execution terminal determining module 330 includes:
the preemption judging unit determines whether preemption of the preemption task to the terminal is successful or not according to the preemption result;
and the execution terminal determining unit is used for determining the terminal as the execution terminal corresponding to the preemption task if the preemption task succeeds in preempting the terminal.
Optionally, the second execution terminal determining module 340 includes:
The residual terminal determining unit is used for removing the first terminal from the terminal information of the preempted task to obtain a residual terminal if the preempted task is determined to be preempted for the first terminal successfully according to the preempted result and the terminal information of the preempted task comprises the first terminal;
and the execution terminal determining unit is used for taking the residual terminals as execution terminals corresponding to the preempted tasks.
Optionally, the apparatus further includes:
The ending task determining module is used for acquiring ending tasks and ending terminals corresponding to the ending tasks from the relative account book data if the task ending information is received;
the priority judging module is used for determining the task with the highest priority from the tasks to be executed corresponding to the ending terminal;
the execution terminal determining module is used for updating the execution terminal corresponding to the task with the highest priority in the absolute account book data in the memory, and deleting the execution terminal corresponding to the ending task;
and the database updating module is used for updating the absolute account book data in the database based on the absolute account book data in the memory.
Optionally, the apparatus further includes:
The attribute information acquisition module is used for acquiring first attribute information of the ending terminal from the terminal list set and acquiring second attribute information of the ending terminal from the relative account data; the terminal list set stores information corresponding to each terminal;
and the attribute information matching module is used for executing the step of updating the absolute account book data in the memory if the first attribute information and the second attribute information are matched.
Optionally, the apparatus further includes:
the first relative account information updating module is used for updating the relative account information in the memory according to the information corresponding to the preemption task if the information corresponding to the preemption task is obtained; the relative account book information reflects terminal information corresponding to each task respectively;
The second relative account book information updating module is used for deleting the information corresponding to the ending task from the relative account book information in the memory if the information corresponding to the ending task is acquired from the relative account book data;
And the relative account information updating module in the database is used for updating the relative account information in the database based on the relative account information in the memory so as to re-read the data from the database after the data in the memory is lost.
The preemption device of the task terminal provided by the embodiment of the application can execute the preemption method of the task terminal provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 4 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as preemption of task terminals.
In some embodiments, the preemption method of a task terminal can be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the preemption method of a task terminal described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the preemption method of the task terminal in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. The preemption method of the task terminal is characterized by comprising the following steps:
If a task preemption request is received, determining preemption tasks and target terminals to be preempted by the preemption tasks according to the task preemption request; the preemption task corresponds to at least one target terminal;
determining a preemption result according to the preemption task being executed on the target terminal and the priority of the preemption task;
determining an execution terminal corresponding to the preemption task according to preemption results of the terminals corresponding to the preemption task;
Determining an execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task;
Determining absolute account book data in a memory according to the execution terminal corresponding to the preempted task and the execution terminal corresponding to the preempted task, and updating the absolute account book data in a database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal.
2. The method according to claim 1, wherein, in the case that the target terminal is a mixed audio playing, the determining the preemption result according to the priority of the preempted task and the preempted task being executed on the target terminal includes:
If the preempted task and the preempted task belong to the same audio channel, determining a preempted result according to the priority of the preempted task and the preempted task being executed on the target terminal;
The method further comprises the steps of: if the preempted task and the preempted task do not belong to the same audio channel, determining that the preempted task and the preempted task occupy the corresponding audio channels in the target terminal respectively.
3. The method of claim 1, wherein determining the execution terminal corresponding to the preemption task according to the preemption result of each terminal corresponding to the preemption task comprises:
determining whether the preemption of the preemption task to the terminal is successful or not according to the preemption result;
if the preemption task is successful in preempting the terminal, the terminal is determined to be an executing terminal corresponding to the preemption task.
4. The method according to claim 1, wherein determining the execution terminal corresponding to the preempted task based on the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task includes:
If the preemption task is determined to be successful to the first terminal according to the preemption result, and the terminal information of the preempted task comprises the first terminal, the first terminal is removed from the terminal information of the preempted task to obtain a residual terminal;
and taking the remaining terminals as executing terminals corresponding to the preempted tasks.
5. The method according to claim 1, wherein the method further comprises:
If the task ending information is received, acquiring an ending task and an ending terminal corresponding to the ending task from the relative account book data;
Determining a task with the highest priority from the tasks to be executed corresponding to the ending terminal;
Updating an execution terminal corresponding to a task with the highest priority in absolute account book data in a memory, and deleting the execution terminal corresponding to the ending task;
And updating the absolute account book data in the database based on the absolute account book data in the memory.
6. The method of claim 5, wherein prior to updating the absolute ledger data in memory, the method further comprises:
Acquiring first attribute information of the ending terminal from the terminal list set and acquiring second attribute information of the ending terminal from the relative account data; the terminal list set stores information corresponding to each terminal;
And if the first attribute information and the second attribute information are matched, executing the step of updating the absolute account book data in the memory.
7. The method according to claim 1 or 5, characterized in that the method further comprises:
If the information corresponding to the preemption task is obtained, updating the relative account information in the memory according to the information corresponding to the preemption task; the relative account book information reflects terminal information corresponding to each task respectively;
if the information corresponding to the ending task is obtained from the relative account book data, deleting the information corresponding to the ending task from the relative account book information in the memory;
Based on the relative account information in the memory, updating the relative account information in the database to re-read the data from the database after the data in the memory is lost.
8. The preemption device of the task terminal is characterized by comprising the following components:
The preemption task determining module is used for determining preemption tasks according to the task preemption request and target terminals required to be preempted by the preemption tasks if the task preemption request is received; the preemption task corresponds to at least one target terminal;
the preemption result determining module is used for determining preemption results according to the priority of the preempted task and the preemption task which are being executed on the target terminal;
The first execution terminal determining module is used for determining the execution terminal corresponding to the preemption task according to the preemption result of each terminal corresponding to the preemption task;
the second execution terminal determining module is used for determining the execution terminal corresponding to the preempted task according to the preempted result of each terminal corresponding to the preempted task and the terminal information of the preempted task;
The absolute account book data updating module is used for determining absolute account book data in the memory according to the execution terminal corresponding to the preempted task and updating the absolute account book data in the database based on the absolute account book data in the memory; and the absolute account book data in the database are used for controlling the actual terminal.
9. An electronic device, the electronic device comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the preemption method of a task terminal of any of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the preemption method of a task terminal of any of claims 1-7.
CN202410277645.3A 2024-03-12 2024-03-12 Preemption method, preemption device, preemption equipment and preemption medium for task terminal Pending CN118245211A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410277645.3A CN118245211A (en) 2024-03-12 2024-03-12 Preemption method, preemption device, preemption equipment and preemption medium for task terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410277645.3A CN118245211A (en) 2024-03-12 2024-03-12 Preemption method, preemption device, preemption equipment and preemption medium for task terminal

Publications (1)

Publication Number Publication Date
CN118245211A true CN118245211A (en) 2024-06-25

Family

ID=91555803

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410277645.3A Pending CN118245211A (en) 2024-03-12 2024-03-12 Preemption method, preemption device, preemption equipment and preemption medium for task terminal

Country Status (1)

Country Link
CN (1) CN118245211A (en)

Similar Documents

Publication Publication Date Title
KR20210156243A (en) Training methods of deep-running frameworks, devices and storage media
CN115373861B (en) GPU resource scheduling method and device, electronic equipment and storage medium
CN115358411A (en) Data processing method, device, equipment and medium
CN114416012A (en) Audio continuous playing method and device
CN116301997A (en) Upgrading method, device, equipment and medium of controller
CN118245211A (en) Preemption method, preemption device, preemption equipment and preemption medium for task terminal
CN113747423B (en) Cloud mobile phone state synchronization method, device, equipment, storage medium and program product
CN115511085A (en) Model data processing method, device, equipment and storage medium
CN114071192A (en) Information acquisition method, terminal, server, electronic device, and storage medium
CN117113942B (en) Model synchronization method and device, electronic equipment and storage medium
CN116881229A (en) Database exercise environment construction method, device, equipment and storage medium
CN115331089A (en) Method, apparatus, device, medium and product for recognizing image text
CN117608742A (en) Target data processing method and device, electronic equipment and medium
CN116471199A (en) QoS configuration method, device and equipment of virtual network card and storage medium
CN115801763A (en) File transmission method and device, electronic equipment and storage medium
CN117032712A (en) Pipeline compiling and constructing method and device, electronic equipment and storage medium
CN118227709A (en) Breakpoint processing method, device, equipment and medium in database synchronization
CN118152095A (en) Device switching method, device, equipment and medium for database service
CN115481090A (en) File processing method and device, electronic equipment and storage medium
CN116755744A (en) Patch package generation method and device, electronic equipment and storage medium
CN118397132A (en) Curve drawing method and device, electronic equipment and storage medium
CN118632080A (en) Media data management method, device, equipment and storage medium
CN118051670A (en) Service recommendation method, device, equipment and medium
CN116244321A (en) Data updating method, device, equipment and medium
CN116662061A (en) Data storage method, device, equipment and medium of capacity-expansion erasure code storage system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination