Multitasking COS operating system, operating method, computer device and storage medium

By introducing a multi-task operating system and priority scheduling mechanism into the COS system, the problems of dead waits and logical exceptions caused by long processing times and exceptions in the existing technology are solved, and the effects of efficient use of parallel processing capabilities and timely response to emergency instructions are achieved. .

CN117851012BActive Publication Date: 2024-09-27CHINA SOUTHERN POWER GRID RESEARCH TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202410023527.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-08
Publication Date
2024-09-27
Estimated Expiration
2044-01-08

AI Technical Summary

Technical Problem

When the existing COS system takes a long time to process or an abnormality occurs, it will cause communication deadlocks, logic anomalies, failure to utilize parallel processing capabilities, and the inability to respond to external emergency instructions in a timely manner.

Method used

Adopting the running method of the multi-task COS operating system, through the timer and priority scheduling mechanism, priority is given to high-priority processes, and timers and communication IO interrupt triggers are used for process scheduling to ensure that high-priority processes are executed in time, and through sending and receiving, Messenger, business and security process modules perform data delivery and security checks.

Benefits of technology

It improves the system throughput efficiency, optimizes the response time of emergency instructions, reduces dead waits and abnormal states, makes full use of the chip's parallel processing capabilities, and ensures timely response to external real-time instructions and the security of the operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117851012B
    Figure CN117851012B
Patent Text Reader

Abstract

The present invention discloses a multi-task COS operating system, an operation method, a computer device and a storage medium, wherein the operation method comprises the following steps: when the operating system is in an initialization state, the priority and time slice of each process in the operating system are obtained, the timer performs a timed check according to the time slice of the current process, and the timer interrupt is triggered after the timing ends. At this time, it is determined whether the time slice of the current process has expired. If so, the process scheduling step is entered: the context of the current process is stacked on the spot in the operating system, and the highest priority process is further obtained in the operating system. The highest priority process is in a ready state, and the highest priority process is popped or executed. If not, the current process is continued to be executed until it is completed; by adopting the above settings, the parallel computing capability of the chip can be fully utilized, the system throughput efficiency can be improved, the response time of emergency instructions can be optimized, and a certain system scalability can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of embedded operating systems, and in particular relates to a multi-task COS operating system, an operating method, a computer device and a storage medium. Background Art

[0002] The COS (Chip Operating System) operating system is currently widely used in the field of embedded technology. In its existing technical solutions, the system mostly executes the main logic code in a polling manner, and cooperates with the execution of various interrupt events caused by the device interrupt source in an interrupt manner. Figure 1 As shown, when the COS system of the prior art is running, the device is first initialized, then the judgment step is performed, and then the instruction list business logic step is entered. After the instruction list business logic step, the step can be interrupted / interrupted and the judgment step can be re-entered, or it can be ended directly.

[0003] In actual business scenarios, the COS system executes corresponding business codes according to different business instructions. Figure 2 The figure shows the business process of the COS system in the prior art. An instruction list is provided inside the COS system. The specific instruction content is determined by the business module. The system executes the business logic in the order in which the instructions are received and the execution results are returned by the system communication interface.

[0004] It can be seen that the existing COS system executes business instructions in a serial manner according to the order in which the instructions are received. Only after the previous instruction is executed and a response is given can the second business instruction be executed and a response result is given. This operation method usually results in:

[0005] 1) If the previous instruction takes a long time to process, it will cause communication deadlock and reduce processing efficiency;

[0006] 2) If an exception occurs in the processing of a certain instruction, the system logic will enter an abnormal state;

[0007] 3) If each hardware submodule inside the chip supports parallel processing, the parallel processing capability of the chip cannot be effectively utilized;

[0008] 4) Unable to respond promptly to external real-time critical emergency instructions. Summary of the invention

[0009] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a multi-tasking COS operating system, operating method, computer equipment and storage medium, which can give full play to the parallel computing capability of the chip, improve the system throughput efficiency, optimize the response time of emergency instructions, and have a certain system scalability.

[0010] The purpose of the present invention is achieved through the following technical solutions:

[0011] A method for operating a multi-task COS operating system comprises the following steps:

[0012] Step 1: When the operating system is in the initialization state, obtain the priority and time slice of each process in the operating system. The operating system timer performs a periodic check based on the time slice of the current process. After the timing ends, the operating system timer interrupt is triggered. At this time, determine whether the time slice of the current process has expired. If so, enter the process scheduling step; if not, continue to execute the current process until it is completed.

[0013] Step 2: In the process scheduling step, the context of the current process is pushed on the spot in the operating system, and the highest priority process is further obtained in the operating system. The highest priority process is in a ready state, and the highest priority process is popped or executed.

[0014] Furthermore, the process scheduling step includes scheduling of sending and receiving processes, scheduling of messenger processes, scheduling of business processes and scheduling of security processes, and the scheduling of sending and receiving processes, scheduling of messenger processes, scheduling of business processes and scheduling of security processes are arranged in descending order of priority.

[0015] Furthermore, the scheduling step of the sending and receiving process includes: when the operating system runs the current process, determining whether the communication IO interrupt is triggered, if so, using the operating system to clear the remaining time slice of the current process, and then entering the process scheduling step, pushing the context of the current process on the operating system, and then obtaining the sending and receiving process, using the sending and receiving process module to pop or execute the sending and receiving process in the operating system, so that the sending and receiving process module sends and receives data, and when the sending and receiving process performs a data receiving operation, the received data is stored in the storage address RAM specified by the messenger process; if not, continue to execute the current process until it is completed.

[0016] Furthermore, the messenger process scheduling step includes: when the operating system completes the sending and receiving process or the business process, the operating system timer interrupt is triggered, then the process scheduling step is entered, the context of the current process is pushed on the spot in the operating system, and the messenger process is further obtained in the operating system, the messenger process is in a ready state, and the messenger process is popped or executed;

[0017] Further, when the messenger process is immediately after the sending and receiving process is completed, the messenger process module independently stores the data stored in the storage RAM address of the sending and receiving process module in the corresponding fixed block, and the messenger process module then transmits the data stored in the sending and receiving process module to the corresponding business process module in the form of fixed blocks;

[0018] When the messenger process follows the completion of the business process, the messenger process module independently stores the data transmitted by the business process module in the corresponding fixed block. The messenger process module then transmits the data received from the business process module to the transceiver process module in the form of a fixed block, and finally returns the response data of the business process module to the outside world through the transceiver process module.

[0019] Furthermore, the scheduling step of the business process includes: when the operating system runs the current process, the communication IO will be interrupted and triggered, and it is determined whether the communication IO interrupt is triggered. If so, the operating system is used to clear the remaining time slice of the current process, and then the process scheduling step is entered, the context of the current process is pushed on the stack in the operating system, and then the business process is obtained, and the business process module is used to sort multiple ready business processes from high to low according to priority to form a queue, and then the multiple business processes are popped or executed in turn, and at the same time, the response data generated when the multiple business processes are popped or executed by the business process module is stored in the storage RAM of the messenger process module; if not, the current process continues to be executed until it is completed.

[0020] Furthermore, in the business process, for the business process queues with the same priority level that are ready, the queues are sorted according to the order of data transmission to form corresponding queues, and then the business process module is used to pop or execute multiple business processes.

[0021] Furthermore, the scheduling step of the security process includes: when other processes are in a dormant state, the operating system directly schedules the security process, and the security process module adopts an active security strategy and can perform integrity self-checks, random number self-checks, algorithm self-checks and other security check operations on the operating system's firmware according to actual scenario requirements.

[0022] Furthermore, after the security process operation is completed, the security process module sets the corresponding self-check flag in the operating system, and when the outside world needs to obtain such information, the flag status can be quickly returned.

[0023] A multi-task COS operating system, applied to an operating system operation method, comprising:

[0024] The timer is used to time the time slice of each process in the operating system and check whether the time slice of the current process has expired. When the process expires, the timer interrupt is triggered;

[0025] Communication IO, used to trigger IO interrupts during the operation of the operating system;

[0026] The transceiver process module is used to receive external command data and return system response data to the outside;

[0027] The messenger process module is used for data transmission and maintenance of data stored in the data area RAM;

[0028] The data area RAM is divided into fixed blocks of different sizes. The fixed blocks are operated in a linked list manner and are used to store independent data.

[0029] The business process module is used for business logic processing. The corresponding business processes are added according to the number of businesses.

[0030] The security process module resides in the memory of the operating system. When other processes are in a dormant state, the security process is controlled by the scheduler and is used to perform security check operations such as fixed integrity self-check, random number self-check, and algorithm self-check on the operating system.

[0031] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0032] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.

[0033] The present invention has the following beneficial effects:

[0034] A method for operating a multi-tasking COS operating system can prioritize the scheduling of processes with higher priorities after the current process of the operating system ends, so that the ready process with higher priority can be popped or executed in time, so that the operating system can handle more urgent or critical processes in time, so as to reduce the situation where the operating system is dead waiting or the system logic enters an abnormal state during operation, so that the operating system can effectively utilize the parallel capability of the chip and can respond to external real-time critical emergency instructions in time.

[0035] A multi-task COS operating system. The multi-task COS operating system of the present invention mainly consists of a timer, a communication IO, a transceiver process module, a messenger process module, a data area RAM, a business process module, a security process module and a system expandable module. The timer can be interrupted after timing according to the time slice of the corresponding process, and the communication IO can interrupt the process currently running in the operating system according to the priority order of the process currently required to be operated, so as to enter the process scheduling step in advance, so as to schedule the formation of the priority front, so that the process with the priority front is preferentially executed; wherein when the scheduling is formed, the corresponding process will be scheduled according to the priority order and the actual situation, wherein the process of the transceiver process module is preferentially scheduled, the process of the messenger process module is second, the process of the business process module is followed, and the process of the security process module is finally scheduled. By adopting such an order, the information delivered by the outside world can be timely and preferentially processed and saved, so as to facilitate the real-time and perfect processing of related business. Finally, when the remaining processes are in a dormant state, the security process module can be used to perform a security check on the operating system to improve the security of the operating system; at the same time, by setting the system expandable module, the transceiver process module can receive and process signals of different communication interface protocols. Compared with the COS system in the prior art, which can only execute the main logic code through polling, the COS operating system of the present invention can, during the execution of the main logic code, utilize the current process of the communication IO terminal according to the priority status of the newly added process to give priority to the high-priority process, thereby improving the processing efficiency and reducing the dead waiting or abnormal state caused by the communication process, and can improve the system throughput efficiency, optimize the response time of emergency commands, and have a certain system scalability.

[0036] A computer device is capable of running the steps of a method for running a multi-tasking COS operating system, so that the operating system in the computer device can reduce the situation where the operating system is dead or the system logic enters an abnormal state during operation, so that the operating system can effectively utilize the chip parallel capability and can respond to external real-time critical emergency instructions in a timely manner.

[0037] A computer-readable storage medium stores a computer program, which, when executed by a processor, can run the steps of a method for running a multi-tasking COS operating system, so that the operating system in a computer device can reduce the situation where the operating system is dead or the system logic enters an abnormal state during operation, so that the operating system can effectively utilize the chip parallel capability and can respond to external real-time critical emergency instructions in a timely manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 It is a framework diagram of the COS system in the prior art.

[0039] Figure 2 This is a business flow chart of the COS system in the prior art.

[0040] Figure 3 It is the flow chart of the multi-task COS system of the present invention.

[0041] Figure 4 It is a flow chart of the sending and receiving process of the present invention.

[0042] Figure 5 It is the schematic diagram of the messenger process of the present invention.

[0043] Figure 6 It is a business process flow chart of the present invention. DETAILED DESCRIPTION

[0044] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.

[0045] Example 1

[0046] A multitasking COS operating system, such as Figures 3 to 6 As shown, the time slice rotation is adopted to preempt the priority scheduling strategy, and the priority is defined as 0-7, 8 priorities, where 0 is the highest priority and 7 is the lowest priority. The operating system includes:

[0047] The timer is used to count and / or time the time slice of each process in the operating system and check whether the time slice of the current process has expired. When the current process expires, the timer interrupt is triggered;

[0048] Communication IO, the priority of communication IO interrupt hardware is higher than that of system timer hardware interrupt. It is used to trigger IO interrupt during the operation of the operating system so that the CPU can respond to IO interrupt first.

[0049] The transceiver process module is used to receive external command data and return system response data to the outside. The transceiver process module has a priority of 0;

[0050] The messenger process module is used for data transmission and maintenance of data stored in the data area RAM. The messenger process module has a priority of 1. Depending on the different chip hardware modules, the messenger process can use the public storage RAM or use DMA to move data.

[0051] The data area RAM is divided into multiple fixed blocks of different sizes (for example: 256 bytes, 512 bytes, 1024 bytes). Each fixed block is operated in a linked list manner to store data (such as Figure 5 shown);

[0052] The business process module is used for business logic processing. According to the number of businesses, corresponding business processes are added. The optional priority of each business process is 2-6. Emergency instructions can be set as business processes separately, and their process priority needs to be set at the front. General business processes can also use the same priority (when scheduling processes, ready processes with the same priority are executed in sequence in FIFO arrangement);

[0053] The security process module resides in the memory of the operating system. When other processes are in a dormant state, the security process, under the control of the scheduler, adopts active security strategies and performs security check operations such as fixed integrity self-check, random number self-check, and algorithm self-check on the operating system according to actual scenario requirements.

[0054] The system extensibility module expands and adapts the transceiver process module according to different communication interface protocols (for example: USB, SPI, etc.). The transceiver process module provides the HookDriverHandle interface to standardize the driver interface, which can be expanded into specific instances according to different protocol types. When instantiating different communication interface protocols, if there is no corresponding operation for the protocol, the operation function can be left blank.

[0055] In summary, the multi-task COS operating system of the present invention is mainly composed of a timer, a communication IO, a transceiver process module, a messenger process module, a data area RAM, a business process module, a security process module and a system expandable module. The timer can be interrupted after timing according to the time slice of the corresponding process, and the communication IO can interrupt the process currently running in the operating system according to the priority order of the process currently required to be operated, so as to enter the process scheduling step in advance, so as to schedule the formation of a priority level, so that the process with a higher priority level can be preferentially executed; wherein when the scheduling is formed, the corresponding process will be scheduled according to the priority order and the actual situation, wherein the process of the transceiver process module is preferentially scheduled, followed by the process of the messenger process module, then the process of the business process module, and finally the process of the security process module. By adopting such an order, the information delivered by the outside world can be timely and preferentially processed and saved, so as to facilitate the real-time and perfect processing of related services. Finally, when the remaining processes are in a dormant state, the security process module can be used to perform a security check on the operating system to improve the security of the operating system; at the same time, by setting the system expandable module, the transceiver process module can receive and process signals of different communication interface protocols.

[0056] Compared with the COS system in the prior art, which can only execute the main logic code through polling, the COS operating system of the present invention can, during the execution of the main logic code, utilize the current process of the communication IO terminal according to the priority status of the newly added process to give priority to the high-priority process, thereby improving the processing efficiency and reducing the dead waiting or abnormal state caused by the communication process, and can improve the system throughput efficiency, optimize the response time of emergency commands, and have a certain system scalability.

[0057] Example 2

[0058] The present invention is based on the multi-task COS operating system of embodiment 1, and further discloses a method for operating the multi-task COS operating system, such as Figure 3 As shown, the operation method includes the following steps:

[0059] Step 1: When the operating system is in the initialization state, obtain the priority and time slice of each process in the operating system. The operating system timer performs a periodic check based on the time slice of the current process. After the timing ends, the operating system timer interrupt is triggered. At this time, determine whether the time slice of the current process has expired. If so, enter the process scheduling step; if not, continue to execute the current process until it is completed.

[0060] Step 2: In the process scheduling step in step 1, the context of the current process is pushed on the spot in the operating system, and the highest priority process is further obtained in the operating system. The highest priority process is in a ready state, and the highest priority process is popped or executed.

[0061] In the process scheduling step of step 2, the process scheduling step includes the scheduling of the sending and receiving process, the scheduling of the messenger process, the scheduling of the business process and the scheduling of the security process. The scheduling of the sending and receiving process, the scheduling of the messenger process, the scheduling of the business process and the scheduling of the security process are arranged in descending order according to the priority.

[0062] Regarding the scheduling steps of the sending and receiving processes, such as Figure 4As shown, the transceiver process module is mainly used. When the operating system runs the current process, the communication IO receives a process signal with a higher priority than the current process (for example: critical emergency instructions, etc.), or receives an external signal, the communication IO will be interrupted and triggered. Therefore, before scheduling other processes, it is necessary to determine whether the communication IO interrupt is triggered. If so, the operating system is used to clear the remaining time slice of the current process, and then enter the process scheduling step. The context of the current process is pushed on the stack in the operating system, and then the transceiver process is obtained. The transceiver process module is used to pop or execute the transceiver process in the operating system, so that the transceiver process module sends and receives data. When the transceiver process module performs a data receiving operation, the transceiver process module stores the received data in the storage address RAM specified by the messenger process (the storage address RAM is the corresponding storage address in the data area RAM of Example 1); if not, the current process continues to be executed until it is completed.

[0063] As a result, the COS operating system gives priority to high-priority processes, and then processes other equal-level processes or low-priority processes, to reduce the situation where the operating system waits for a long time or the system logic enters an abnormal state during operation, so that the operating system can effectively utilize the chip's parallel capabilities and respond promptly to external real-time critical emergency instructions.

[0064] Regarding the scheduling steps of the messenger process, such as Figure 5 As shown, the messenger process module is mainly used. The scheduling step of the messenger process is usually immediately after the sending and receiving process or the business process is completed, so as to timely process the data received by the sending and receiving process or the response data processed by the business process.

[0065] Specifically: when the operating system runs a sending and receiving process or a business process, the timer interrupt of the operating system is triggered to determine whether the time slice of the current sending and receiving process or the business process has expired. If so, the process scheduling step is entered, and the context of the current process is pushed on the stack on the spot in the operating system. The messenger process is further obtained in the operating system. The messenger process is in a ready state, and the messenger process is popped or executed; if not, the current process continues to be executed until it is completed.

[0066] In the messenger process, the messenger process module independently stores the data stored in the RAM address by the transceiver process module in the corresponding fixed block (the fixed block is as follows Figure 5The messenger process module then transmits the data stored in the transceiver process module to the corresponding business process module in the form of fixed blocks; after receiving the messenger process module, the business process module makes a corresponding response, and the business process module stores the response data in the storage address RAM of the messenger module. The messenger process module further stores the data transmitted by the business process module independently in the corresponding fixed block, and the messenger process module then transmits the data received from the business process module to the transceiver process module in the form of fixed blocks, and finally returns the response data of the business process module to the outside world through the transceiver process module.

[0067] Therefore, when the messenger process maintains the data area RAM, the data stored in the storage address RAM is independently stored in an independent fixed block for independent transmission to facilitate management. At the same time, according to the actual needs of the business scenario, the data can be divided into multiple blocks of different fixed block sizes (for example: 256 bytes / 512 bytes / 1024 bytes), so that each fixed block is operated in a linked list manner. The messenger process module is used to transmit the received data of the transceiver process module to the corresponding business process module in a complete and good manner, and the response data given by the business process module, especially the emergency instructions, are not fully and well fed back to the transceiver process module, and finally transmitted to the outside world, so that the operating system can respond promptly according to the received data and / or response data, so as to reduce the situation where the operating system is dead or the system logic enters an abnormal state during operation, so that the operating system can effectively utilize the chip parallel capability and can respond promptly to external real-time critical emergency instructions.

[0068] Regarding the scheduling steps of the business process, such as Figure 6 As shown, the business process module is mainly used. The scheduling of the business process is usually based on the data received by the sending and receiving process, and responds in time. Therefore, it is usually immediately after the sending and receiving process or the messenger process is completed, and responds to the data received by the sending and receiving process in time.

[0069] Specifically, when the operating system runs the current process, the communication IO will be interrupted and triggered. It is determined whether the communication IO interrupt is triggered. If so, the operating system is used to clear the remaining time slice of the current process, and then the process scheduling step is entered. The context of the current process is pushed on the stack in the operating system, and then the business process is obtained. The business process module is used to sort multiple ready business processes from high to low according to priority to form a queue, and then the multiple business processes are popped or executed in turn. At the same time, the business process module is used to store the response data generated when the multiple business processes are popped or executed in the storage RAM of the messenger process module; if not, the current process continues to be executed until it is completed.

[0070] In the business process, for the business process queues with the same priority level, the data transmission sequence is sorted to form a corresponding queue (FIFO mode), and then the business process module is used to pop or execute multiple business processes.

[0071] Therefore, the business process module can pop the stack or execute in sequence according to the queue according to the different priorities of the business process, so as to reduce the situation where the operating system waits or the system logic enters an abnormal state during operation, so that the operating system can effectively utilize the chip parallel capabilities and respond to external real-time critical emergency instructions in a timely manner.

[0072] Regarding the scheduling steps of the security process, the security process module is mainly used, which resides in the operating system memory. The operating system will schedule the security process only when other processes are in a dormant state. Specifically, when other processes are in a dormant state, the operating system directly schedules the security process. The security process module adopts an active security strategy and can perform integrity self-checks, random number self-checks, algorithm self-checks and other security check operations on the firmware of the operating system according to actual scenario requirements (for example, some systems or modules may fail or be invaded).

[0073] After the security process operation is completed, the security process module sets the corresponding self-check flag in the operating system, and can quickly return the flag status when the outside world needs to obtain such information.

[0074] Therefore, the security process module can actively perform integrity self-checks, random number self-checks, algorithm self-checks and other security check operations on the operating system's firmware when other processes of the operating system are in a dormant state, thereby improving the security of the operating system during operation. At the same time, it can be entered at the corresponding self-check flag position for timely retrieval and return, making it easier to find.

[0075] To sum up, the operating method of the multi-tasking COS operating system of the present invention can give priority to scheduling processes with higher priority after the current process of the operating system ends, so that the high-priority ready process can be popped or executed in time, so that the operating system can handle more urgent or critical processes in time, so as to reduce the situation where the operating system waits for a long time or the system logic enters an abnormal state during operation, so that the operating system can effectively utilize the chip parallel capability and can respond to external real-time critical emergency instructions in time.

[0076] Example 3

[0077] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for operating a multi-task COS operating system in Embodiment 2 are implemented:

[0078] Step 1: When the operating system is in the initialization state, obtain the priority and time slice of each process in the operating system. The operating system timer performs a periodic check based on the time slice of the current process. After the timing ends, the operating system timer interrupt is triggered. At this time, determine whether the time slice of the current process has expired. If so, enter the process scheduling step; if not, continue to execute the current process until it is completed.

[0079] Step 2: In the process scheduling step in step 1, the context of the current process is pushed on the spot in the operating system, and the highest priority process is further obtained in the operating system. The highest priority process is in a ready state, and the highest priority process is popped or executed.

[0080] In the process scheduling step of step 2, the process scheduling step includes the scheduling of the sending and receiving process, the scheduling of the messenger process, the scheduling of the business process and the scheduling of the security process. The scheduling of the sending and receiving process, the scheduling of the messenger process, the scheduling of the business process and the scheduling of the security process are arranged in descending order according to the priority.

[0081] Example 4

[0082] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the method for operating the multi-task COS operating system in Embodiment 2 are implemented:

[0083] Step 1: When the operating system is in the initialization state, obtain the priority and time slice of each process in the operating system. The operating system timer performs a periodic check based on the time slice of the current process. After the timing ends, the operating system timer interrupt is triggered. At this time, determine whether the time slice of the current process has expired. If so, enter the process scheduling step; if not, continue to execute the current process until it is completed.

[0084] Step 2: In the process scheduling step in step 1, the context of the current process is pushed on the spot in the operating system, and the highest priority process is further obtained in the operating system. The highest priority process is in a ready state, and the highest priority process is popped or executed.

[0085] In the process scheduling step of step 2, the process scheduling step includes the scheduling of the sending and receiving process, the scheduling of the messenger process, the scheduling of the business process and the scheduling of the security process. The scheduling of the sending and receiving process, the scheduling of the messenger process, the scheduling of the business process and the scheduling of the security process are arranged in descending order according to the priority.

[0086] The implementation methods of the present invention are not limited to this. According to the above content of the present invention, using common technical knowledge and customary means in the field, without departing from the above basic technical ideas of the present invention, the present invention can also make other various forms of modification, replacement or combination, all of which fall within the scope of protection of the present invention.

Claims

1. A method for operating a multi-tasking COS operating system, wherein COS is a Chip Operating System, It is characterized in that The following steps are involved: When the operating system is in the initialization state, the priority and time slice of each process in the operating system are obtained. The operating system timer performs a regular check based on the time slice of the current process. After the timing ends, the operating system timer interrupt is triggered. At this time, it is determined whether the time slice of the current process has expired. If so, the process scheduling step is entered; if not, the current process continues to be executed until it is completed; In the process scheduling step, the context of the current process is pushed on the spot in the operating system, and the highest priority process is further obtained in the operating system, the highest priority process is in a ready state, and the highest priority process is popped or executed; The process scheduling step includes scheduling of the sending and receiving process, scheduling of the messenger process, scheduling of the business process and scheduling of the security process, and the scheduling of the sending and receiving process, scheduling of the messenger process, scheduling of the business process and scheduling of the security process are arranged in descending order according to priority; The scheduling step of the transceiver process includes: when the operating system runs the current process, determining whether the communication IO interrupt is triggered, if so, using the operating system to clear the remaining time slice of the current process, and then entering the process scheduling step, pushing the context of the current process on the operating system, and then obtaining the transceiver process, using the transceiver process module to pop or execute the transceiver process in the operating system, so that the transceiver process module sends and receives data, and when the transceiver process performs a data receiving operation, the received data is stored in the storage address RAM specified by the messenger process; if not, continue to execute the current process until it is completed; The messenger process scheduling step includes: when the operating system completes the sending and receiving process or the business process, the operating system timer interrupt is triggered, then the process scheduling step is entered, the context of the current process is pushed on the spot in the operating system, and the messenger process is further obtained in the operating system, the messenger process is in a ready state, and the messenger process is popped or executed; When the messenger process is completed immediately after the sending and receiving process, the messenger process module independently stores the data stored in the storage RAM address of the sending and receiving process module in the corresponding fixed block, and the messenger process module then transmits the data stored in the sending and receiving process module to the corresponding business process module in the form of fixed blocks; When the messenger process follows the completion of the business process, the messenger process module independently stores the data transmitted by the business process module in the corresponding fixed block. The messenger process module then transmits the data received from the business process module to the transceiver process module in the form of a fixed block, and finally returns the response data of the business process module to the outside world through the transceiver process module.

2. The method for operating the multi-tasking COS operating system as claimed in claim 1, Features: The scheduling step of the business process includes: when the operating system runs the current process, the communication IO will be interrupted and triggered, and it is determined whether the communication IO interrupt is triggered. If so, the operating system is used to clear the remaining time slice of the current process, and then the process scheduling step is entered, the context of the current process is pushed on the stack in the operating system, and then the business process is obtained, and the business process module is used to sort multiple ready business processes from high to low according to priority to form a queue, and then the multiple business processes are popped or executed in turn, and the response data generated when the multiple business processes are popped or executed by the business process module is stored in the storage RAM of the messenger process module; if not, the current process is continued to be executed until it is completed.

3. The method for operating the multi-task COS operating system according to claim 1 or 2, Features: The scheduling steps of the security process include: when other processes are in a dormant state, the operating system directly schedules the security process, and the security process module adopts an active security strategy and can perform integrity self-check, random number self-check, and algorithm self-check security checks on the firmware of the operating system according to actual scenario requirements.

4. The method for operating the multi-task COS operating system as claimed in claim 3, Features: After the security process operation is completed, the security process module sets the corresponding self-check flag in the operating system, and can quickly return the flag status when the outside world needs to obtain such information.

5. A multi-tasking COS operating system, applied to the operation method according to any one of claims 1 to 4, wherein COS stands for Chip Operating System, It is characterized in that include: The timer is used to time the time slice of each process in the operating system and check whether the time slice of the current process has expired. When the process expires, the timer interrupt is triggered; Communication IO, used to trigger IO interrupts during the operation of the operating system; The transceiver process module is used to receive external command data and return system response data to the outside; The messenger process module is used for data transmission and maintenance of data stored in the data area RAM; The data area RAM is divided into fixed blocks of different sizes. The fixed blocks are operated in a linked list manner and are used to store independent data. The business process module is used for business logic processing. The corresponding business processes are added according to the number of businesses. The security process module resides in the memory of the operating system. When other processes are in a dormant state, the security process is controlled by the scheduler and is used for security check operations on the operating system's fixed integrity self-check, random number self-check, and algorithm self-check.

6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Task scheduling method for embedded operating system

    CN102043667A

  • Control program control scheduling method and device, computer device and storage medium

    CN108958157A

  • Task scheduling processing system and method of embedded real-time operating system

    CN111367652A

  • Multi-task scheduling method, electronic device and computer storage medium

    CN112416546A

  • Security chip, multi-task scheduling method and device thereof and storage medium

    CN114880102A