CN109947548A - The method and apparatus that the method and apparatus and control task for distributing timeslice execute - Google Patents

The method and apparatus that the method and apparatus and control task for distributing timeslice execute Download PDF

Info

Publication number
CN109947548A
CN109947548A CN201910199386.6A CN201910199386A CN109947548A CN 109947548 A CN109947548 A CN 109947548A CN 201910199386 A CN201910199386 A CN 201910199386A CN 109947548 A CN109947548 A CN 109947548A
Authority
CN
China
Prior art keywords
task
state
busy
timeslice
assigned
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910199386.6A
Other languages
Chinese (zh)
Other versions
CN109947548B (en
Inventor
伍鹏达
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Meizhi Photoelectric Technology Co Ltd
Original Assignee
Meizhi Photoelectric Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Meizhi Photoelectric Technology Co Ltd filed Critical Meizhi Photoelectric Technology Co Ltd
Priority to CN201910199386.6A priority Critical patent/CN109947548B/en
Publication of CN109947548A publication Critical patent/CN109947548A/en
Application granted granted Critical
Publication of CN109947548B publication Critical patent/CN109947548B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Alarm Systems (AREA)

Abstract

The embodiment of the present invention provide it is a kind of distribute timeslice method and apparatus and control task execute method and apparatus, belong to smart home system field.This method comprises: being spaced the state for each task at least one task that determines at predetermined time intervals;And according to definitive result, execute following operation: respectively distributing default free time piece for the task that the state at least one described task is idle state;And it is respectively distributed for the task that the state at least one described task is busy state and presets busy timeslice, wherein, the predetermined time interval be less than task that the state is busy state respectively it is assigned it is described preset busy timeslice, the default free time piece that each task at least one described task is assigned when state is idle state is less than be assigned when state is busy state described and presets busy timeslice.It is thereby achieved that the execution efficiency of the task of raising, brings better experience for user.

Description

The method and apparatus that the method and apparatus and control task for distributing timeslice execute
Technical field
The present invention relates to smart home system fields, more particularly to a kind of method and apparatus and control for distributing timeslice The method and apparatus of task execution.
Background technique
With the continuous development of smart home industry, the intelligence system applied to the field product is more and more, such as KNX Building system, zigbee bluetooth standard agreement stack system, or fixed privately owned system, specific some company oneself System, or seem open source system as linux, freertos etc..Many intellectual products are required in face of more scenes at present User demand, then inevitably just needing to solve the problems, such as multi-task scheduling.Multi-task scheduling usually requires to consider every The problem of a task distribution timeslice, it is also contemplated that how the user experience of whole system, do a tradeoff between the two It is critically important.
Company is fixed, such mechanism about the distribution of task time piece using the intelligence system of Mr. Yu's product at present The system resource that processor can be wasted to a certain extent, influences the execution efficiency of system task, can not bring to user more preferably Experience.
Summary of the invention
A kind of method and dress executed the object of the present invention is to provide method and apparatus for distributing timeslice and control task It sets, can realize the execution efficiency of raising task, bring better experience for user.
To achieve the goals above, one aspect of the present invention provides a kind of method for distributing timeslice for task, This method comprises: being spaced the state for each task at least one task that determines at predetermined time intervals;And it is tied according to determining Fruit executes following operation: when respectively distributing the default free time for the task that the state at least one described task is idle state Between piece;And it is respectively distributed for the task that the state at least one described task is busy state and presets the busy time Piece, wherein the predetermined time interval be less than task that the state is busy state respectively it is assigned it is described preset it is non- Free time piece, each task at least one described task default free time assigned when state is idle state Timeslice be less than be assigned when state is busy state described preset busy timeslice.
Optionally, at least one described task includes screen control task, voice broadcast task and safety management task;? In the case where needing Modify password, the interval at predetermined time intervals determines the shape of each task at least one described task The definitive result of state includes: first, and the state of the screen control task and the voice broadcast task is busy state, institute The state for stating safety management task is idle state;Second, the state of the screen control task and the voice broadcast task For idle state, the state of the safety management task is busy state;And third, it is the screen control task, described The state of voice broadcast task and the safety management task is idle state.
Optionally, at least one described task includes screen control task, voice broadcast task, safety management task, electricity Machine control task and information reporting task;In the case where needing through password unlocking, the interval at predetermined time intervals is determined The definitive result of the state of each task at least one described task includes: first, the screen control task and described The state of voice broadcast task is busy state, in the safety management task, the motor control task and the message The state of report task is idle state;Second, the state of the safety management task is busy state, and the screen control is appointed The state of business, the voice broadcast task, the motor control task and the information reporting task is idle state;Third, The state of the motor control task is busy state, the screen control task, the voice broadcast task, the safety The state of management role and the information reporting task is idle state;4th, in the voice broadcast task and the message The state of report task is busy state, the screen control task, the safety management task and the motor control task State be idle state;And the 5th, the screen control task, the voice broadcast task, the safety management task, The state of the motor control task and the information reporting task is idle state.
Optionally, before the state for being spaced determine each task at least one task at predetermined time intervals, This method further include: distribute corresponding busy timeslice of initial preset at least one described task, wherein described to be State at least one described task be the task of busy state respectively distribute preset busy timeslice be for it is described extremely State in a few task is that the task of busy state distributes corresponding busy timeslice of initial preset.
Optionally, this method further include: judge at least one described task with the presence or absence of the executing exception of the task;And In the case where there is the task of execution exception at least one described task, control executes the executing exception of the task and corresponds to Abnormality processing operation so that described, to execute abnormal task recovery normal.
Correspondingly, another aspect of the present invention provides a kind of for distributing the device of timeslice for task, which includes: State determining module, for being spaced the state for determining each task at least one task at predetermined time intervals;And the time Piece distribution module, for executing following operation: being idle state for the state at least one described task according to definitive result Task respectively distribute default free time piece;It and is the task of busy state for the state at least one described task Respectively busy timeslice is preset in distribution, wherein the predetermined time interval is less than the task that the state is busy state Respectively it is assigned it is described preset busy timeslice, each task at least one described task is idle state in state When assigned default free time piece when being less than be assigned when state is busy state described and presetting busy Between piece.
Optionally, at least one described task includes screen control task, voice broadcast task and safety management task;? In the case where needing Modify password, the interval at predetermined time intervals determines the shape of each task at least one described task The definitive result of state includes: first, and the state of the screen control task and the voice broadcast task is busy state, institute The state for stating safety management task is idle state;Second, the state of the screen control task and the voice broadcast task For idle state, the state of the safety management task is busy state;And third, it is the screen control task, described The state of voice broadcast task and the safety management task is idle state.
Optionally, at least one described task includes screen control task, voice broadcast task, safety management task, electricity Machine control task and information reporting task;In the case where needing through password unlocking, the interval at predetermined time intervals is determined The definitive result of the state of each task at least one described task includes: first, the screen control task and described The state of voice broadcast task is busy state, in the safety management task, the motor control task and the message The state of report task is idle state;Second, the state of the safety management task is busy state, and the screen control is appointed The state of business, the voice broadcast task, the motor control task and the information reporting task is idle state;Third, The state of the motor control task is busy state, the screen control task, the voice broadcast task, the safety The state of management role and the information reporting task is idle state;4th, in the voice broadcast task and the message The state of report task is busy state, the screen control task, the safety management task and the motor control task State be idle state;And the 5th, the screen control task, the voice broadcast task, the safety management task, The state of the motor control task and the information reporting task is idle state.
Optionally, the device further include: initial setting module, for determining at least one at the interval at predetermined time intervals Before the state of each task in a task, when busy for the corresponding initial preset of at least one task distribution Between piece, wherein the state at least one described task be the task of busy state respectively distribute preset it is busy Timeslice be for the distribution of task that the state at least one described task is busy state it is corresponding described initial pre- If busy timeslice.
Optionally, the device further include: judgment module, it is different with the presence or absence of executing at least one described task for judging Normal task;And control module, in the case where executing abnormal task for existing at least one described task, control It executes the corresponding abnormality processing of abnormal task that executes to operate, so that the task recovery for executing exception is normal.
In addition, another aspect of the present invention also provides a kind of smart home system, which includes above-mentioned Device.
In addition, another aspect of the present invention also provides a kind of machine readable storage medium, on the machine readable storage medium It is stored with instruction, which is used for so that machine executes above-mentioned method.
Through the above technical solutions, being that task distributes timeslice according to the state of task, divided when task is idle state The timeslice matched is less than timeslice assigned when task is non-idle state, no matter in this way, what shape be in compared to task State is all assigned to timeslice of the task in busy state, reduces the occupancy to system resource, reduces to processor System resource waste, improve the execution efficiency of task, bring better experience for user.
Other features and advantages of the present invention will the following detailed description will be given in the detailed implementation section.
Detailed description of the invention
Attached drawing is to further understand for providing to the embodiment of the present invention, and constitute part of specification, under The specific embodiment in face is used to explain the present invention embodiment together, but does not constitute the limitation to the embodiment of the present invention.Attached In figure:
Fig. 1 is the flow chart for the method for distributing timeslice for task that one embodiment of the invention provides;
Fig. 2 is that another embodiment of the present invention provides the logical schematics for being task distribution timeslice;
Fig. 3 is that another embodiment of the present invention provides the logical schematics for being task distribution timeslice;
Fig. 4 is that another embodiment of the present invention provides the logical schematics for being task distribution timeslice;
Fig. 5 is that another embodiment of the present invention provides to the schematic diagram for being the task distribution busy timeslice of initial preset;
Fig. 6 be another embodiment of the present invention provides execution abnormality processing operation logical schematic;And
Fig. 7 be another embodiment of the present invention provides for for task distribute timeslice device structural block diagram.
Description of symbols
1 state determining module, 2 timeslice distribution module
Specific embodiment
It is described in detail below in conjunction with specific embodiment of the attached drawing to the embodiment of the present invention.It should be understood that this Locate described specific embodiment and be merely to illustrate and explain the present invention embodiment, is not intended to restrict the invention embodiment.
The one aspect of the embodiment of the present invention provides a kind of method for distributing timeslice for task.Fig. 1 is the present invention The flow chart for the method for distributing timeslice for task that one embodiment provides.As shown in Figure 1, this method includes in following Hold.
In step slo, it is spaced the state for each task at least one task that determines at predetermined time intervals.Wherein, The state of task may include idle state and busy state.Optionally, in embodiments of the present invention, predetermined time interval can To be 1ms.
In step s 11, timeslice is distributed according to determining.It specifically, may include the following contents.In at least one task In, it is that the task that state is idle state respectively distributes default free time piece.It wherein, is appointing for idle state for each state The default free time piece of business distribution can be identical, be also possible to difference.In addition, default free time piece is smaller, when appointing The system resource that processor is occupied when business is idle is fewer, smaller to the waste of processor system resources, can more improve holding for task Line efficiency.It is alternatively possible to be each task when state is idle state, it is assigned the timeslice of 1ms.At at least one It is that task that state is busy state respectively distributes and presets busy timeslice, wherein predetermined time interval is less than in task State presets busy timeslice for what the task of busy state was respectively assigned, and each task at least one task exists The default free time piece being assigned when state is idle state is non-less than presetting for being assigned when state is busy state Free time piece.State be busy state task respectively it is assigned preset busy timeslice can be it is identical, It can be different.Specifically, the busy timeslice of presetting that each task is assigned when state is busy state can be with Based on execute task hardware, task the case where and communication timing and determine.In addition, redefining every at least one task The time interval (above-mentioned predetermined time interval) of the state of one task is less than each task at least one task in state Busy timeslice is preset for what is be assigned when busy state.Each task time assigned when state is idle state Piece is less than timeslice assigned when state is busy state.In addition, each task is assigned when state is idle state Timeslice and other tasks timeslice assigned when state is busy state relationship be not it is determining, can basis Depending on concrete condition.
It is that task distributes timeslice according to the state of task, the timeslice being assigned when task is idle state is less than task The timeslice being assigned when being non-idle state, no matter existing in this way, what state be in compared to task and is all assigned to task Timeslice when busy state reduces the occupancy to system resource, reduces the waste to the system resource of processor, mentions The high execution efficiency of task, especially improves execution efficiency in multitask, brings better experience for user.
For example, being illustrated in conjunction with Fig. 2 to distribution timeslice by taking intelligent door lock as an example.It is assumed that intelligent door lock at most needs Execution screen control task, voice broadcast task, safety management task, motor control task and information reporting task, totally five Task.Method described in the embodiment of the present invention for distributing timeslice for task corresponds to timer interrupt routine, for example, timing Between be divided into 1ms, method described in the embodiment of the present invention corresponds to 1ms timer interrupt routine, and setting timer carrys out detection time.Such as Shown in Fig. 2, timer can all enter an interrupt routine every 1ms, which is used to inquire the state of each task, Jin Ergen State according to each task is that task distributes timeslice.When task does not need to execute (namely idle state), appoint to be each The timeslice of business distribution 1ms, to reduce the loss of system resource.When task needs to be implemented (namely busy state), it is Screen control task, voice broadcast task, safety management task, motor control task and information reporting task distribute respectively 2ms, 3ms, 5ms, 2ms, 3ms timeslice.Wherein for each task distribution timeslice and execute task hardware, task the case where and Communication timing and determine, can be identical, be also possible to different, be only for example herein, specially busy state assignment How long piece can according to the actual situation depending on.
Fig. 3 is that another embodiment of the present invention provides the logical schematics for being task distribution timeslice.In this embodiment, It is assumed that intelligent door lock at most need to be implemented screen control task, voice broadcast task, safety management task, motor control task and Information reporting task, totally five tasks, for for intelligent door lock Modify password, distribution timeslice explanation as shown in connection with fig. 2 How to be task during Modify password distributes timeslice.Wherein, predetermined time interval 1ms, that is, each 1ms sentence The state of a disconnected subtask.In addition, in this embodiment, " needing to be implemented " corresponds to idle shape described in the embodiment of the present invention State, " not needing to execute " correspond to busy state.It is assumed that current intelligent door lock is in idle condition, (each task is only distributed The timeslice of 1ms, it is only 5ms that the control system of intelligent door lock, which executes the time of systemic circulation).At this moment if user wants modification Password, firstly, 1ms timer interrupt program judges that screen control task and voice broadcast task need to be implemented, other tasks are equal It does not need to execute.It will be respectively modified as 2ms, 3ms for the timeslice of screen control task and the distribution of voice broadcast task, other The timeslice of business is constant, and (control system of intelligent door lock executes the time of systemic circulation as 8ms).User passes through according to voice prompting Screen terminal changes unlock code.Then, 1ms timer judges that screen control task and voice broadcast task do not need to execute, And safety management task needs to be implemented, other tasks do not need to execute, by screen control task, voice broadcast task and safety The timeslice of management role is respectively modified as 1ms, 1ms, 5ms, the constant (control system of intelligent door lock of the timeslice of other tasks The time for executing systemic circulation is 9ms).Save the unlocking cipher of user's modification.1ms timer judges that safety management task does not need It executes, other tasks do not need to execute, and the timeslice of safety management task are revised as 1ms, the timeslice of other tasks is not (control system of intelligent door lock executes the time of systemic circulation as 5ms), and free system resources, each task returns to original sky for change Not busy state.
Fig. 4 is that another embodiment of the present invention provides the logical schematics for being task distribution timeslice.In this embodiment, It is assumed that intelligent door lock at most need to be implemented screen control task, voice broadcast task, safety management task, motor control task and Information reporting task, totally five tasks, for for intelligent door lock Modify password, distribution timeslice explanation as shown in connection with fig. 2 How to be task during unlocking distributes timeslice.Wherein, predetermined time interval 1ms, that is, each 1ms judge one The state of subtask.In addition, in this embodiment, " needing to be implemented " corresponds to idle state described in the embodiment of the present invention, " not needing to execute " corresponds to busy state.It is assumed that current intelligent door lock is in idle condition, (each task is only assigned with The time of the timeslice of 1ms, the control system execution systemic circulation of intelligent door lock is only 5ms).User is opened by way of password Lock.1ms timer judges that screen control task and voice broadcast task need to be implemented, other tasks do not need to execute, screen The timeslice of control task and voice broadcast task is modified to 2ms, 3ms respectively, the constant (intelligent door of the timeslice of other tasks The time that the control system of lock executes systemic circulation is only 8ms).User is unlocked close according to voice prompting by screen terminal input Code.1ms timer interrupt routine judges that screen control task and voice broadcast task do not need to execute, and safety management task needs are held Row, other tasks do not need to execute, the timeslice of screen control task, voice broadcast task and safety management task respectively by It is revised as 1ms, 1ms, 5ms, the timeslice of other tasks is constant, and (time that the control system of intelligent door lock executes systemic circulation is only 9ms).Whether the password that safety management task verifies user's input is correct (assuming that correct).1ms timer interrupt routine judgement safety Management role does not need to execute, and motor control task needs to be implemented, other tasks do not need to execute, safety management task and electricity The timeslice of machine control task is modified to 1ms, 2ms respectively, the constant (control system of intelligent door lock of the timeslice of other tasks The time for executing systemic circulation is only 6ms).Motor running, door-lock opening.1ms timer interrupt routine judges motor control task not It needs to be implemented, and voice broadcast task and information reporting task need to be implemented, other tasks do not need to execute, and motor control is appointed The timeslice of business, voice broadcast task and information reporting task is modified to 1ms, 3ms, 3ms respectively, the timeslice of other tasks Constant (time of the control system execution systemic circulation of intelligent door lock is only 9ms).Voice broadcast " unlocks successfully ", and correlation is disappeared Breath is reported to cloud server.1ms timer interrupt routine judges that voice broadcast task and information reporting task do not need to execute, His task is also not need to execute, and the timeslice of voice broadcast task and information reporting task is respectively modified as 1ms, 1ms, The timeslice of other tasks is constant (time of the control system execution systemic circulation of intelligent door lock is only 5ms), free system resources, Each task returns to original idle state.
Optionally, in embodiments of the present invention, it can also be determined at least one task being spaced at predetermined time intervals It can also first be that distribute corresponding state be non-empty for each task at least one task before the state of each task The busy timeslice of initial preset when not busy state.Wherein, described in above-described embodiment, at least one task, work as shape State be busy state when, be task distribution preset busy timeslice can be first be the task distribute initial preset it is non- Free time piece.
As shown in figure 5, by taking intelligent door lock as an example, it is assumed that intelligent door lock at most needs to be implemented screen control task, voice is broadcast Report task, safety management task, motor control task and information reporting task, totally five tasks.The control system of intelligent door lock When powering on, can initial screen control task, voice broadcast task, safety management task, motor control task, in message The relevant parameter of this five tasks of report task, and assign corresponding timeslice and (correspond to mission screen control task, voice Casting task, safety management task, motor control task, information reporting task be respectively timeslice 2ms, 3ms, 5ms, 2ms, 3ms.After initializing timeslice of each task when state is busy state, it is spaced the shape of the task of determination at predetermined time intervals State is that task distributes timeslice according to the state of task.For example, can be initialized each when the control system of intelligent door lock powers on May needing to be implemented for task, and one scheduled timeslice of each task is distributed to, then one 1 millisecond of timing is set The state of each task is inquired in device, every 1 millisecond of timing, when finding that some task needs to be implemented, when that is scheduled before Between piece execute the task, after free system resources.When finding that the task does not need to execute, when modifying scheduled at the beginning Between piece be 1ms, thus the influence to the next task needed to be implemented below is preferably minimized, thus lifting system execute multitask Efficiency.
In addition, in embodiments of the present invention, can also judge at least one task with the presence or absence of the executing exception of the task; When existing, when executing abnormal task, control executes the corresponding abnormality processing operation of task of execution exception, so that executing Abnormal task recovery is normal.Specifically, after having executed some task every time, the knot an of success or failure can all be returned Fruit can check returning the result for these tasks, and want to carry out abnormality processing according to the judgement of these results.If certain task What is returned is failure as a result, the corresponding abnormality processing function of the task can then be called to carry out relevant operation.Wherein, work as task When needing abnormality processing, the state of task corresponds to busy state.In this way, the implementing result returned by task, to judge Want to carry out abnormality processing, also can be carried out recovery processing after the error of guarantee task.
Fig. 6 be another embodiment of the present invention provides execution abnormality processing operation logical schematic.Wherein, in the implementation In example, by taking intelligent door lock as an example, it is assumed that intelligent door lock at most needs to be implemented screen control task, voice broadcast task, bursting tube Reason task, motor control task and information reporting task, totally five tasks.Distribution timeslice as shown in connection with fig. 2, with motor control For system failure, illustrate how to execute abnormality processing operation.Wherein, predetermined time interval 1ms, that is, judge every 1ms The state of one subtask.In addition, in this embodiment it is possible to screen control task, voice broadcast task, safety management is first arranged Task, motor control task and information reporting the task timeslice assigned when state is busy state be 2ms, 3ms, 5ms,2ms,3ms.In addition, corresponding to busy state when task execution exception.
User carries out unlocking operation, the control system actuating motor control task of intelligent door lock.1ms timer interrupt routine is looked into Ask motor control result (it is assumed that returning abnormality).At this point, 1ms timer interrupt routine thinks motor control task execution It is abnormal, the assigned timeslice of motor control task or 2ms.The control system of intelligent door lock calls motor control task corresponding Abnormality processing function handled, for example, carrying out the overcurrent-overvoltage detection of motor, again attempting to operated motor etc..Meanwhile 1ms timer interrupt routine judges that voice broadcast task and information reporting task need to be implemented, and the state of other tasks is constant.Voice The timeslice of casting task and message working task is modified to 3ms, 3ms.Control system carries out motor control relevant different Often detection, such as overcurrent-overvoltage detect, and trial controls motor again, and voice prompting and the unlocking for broadcasting failure of unlocking are different Normal information reporting is to cloud server.Then, 1ms timer interrupt routine judge motor control task, voice broadcast task and Information reporting task does not need to execute.The timeslice of motor control task, voice broadcast task and information reporting task is modified For 1ms, free system resources.
Correspondingly, the another aspect of the embodiment of the present invention provides a kind of for distributing the device of timeslice for task.Fig. 7 is Another embodiment of the present invention provides for for task distribute timeslice device structural block diagram.As shown in fig. 7, the device packet Include state determining module 1 and timeslice distribution module 2.State determining module 1 determines at least one for interval at predetermined time intervals The state of each task in a task;Timeslice distribution module 2 is used to execute following operation according to definitive result: be at least State in one task is that the task of idle state respectively distributes default free time piece;And at least one task State respectively distributes for the task of busy state and presets busy timeslice, wherein it is non-that predetermined time interval, which is less than state, What the task of idle state was respectively assigned presets busy timeslice, and each task at least one task is sky in state The default free time piece being assigned when not busy state, which is less than, presets the busy time in state for what is be assigned when busy state Piece.
It is that task distributes timeslice according to the state of task, the timeslice being assigned when task is idle state is less than task The timeslice being assigned when being non-idle state, no matter existing in this way, what state be in compared to task and is all assigned to task Timeslice when busy state reduces the occupancy to system resource, reduces the waste to the system resource of processor, mentions The high execution efficiency of task, brings better experience for user.
Optionally, in embodiments of the present invention, at least one task includes screen control task, voice broadcast task and peace Full management role;In the case where needing Modify password, it is spaced each determined at least one task at predetermined time intervals The definitive result of the state of business includes: first, and the state of screen control task and voice broadcast task is busy state, safety The state of management role is idle state;Second, the state of screen control task and voice broadcast task is idle state, safety The state of management role is busy state;And third, screen control task, voice broadcast task and safety management task State is idle state.
Optionally, in embodiments of the present invention, at least one task includes screen control task, voice broadcast task, peace Full management role, motor control task and information reporting task;In the case where needing through password unlocking, at predetermined time intervals It is spaced and determines that the definitive result of the state of each task at least one task includes: first, screen control task and voice The state of casting task is busy state, and the state of safety management task, motor control task and information reporting task is sky Not busy state;Second, the state of safety management task is busy state, screen control task, voice broadcast task, motor control The state of task and information reporting task is idle state;Third, the state of motor control task are busy state, screen control Task processed, voice broadcast task, the state of safety management task and information reporting task are idle state;4th, voice broadcast The state of task and information reporting task is busy state, screen control task, safety management task and motor control task State be idle state;And the 5th, screen control task, voice broadcast task, safety management task, motor control task State with information reporting task is idle state.
Optionally, in embodiments of the present invention, the device further include: initial setting module, at predetermined time intervals It is spaced before the state for determining each task at least one task, it is corresponding initial pre- for the distribution of at least one task If busy timeslice, wherein be that the task that state at least one task is busy state respectively distributes default non-empty Not busy timeslice is to distribute corresponding initial preset non-empty for the task that the state at least one task is busy state Not busy timeslice.
Optionally, in embodiments of the present invention, the device further include: judgment module, for judging at least one task With the presence or absence of the executing exception of the task;Control module, for there is the case where executing abnormal task at least one task Under, control executes the corresponding abnormality processing operation of abnormal task, so that it is normal to execute abnormal task recovery.
It is provided in an embodiment of the present invention to be used for as the concrete operating principle and benefit of the device of task distribution timeslice and this The concrete operating principle and benefit for the method for distributing timeslice for task that inventive embodiments provide are similar, here will no longer It repeats.
In addition, the another aspect of the embodiment of the present invention also provides a kind of smart home system, which includes Device described in above-described embodiment.
In addition, the another aspect of the embodiment of the present invention also provides a kind of machine readable storage medium, the machine readable storage Instruction is stored on medium, which is used for so that machine executes method described in above-described embodiment.
The optional embodiment of the embodiment of the present invention is described in detail in conjunction with attached drawing above, still, the embodiment of the present invention is simultaneously The detail being not limited in above embodiment can be to of the invention real in the range of the technology design of the embodiment of the present invention The technical solution for applying example carries out a variety of simple variants, these simple variants belong to the protection scope of the embodiment of the present invention.
It is further to note that specific technical features described in the above specific embodiments, in not lance In the case where shield, it can be combined in any appropriate way.In order to avoid unnecessary repetition, the embodiment of the present invention pair No further explanation will be given for various combinations of possible ways.
It will be appreciated by those skilled in the art that implementing the method for the above embodiments is that can pass through Program is completed to instruct relevant hardware, which is stored in a storage medium, including some instructions are used so that single Piece machine, chip or processor (processor) execute all or part of the steps of each embodiment the method for the application.And it is preceding The storage medium stated includes: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory The various media that can store program code such as (RAM, Random Access Memory), magnetic or disk.
In addition, any combination can also be carried out between a variety of different embodiments of the embodiment of the present invention, as long as it is not The thought of the embodiment of the present invention is violated, equally should be considered as disclosure of that of the embodiment of the present invention.

Claims (8)

1. a kind of method for distributing timeslice for task, which is characterized in that this method comprises:
It is spaced the state for each task at least one task that determines at predetermined time intervals;And
According to definitive result, following operation is executed:
Default free time piece is respectively distributed for the task that the state at least one described task is idle state;And
It is respectively distributed for the task that the state at least one described task is busy state and presets busy timeslice, In, it is respectively assigned described when presetting busy that the predetermined time interval is less than task that the state is busy state Between piece, each task at least one described task default free time piece assigned when state is idle state Described busy timeslice is preset less than what is be assigned when state is busy state.
2. the method according to claim 1, wherein determining that at least one is appointed at the interval at predetermined time intervals Before the state of each task in business, this method further include:
Distribute the corresponding busy timeslice of initial preset at least one described task, wherein it is described for it is described at least State in one task be the task of busy state respectively distribute preset busy timeslice be for it is described at least one appoint State in business is that the task of busy state distributes corresponding busy timeslice of initial preset.
3. the method according to claim 1, wherein this method further include:
Judge at least one described task with the presence or absence of the executing exception of the task;And
In the case where there is the executing exception of the task at least one described task, control execution is described to execute abnormal task Corresponding abnormality processing operation, so that the task recovery for executing exception is normal.
4. a kind of for distributing the device of timeslice for task, which is characterized in that the device includes:
State determining module, for being spaced the state for determining each task at least one task at predetermined time intervals;And
Timeslice distribution module, for executing following operation according to definitive result:
Default free time piece is respectively distributed for the task that the state at least one described task is idle state;And
It is respectively distributed for the task that the state at least one described task is busy state and presets busy timeslice, In, it is respectively assigned described when presetting busy that the predetermined time interval is less than task that the state is busy state Between piece, each task at least one described task default free time piece assigned when state is idle state Described busy timeslice is preset less than what is be assigned when state is busy state.
5. device according to claim 4, which is characterized in that the device further include:
Initial setting module, in the state for being spaced each task at least one task that determines at predetermined time intervals Before, distribute corresponding busy timeslice of initial preset at least one described task, wherein it is described for it is described at least State in one task be the task of busy state respectively distribute preset busy timeslice be for it is described at least one appoint State in business is that the task of busy state distributes corresponding busy timeslice of initial preset.
6. device according to claim 4, which is characterized in that the device further include:
Judgment module, for judging at least one described task with the presence or absence of the executing exception of the task;And
Control module, in the case where executing abnormal task for existing at least one described task, described in control execution The corresponding abnormality processing operation of abnormal task is executed, so that the task recovery for executing exception is normal.
7. a kind of smart home system, which is characterized in that the smart home system includes: described in any one of claim 4-6 Device.
8. a kind of machine readable storage medium, it is stored with instruction on the machine readable storage medium, which is used for so that machine Perform claim requires method described in any one of 1-3.
CN201910199386.6A 2019-03-15 2019-03-15 Method and device for distributing time slices and method and device for controlling task execution Active CN109947548B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910199386.6A CN109947548B (en) 2019-03-15 2019-03-15 Method and device for distributing time slices and method and device for controlling task execution

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910199386.6A CN109947548B (en) 2019-03-15 2019-03-15 Method and device for distributing time slices and method and device for controlling task execution

Publications (2)

Publication Number Publication Date
CN109947548A true CN109947548A (en) 2019-06-28
CN109947548B CN109947548B (en) 2020-11-20

Family

ID=67010205

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910199386.6A Active CN109947548B (en) 2019-03-15 2019-03-15 Method and device for distributing time slices and method and device for controlling task execution

Country Status (1)

Country Link
CN (1) CN109947548B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0558106A2 (en) * 1988-04-18 1993-09-01 BRUNSWICK BOWLING & BILLIARDS CORPORATION Operating method for a processing system under control of a multi-tasking time slice operating system
CN101027642A (en) * 2004-09-17 2007-08-29 松下电器产业株式会社 Processor
CN103885825A (en) * 2014-03-05 2014-06-25 南京邮电大学 Real-time speed monotony scheduling method based on dynamic time slices
CN104536835A (en) * 2014-12-12 2015-04-22 北京控制工程研究所 Self-adaption task scheduling method in hot backup real-time control system
CN106155806A (en) * 2015-04-14 2016-11-23 腾讯科技(深圳)有限公司 A kind of multi-task scheduling method and server
CN106648856A (en) * 2016-11-24 2017-05-10 深圳市万普拉斯科技有限公司 Task scheduling method and device
CN108166845A (en) * 2017-12-20 2018-06-15 美的集团股份有限公司 A kind of information prompting method of intelligent door lock, device, system and intelligent door lock
CN108509276A (en) * 2018-03-30 2018-09-07 南京工业大学 Video task dynamic migration method in edge computing environment
CN108594777A (en) * 2018-04-20 2018-09-28 百度在线网络技术(北京)有限公司 Intelligent home furnishing control method, device, equipment, system and storage medium
CN108958157A (en) * 2018-07-09 2018-12-07 北京东土科技股份有限公司 Control process control dispatching method, device, computer equipment and storage medium

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0558106A2 (en) * 1988-04-18 1993-09-01 BRUNSWICK BOWLING & BILLIARDS CORPORATION Operating method for a processing system under control of a multi-tasking time slice operating system
CN101027642A (en) * 2004-09-17 2007-08-29 松下电器产业株式会社 Processor
CN103885825A (en) * 2014-03-05 2014-06-25 南京邮电大学 Real-time speed monotony scheduling method based on dynamic time slices
CN104536835A (en) * 2014-12-12 2015-04-22 北京控制工程研究所 Self-adaption task scheduling method in hot backup real-time control system
CN106155806A (en) * 2015-04-14 2016-11-23 腾讯科技(深圳)有限公司 A kind of multi-task scheduling method and server
CN106648856A (en) * 2016-11-24 2017-05-10 深圳市万普拉斯科技有限公司 Task scheduling method and device
CN108166845A (en) * 2017-12-20 2018-06-15 美的集团股份有限公司 A kind of information prompting method of intelligent door lock, device, system and intelligent door lock
CN108509276A (en) * 2018-03-30 2018-09-07 南京工业大学 Video task dynamic migration method in edge computing environment
CN108594777A (en) * 2018-04-20 2018-09-28 百度在线网络技术(北京)有限公司 Intelligent home furnishing control method, device, equipment, system and storage medium
CN108958157A (en) * 2018-07-09 2018-12-07 北京东土科技股份有限公司 Control process control dispatching method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN109947548B (en) 2020-11-20

Similar Documents

Publication Publication Date Title
CN106293919B (en) A kind of the built-in tasks dispatching device and method of time trigger
CN106557369A (en) A kind of management method and system of multithreading
CN108345502A (en) Resource regulating method, device, terminal device based on DPDK and readable storage medium storing program for executing
CN105893320B (en) A kind of remote task function calling method of multi-core processor oriented
US11159535B2 (en) Methods for controlling a device and control system
CN108664794A (en) L inux server automatic security reinforcing method
EP3355192A1 (en) Methods for provisioning an industrial internet-of-things control framework of dynamic multi-cloud events and devices thereof
KR20220085366A (en) Controller for vehicle and operating system scheduling method thereof
CN104102540A (en) Operation process management method and mobile terminal
CN105808346A (en) Task scheduling method and device
CN102915292B (en) Based on the communication means of polycaryon processor and detection method thereof and control method
CN113419842B (en) Method and device for constructing edge computing microservice based on JavaScript
CN104992271B (en) System for collaborative operation of different process instances and implementation method thereof
CN102573073B (en) Resource allocation method and system for physical layer of terminal
CN109947548A (en) The method and apparatus that the method and apparatus and control task for distributing timeslice execute
CN113608852A (en) Task scheduling method, scheduling module, inference node and collaborative operation system
CN103761106A (en) Process control method and process engine
CN107025126B (en) Resource scheduling method, NFVO and system
CN117033016A (en) Flow scheduling system, method, electronic equipment and storage medium
CN109964206B (en) Device and method for processing tasks
CN109040491A (en) On-hook behavior processing method, device, computer equipment and storage medium
CN115344370A (en) Task scheduling method, device, equipment and storage medium
US10198290B2 (en) Method for composing and executing a real-time task sequence plan
CN116193384A (en) Disaster recovery switching method, system, electronic equipment and storage medium
CN107315385B (en) Embedded PLC engine implementing method and engine

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 335400 No. 1 Industrial Park, Yingtan, Jiangxi, Guixi

Applicant after: Meizhi Optoelectronic Technology Co., Ltd

Address before: 335400 No. 1 Industrial Park, Yingtan, Jiangxi, Guixi

Applicant before: MEIZHI PHOTOELECTRIC TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant