CN117149582A - Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium - Google Patents

Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117149582A
CN117149582A CN202311396548.8A CN202311396548A CN117149582A CN 117149582 A CN117149582 A CN 117149582A CN 202311396548 A CN202311396548 A CN 202311396548A CN 117149582 A CN117149582 A CN 117149582A
Authority
CN
China
Prior art keywords
pseudo
thread
monitoring
alarm
time
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
CN202311396548.8A
Other languages
Chinese (zh)
Other versions
CN117149582B (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.)
Jingxin Microelectronics Technology Tianjin Co Ltd
Original Assignee
Jingxin Microelectronics Technology Tianjin 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 Jingxin Microelectronics Technology Tianjin Co Ltd filed Critical Jingxin Microelectronics Technology Tianjin Co Ltd
Priority to CN202311396548.8A priority Critical patent/CN117149582B/en
Publication of CN117149582A publication Critical patent/CN117149582A/en
Application granted granted Critical
Publication of CN117149582B publication Critical patent/CN117149582B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information
    • G06F11/327Alarm or error message display
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Multimedia (AREA)
  • Alarm Systems (AREA)

Abstract

The invention discloses a pseudo-thread scheduling monitoring alarm method, a pseudo-thread scheduling monitoring alarm device, electronic equipment and a storage medium, wherein the method comprises the following steps: a monitoring pseudo thread is newly added, and the monitoring pseudo thread is mounted in a transaction queue with the lowest priority; acquiring the current time and the last call time of the monitoring pseudo thread, and calculating the time difference between the current time and the value of the last call time parameter; when the time difference is larger than a preset time difference threshold, an alarm pseudo thread is newly added, and the alarm pseudo thread is mounted at the tail of the transaction queue with the highest priority; when the alert pseudo-thread is a currently executing transaction, the current pseudo-thread scheduling state is announced as busy. The pseudo thread scheduling monitoring alarm method provided by the invention can be used for rapidly informing the busy information of the pseudo thread scheduling mechanism when the pseudo thread scheduling mechanism is busy, helping a user or a service module to rapidly locate the reason that the pseudo thread scheduling mechanism is busy, and solving the defect that the current pseudo thread scheduling state cannot be rapidly perceived in the prior art.

Description

Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a pseudo-thread scheduling monitoring alarm method, a pseudo-thread scheduling monitoring alarm device, electronic equipment and a storage medium.
Background
In an embedded system, the functions of the system are relatively complex in some cases, most of the cases can only modularize related functions, then the function types are classified, scheduled and processed, and the scheduling of pseudo threads is a better solution, so that the modularization flexibility can be ensured, the characteristics of the pseudo threads can be relied on, the problems of synchronization and mutual exclusion caused by the original adoption of a plurality of real threads for function processing can be reduced, and the processing efficiency can be effectively improved.
There are various implementations of the scheduling mechanism based on the pseudo thread, wherein one of the more common ways is to classify various pseudo thread transactions, such as event processing pseudo threads, read IO pseudo threads, write IO pseudo threads, and the like, and to prioritize the transactions according to the importance of the transactions, where the transactions with high priority can obtain the priority scheduling of the pseudo thread scheduling mechanism. The method can ensure the normal execution of the business module to a certain extent, and ensure that more important transactions can be scheduled more timely. However, by using the method, the transactions with lower priority can not be scheduled for a long time, and when the situation occurs, the user or the service module can not timely acquire the current state of pseudo-thread scheduling, so that the intervention can not be timely performed, and the normal execution of the service module and the functional processing of the whole equipment are further affected. In summary, the prior art has a defect that the current pseudo-thread scheduling state cannot be quickly perceived.
Disclosure of Invention
Therefore, the technical problem to be solved by the invention is to overcome the defect that the current pseudo-thread scheduling state cannot be perceived quickly in the prior art, so as to provide a pseudo-thread scheduling monitoring alarm method, a pseudo-thread scheduling monitoring alarm device, electronic equipment and a storage medium.
According to a first aspect, the invention discloses a pseudo-thread scheduling monitoring alarm method, which comprises the following steps: based on a priority transaction queue scheduled by a current pseudo thread, a monitoring pseudo thread is newly added, and the monitoring pseudo thread is mounted in the transaction queue with the lowest priority; acquiring the current time and the last call time of the monitoring pseudo thread, and calculating the time difference between the current time and the last call time; when the time difference is larger than a preset time difference threshold value, an alarm pseudo thread is newly added, and the alarm pseudo thread is mounted at the tail of a transaction queue with highest priority; and when the alarm pseudo thread is a currently executing transaction, informing that the current pseudo thread scheduling state is busy.
Optionally, the adding a monitoring pseudo thread based on the priority transaction queue scheduled by the current pseudo thread, and mounting the monitoring pseudo thread to the transaction queue with the lowest priority includes: adding a monitoring pseudo thread according to a preset rule; triggering the monitoring pseudo thread, and mounting the monitoring pseudo thread into a transaction queue with the lowest priority; and setting the value of the last call time parameter of the monitoring pseudo thread to 0.
Optionally, the obtaining the current time and the last call time of the monitoring pseudo thread, calculating a time difference between the current time and the value of the last call time parameter, includes: acquiring the current time and the last calling time of the monitoring pseudo thread; when the last call time of the monitoring pseudo thread is 0, setting the value of the last call time parameter of the monitoring pseudo thread as the current time; and when the last call time of the monitoring pseudo thread is not 0, calculating the time difference between the current time and the last call time.
Optionally, the adding an alarm pseudo thread, mounting the alarm pseudo thread at the end of the transaction queue with the highest priority, includes: judging whether the alarm pseudo thread exists or not based on the alarm pseudo thread existence parameters of the pseudo thread queue; when the alarm pseudo thread does not exist, triggering the alarm pseudo thread, and mounting the alarm pseudo thread to the tail of a transaction queue with highest priority; and setting the existence parameters of the alarm pseudo thread to a value representing the existence of the alarm pseudo thread according to a preset rule.
Optionally, when the alert pseudo-thread is a currently executing transaction, notifying that the current pseudo-thread scheduling state is busy includes: acquiring a transaction currently being executed; when the currently executing transaction is the alarm pseudo thread, acquiring parameters of a pseudo thread queue according to a preset rule; informing the current pseudo-thread scheduling state as busy and parameters of the pseudo-thread queue; adding one to the value of the alarm counting parameter of the pseudo thread queue; setting the existence parameters of the alarm pseudo thread to a value representing that the alarm pseudo thread does not exist according to a preset rule; a pseudo-thread scheduling mechanism is executed in a loop.
Optionally, the pseudo thread scheduling monitoring alarm method further includes: when the currently executing transaction is the monitoring pseudo thread, acquiring the current time; setting the value of the last call time parameter of the monitoring pseudo thread as the current time; resetting an execution count parameter and an alarm count parameter of the pseudo thread queue; triggering a monitoring pseudo thread, and mounting the monitoring pseudo thread into a transaction queue with the lowest priority; a pseudo-thread scheduling mechanism is executed in a loop.
Optionally, the pseudo thread scheduling monitoring alarm method further includes: when the currently executing transaction is not the alarm pseudo thread or the monitoring pseudo thread, normally processing the transaction; the value of the execution count parameter of the queue to which the pseudo thread belongs is increased by one; a pseudo-thread scheduling mechanism is executed in a loop.
According to a second aspect, the invention also discloses a pseudo-thread scheduling monitoring alarm device, which comprises: the monitoring and mounting module is used for newly adding a monitoring pseudo thread based on a priority transaction queue scheduled by the current pseudo thread and mounting the monitoring pseudo thread into the transaction queue with the lowest priority; the time difference calculation module is used for acquiring the current time and the last call time of the monitoring pseudo thread and calculating the time difference between the current time and the last call time; the alarm mounting module is used for adding an alarm pseudo thread when the time difference is larger than a preset time difference threshold value, and mounting the alarm pseudo thread to the tail of the transaction queue with the highest priority; and the busy notification module is used for notifying that the current pseudo thread scheduling state is busy when the alarm pseudo thread is the currently executing transaction.
According to a third aspect, the invention also discloses an electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the steps of the pseudo-thread scheduling monitoring alert method according to any of the first aspect and the optional implementation manner of the first aspect.
According to a fourth aspect, the present invention also discloses a computer readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the pseudo thread scheduling monitoring alarm method according to any one of the first aspect and the optional implementation manners of the first aspect.
The technical scheme of the invention has the following advantages:
1. according to the pseudo-thread scheduling monitoring alarm method provided by the invention, whether the transaction queue is idle can be accurately judged by adding a monitoring pseudo-thread. By calculating the time difference between the current time and the last calling time of the monitoring pseudo thread, the time of how long the transaction queue has elapsed since the last idle time can be obtained, and therefore the time difference is used as a judging basis for judging whether the transaction queue is busy. By adding a new alarm pseudo thread and mounting the alarm pseudo thread at the tail of the transaction queue with the highest priority, the busy condition of the pseudo thread can be timely alarmed, and meanwhile, the busy information of the pseudo thread scheduling mechanism is announced to a user or a service module. By informing the user or the service module that the current pseudo-thread scheduling state is busy, timely feedback of the previous pseudo-thread scheduling state can be realized, and the defect that the current pseudo-thread scheduling state cannot be perceived quickly in the prior art is overcome.
2. According to the pseudo-thread scheduling monitoring alarm method provided by the invention, the preset time difference threshold is calculated by using the preset method, so that the alarm frequency can be flexibly modified according to actual conditions. By recording the execution times and the alarming times, the alarming information is more comprehensive, and the user or the service module can process properly. In the pseudo thread scheduling monitoring alarm method provided by the invention, in the pseudo thread scheduling mechanism based on priority scheduling, when the pseudo thread scheduling mechanism is busy, the busy information of the pseudo thread scheduling mechanism can be rapidly announced, and a user or a service module can be assisted to rapidly locate the reason that the pseudo thread scheduling mechanism is busy.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a specific example of a pseudo-thread scheduling monitor alert method in an embodiment of the present invention;
FIG. 2 is a flowchart of another specific example of a pseudo-thread scheduling monitor alert method in an embodiment of the present invention;
FIG. 3 is a flowchart of another specific example of a pseudo-thread scheduling monitor alert method in an embodiment of the present invention;
FIG. 4 is a flowchart of another specific example of a pseudo-thread scheduling monitor alert method in an embodiment of the present invention;
FIG. 5 is a flowchart of another specific example of a pseudo-thread scheduling monitor alert method in an embodiment of the present invention;
FIG. 6 is a flowchart of another specific example of a pseudo-thread scheduling monitor alert method in an embodiment of the present invention;
FIG. 7 is a schematic block diagram of a specific example of a pseudo-thread scheduling monitor and alarm device in an embodiment of the present invention;
FIG. 8 is a diagram illustrating an embodiment of an electronic device according to the present invention;
fig. 9 is a diagram showing a specific example of a computer-readable storage medium according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the invention are shown. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; the two components can be directly connected or indirectly connected through an intermediate medium, or can be communicated inside the two components, or can be connected wirelessly or in a wired way. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
In addition, the technical features of the different embodiments of the present invention described below may be combined with each other as long as they do not collide with each other.
The embodiment of the invention provides a pseudo-thread scheduling monitoring alarm method, as shown in figure 1, comprising the following steps:
step S1, based on a priority transaction queue scheduled by a current pseudo thread, a monitoring pseudo thread is newly added, and the monitoring pseudo thread is mounted in the transaction queue with the lowest priority.
The monitoring pseudo-thread is a pseudo-thread transaction which is additionally defined in the business module and has a lower priority than any other pseudo-thread transaction, and the pseudo-thread transaction continuously exists, namely, when no other pseudo-thread transaction needs to be scheduled in the pseudo-thread scheduling, the pseudo-thread transaction is always scheduled.
Specifically, a monitoring pseudo thread is newly added in the transaction queue with the lowest priority of the current pseudo thread scheduling, so that the transaction queue can be monitored. Because the priority of the monitoring pseudo-thread is the lowest, when the monitoring pseudo-thread is scheduled, the transaction queue at the moment can be considered to be idle, and no transaction is to be executed.
For example, the Monitor pseudothread may be defined as a Monitor pseudothread.
And S2, acquiring the current time and the last call time of the monitoring pseudo thread, and calculating the time difference between the current time and the last call time.
The last calling time of the monitoring pseudo thread is stored in a pseudo thread scheduling mechanism as a parameter, and the last calling time of the monitoring pseudo thread can be recorded. For example, the Last call time of the monitoring pseudo thread may be recorded as a last_time field.
Specifically, by calculating the time difference between the current time and the last_time, that is, how long the transaction queue has elapsed since the Last idle time, the processing duration of the transaction queue at this time can be represented and used as a basis for determining whether the transaction queue is busy.
And step S3, when the time difference is larger than a preset time difference threshold, adding an alarm pseudo thread, and mounting the alarm pseudo thread to the tail of the transaction queue with the highest priority.
The alarm pseudo thread is one of the pseudo thread transactions which are additionally defined in the service module and belong to the highest priority, and the pseudo thread is responsible for notifying busy information of a pseudo thread scheduling mechanism.
Specifically, an alarm pseudo thread is newly added in the transaction queue with the highest priority scheduled by the current pseudo thread, so that the alarm on the transaction queue can be realized. The priority of the false thread is set to be the end of the transaction queue with the highest priority, and the busy condition of the false thread can be timely alarmed.
For example, the alert pseudo-thread may be defined as a Notification pseudo-thread.
And S4, when the alarm pseudo thread is the currently executing transaction, informing that the current pseudo thread scheduling state is busy.
Specifically, since the time difference is greater than a preset time difference threshold, it may be determined that the transaction queue of the pseudo thread is busy at this time, and at this time, the transaction with a lower priority may not be scheduled for a long time, and an alarm needs to be given to the service module or the user, and appropriate intervention is performed according to the situation.
According to the pseudo-thread scheduling monitoring alarm method provided by the invention, whether the transaction queue is idle can be accurately judged by adding a monitoring pseudo-thread. By calculating the time difference between the current time and the last calling time of the monitoring pseudo thread, the time of how long the transaction queue has elapsed since the last idle time can be obtained, and therefore the time difference is used as a judging basis for judging whether the transaction queue is busy. By adding a new alarm pseudo thread and mounting the alarm pseudo thread at the tail of the transaction queue with the highest priority, the busy condition of the pseudo thread can be timely alarmed, and meanwhile, the busy information of the pseudo thread scheduling mechanism is announced to a user or a service module. By informing the user or the service module that the current pseudo-thread scheduling state is busy, timely feedback of the previous pseudo-thread scheduling state can be realized, and the defect that the current pseudo-thread scheduling state cannot be perceived quickly in the prior art is overcome.
As an optional implementation manner of the present invention, as shown in fig. 2, the method for adding a monitoring pseudo thread to the transaction queue with the priority based on the current pseudo thread scheduling, and mounting the monitoring pseudo thread to the transaction queue with the lowest priority includes the following steps:
step S11, a monitoring pseudo thread is newly added according to a preset rule.
Specifically, the process of adding a monitoring pseudo-thread can be implemented by defining a new monitoring transaction queue with the lowest priority in the code of the pseudo-thread scheduler, wherein the new monitoring transaction queue is used for storing Monitor transactions. In particular, the process of adding a dummy thread scheduling monitoring transaction queue with the lowest priority may be performed in other manners in the prior art, which is not limited by the present invention.
And step S12, triggering the monitoring pseudo thread, and mounting the monitoring pseudo thread into a transaction queue with the lowest priority.
Specifically, the process of triggering the monitoring of the pseudo-thread may be implemented by predefined in the code of the pseudo-thread scheduler. When the execution of the Monitor pseudo thread is triggered, a transaction of the Monitor pseudo thread is created according to a preset mode in the code, and is mounted in a transaction queue with the lowest priority. In particular, the process of triggering the monitoring pseudo-thread and mounting the monitoring pseudo-thread to the transaction queue with the lowest priority may be performed in other manners in the prior art, which is not limited by the present invention.
And S13, setting the value of the last calling time parameter of the monitoring pseudo thread to 0.
Specifically, setting the value of the last_time field to 0 can be used as a flag of an initial state.
As an alternative embodiment of the present invention, as shown in fig. 3, the obtaining the current time and the last call time of the monitoring pseudo thread, and calculating the time difference between the current time and the value of the last call time parameter, includes the following steps:
and S21, acquiring the current time and the last calling time of the monitoring pseudo thread.
Specifically, in the pseudo-thread scheduling, the current time may be obtained using a related function or class provided by the system, and at the same time, the Last call time of the Monitor pseudo-thread may be obtained through the last_time field.
Illustratively, the method of obtaining the current time may be performed by using a system function, using a system class, using an operating system call, using a third party library, and the like. In particular, the current time may also be obtained by other methods in the prior art, which the present invention is not limited to.
And S22, when the last call time of the monitoring pseudo thread is 0, setting the value of the last call time parameter of the monitoring pseudo thread as the current time.
Specifically, when the value of the last_time field is 0, it can be judged that the Monitor pseudo-thread has not been called yet, and the scheduling process flow of the pseudo-thread scheduling mechanism just begins, and the system is in an initial state, at this time, the initial value is given to the Last calling time of the Monitor pseudo-thread, which can be regarded as executing the equivalent processing of the Monitor pseudo-thread transaction once when the scheduling process of the pseudo-thread begins.
Step S23, when the last call time of the monitoring pseudo thread is not 0, calculating the time difference between the current time and the value of the last call time parameter.
In particular, the process of calculating the time difference between the current time and the value of the last call time parameter may be implemented by a subtraction operation. The particular calculation method will depend on the form and accuracy of the representation of the time. Further, it may be necessary to convert the time difference into an appropriate time unit, such as seconds, milliseconds, minutes, etc., or to perform formatting and processing, depending on the actual situation. Further, the calculation and processing of the time difference may involve factors such as time zone, daylight savings time, and the like. In performing the calculation and processing of the time differences, it is ensured that these factors are properly processed to obtain accurate results. In particular, the process of calculating the time difference between the current time and the value of the last call time parameter may also be performed in other manners in the prior art, which is not limited by the present invention.
In one embodiment, the predetermined time difference threshold may be obtained by a predetermined calculation method. Specifically, the time difference threshold may be calculated by a timeout value and the number of alarms that are not scheduled for a long time by a preset Monitor dummy thread.
For example, a Timeout value that a dummy thread has not been scheduled for a long time may be recorded as a Timeout field. Further, the number of alarms may be recorded as an alarm count parameter. The alarm count parameter may be recorded as a warn_count field, which is used to record the number of alarms that have sent out a notification of the pseudo-thread scheduling busy information. The time difference threshold may be calculated by (warn_count+1) ×timeout to indicate that a Timeout has elapsed after several warnings have been issued.
As an alternative embodiment of the present invention, as shown in fig. 4, the adding an alert pseudo thread, and mounting the alert pseudo thread to the end of the transaction queue with the highest priority, includes the following steps:
step S31, judging whether the alarm pseudo thread exists or not based on the alarm pseudo thread existence parameters of the pseudo thread queue.
The alarm pseudo-thread existence parameter indicates whether a Notification pseudo-thread is added in a pseudo-thread scheduling queue with the highest priority. For example, the alert pseudo-thread presence parameter may be recorded as a notification_exist field, where a value of the notification_exist field is 1 indicates that a Notification pseudo-thread has been added, and a value of the notification_exist field is 0 indicates that no Notification pseudo-thread has been added.
And step S32, triggering the alarm pseudo thread when the alarm pseudo thread does not exist, and mounting the alarm pseudo thread to the tail of the transaction queue with the highest priority.
Specifically, when the alert pseudo thread does not exist, the process of triggering the alert pseudo thread may be implemented by predefined in the code of the pseudo thread scheduler. When the execution of the Notification pseudo thread is triggered, creating a transaction of the Notification pseudo thread according to a preset mode in the code, and mounting the transaction to the tail end of the transaction queue with the highest priority. In particular, the process of triggering the alert pseudo-thread and mounting the alert pseudo-thread to the end of the transaction queue with the highest priority may also be performed in other manners in the prior art, which is not limited in the present invention.
And step S33, setting the existence parameters of the alarm pseudo threads to values representing the existence of the alarm pseudo threads according to preset rules.
The notification_exist field is illustratively set to a value of 1.
As an optional embodiment of the present invention, as shown in fig. 5, when the alert pseudo thread is a currently executing transaction, notifying that the current pseudo thread scheduling status is busy includes:
step S41, the transaction currently being executed is acquired.
In particular, the process of retrieving a transaction currently executing may be implemented by using global variables, using thread local variables, using context objects, using a scheduler interface, and so on. In particular, the process of obtaining the currently executing transaction may also be performed in other manners known in the art, which is not limited by the present invention.
In step S411, when the currently executing transaction is the alert pseudo thread, parameters of a pseudo thread queue are obtained according to a preset rule.
Specifically, the obtained parameters of the pseudo-thread queue are used for providing key information for the service module or the user, so that the service module or the user can perform proper intervention. The parameters of the pseudo-thread queue can comprise the execution times of the execution count parameter records, the alarm times of the alarm count parameter records and the like, and can be selected according to specific requirements and system design.
Illustratively, the execution Count parameter may be recorded as a Count [ N ] field for recording the number of times a pseudo-thread transaction is scheduled in each priority queue.
Step S412, announce the current pseudo-thread scheduling status as busy and parameters of the pseudo-thread queue.
Illustratively, the process of advertising the current pseudo-thread scheduling status as busy and parameters of the pseudo-thread queue may be performed by using logging, sending time or messages, using callback functions, sending system notifications or alarms, and the like. In particular, the process of advertising the current pseudo-thread scheduling status as busy and the parameters of the pseudo-thread queue may also be performed in other manners known in the art, which is not limited by the present invention.
In step S413, the value of the alarm count parameter of the pseudo thread queue is increased by one.
Illustratively, the value of the Warn_ count field is incremented by one.
Step S414, setting the alert pseudo-thread presence parameter to a value indicating that the alert pseudo-thread does not exist according to a preset rule.
Illustratively, the value of the notification_exist field is set to 0.
In step S415, the pseudo thread scheduling mechanism is circularly executed.
In an embodiment, the method for monitoring and alarming during pseudo-thread scheduling, as shown in fig. 5, further includes the following steps:
step S421, when the currently executing transaction is the monitoring pseudo thread, the current time is acquired.
Specifically, when the transaction currently being executed is a Monitor pseudo-thread, the current time is obtained using a correlation function or class provided by the system.
Step S422, setting the value of the last call time parameter of the monitoring pseudo thread as the current time.
Illustratively, the value of the last_time field is set to the current time.
Step S423 resets the execution count parameter and the alarm count parameter of the pseudo thread queue.
Illustratively, the value of the Count [ N ] field is set to 0. Similarly, the value of the Warn_ count field is set to 0.
And step 424, triggering a monitoring pseudo thread, and mounting the monitoring pseudo thread into a transaction queue with the lowest priority.
Specifically, the process of triggering the monitoring of the pseudo-thread may be implemented by predefined in the code of the pseudo-thread scheduler. When the execution of the Monitor pseudo thread is triggered, a transaction of the Monitor pseudo thread is created according to a preset mode in the code, and is mounted in a transaction queue with the lowest priority. In particular, the process of triggering the monitoring pseudo-thread and mounting the monitoring pseudo-thread to the transaction queue with the lowest priority may be performed in other manners in the prior art, which is not limited by the present invention.
In step S425, the pseudo-thread scheduling mechanism is circularly executed.
In an embodiment, the method for monitoring and alarming during pseudo-thread scheduling, as shown in fig. 5, further includes the following steps:
in step S431, when the currently executing transaction is not the alert pseudo thread or the monitoring pseudo thread, the transaction is normally processed.
Specifically, when the currently executing transaction is not a Monitor pseudo-thread or a Notification pseudo-thread, the currently executing transaction is processed in a manner preset in the code of the pseudo-thread scheduler.
Step S432, adding one to the value of the execution count parameter of the queue to which the pseudo thread belongs.
Illustratively, the value of the corresponding field in Count [ N ] is incremented by one.
Step S433, the pseudo-thread scheduling mechanism is circularly executed.
In an embodiment, the pseudo-thread scheduling monitoring alarm method may be as shown in fig. 6.
According to the pseudo-thread scheduling monitoring alarm method provided by the invention, the preset time difference threshold is calculated by using the preset method, so that the alarm frequency can be flexibly modified according to actual conditions. By recording the execution times and the alarming times, the alarming information is more comprehensive, and the user or the service module can process properly. In the pseudo thread scheduling monitoring alarm method provided by the invention, in the pseudo thread scheduling mechanism based on priority scheduling, when the pseudo thread scheduling mechanism is busy, the busy information of the pseudo thread scheduling mechanism can be rapidly announced, and a user or a service module can be assisted to rapidly locate the reason that the pseudo thread scheduling mechanism is busy.
The embodiment of the invention also provides a pseudo-thread scheduling monitoring alarm device, as shown in fig. 7, comprising:
the monitoring and mounting module 1 is used for adding a monitoring pseudo thread based on a priority transaction queue scheduled by the current pseudo thread and mounting the monitoring pseudo thread into the transaction queue with the lowest priority; the specific details refer to the corresponding parts of step S1 in the above method embodiments, and are not described herein.
The time difference calculation module 2 is used for acquiring the current time and the last call time of the monitoring pseudo thread and calculating the time difference between the current time and the last call time; the specific details refer to the corresponding parts of step S2 in the above method embodiments, and are not described herein.
The alarm mounting module 3 is used for adding an alarm pseudo thread when the time difference is larger than a preset time difference threshold value, and mounting the alarm pseudo thread to the tail of the transaction queue with the highest priority; the specific details refer to the corresponding parts of step S3 in the above method embodiments, and are not described herein.
The alarm notification module 4 is configured to notify that the current scheduling state of the pseudo thread is busy when the alarm pseudo thread is a currently executing transaction; the specific details refer to the corresponding parts of step S4 in the above method embodiments, and are not described herein.
The description of the function of the pseudo thread scheduling monitoring alarm device provided by the embodiment of the present invention is detailed with reference to the description of the pseudo thread scheduling monitoring alarm method in the above embodiment, and will not be repeated here.
The pseudo-thread scheduling monitoring alarm device provided by the invention can accurately judge whether the transaction queue is idle or not by adding a monitoring pseudo-thread. By calculating the time difference between the current time and the last calling time of the monitoring pseudo thread, the time of how long the transaction queue has elapsed since the last idle time can be obtained, and therefore the time difference is used as a judging basis for judging whether the transaction queue is busy. By adding a new alarm pseudo thread and mounting the alarm pseudo thread at the tail of the transaction queue with the highest priority, the busy condition of the pseudo thread can be timely alarmed, and meanwhile, the busy information of the pseudo thread scheduling mechanism is announced to a user or a service module. By informing the user or the service module that the current pseudo-thread scheduling state is busy, timely feedback of the previous pseudo-thread scheduling state can be realized, and the defect that the current pseudo-thread scheduling state cannot be perceived quickly in the prior art is overcome.
The embodiment of the present invention further provides an electronic device, as shown in fig. 8, where the electronic device may include a processor 201 and a memory 202, where the processor 201 and the memory 202 may be connected by a bus or other means, and in fig. 8, the connection is exemplified by a bus.
The processor 201 may be a central processing unit (Central Processing Unit, CPU). The processor 201 may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), field programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above.
The memory 202 is used as a non-transitory computer readable storage medium for storing non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the pseudo-thread scheduling monitoring alarm method in the embodiment of the invention. The processor 201 executes various functional applications of the processor and data processing by running non-transitory software programs, instructions, and modules stored in the memory 202, that is, implements the pseudo-thread scheduling monitoring alert method in the above-described method embodiments.
Memory 202 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created by the processor 201, etc. In addition, memory 202 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 202 may optionally include memory located remotely from processor 201, which may be connected to processor 201 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
One or more modules are stored in the memory 202 that, when executed by the processor 201, perform the pseudo-thread scheduling monitoring alert method in the embodiment shown in fig. 1.
Specific details of the electronic device may be understood in response to the corresponding relevant descriptions and effects in the embodiment shown in fig. 1, which are not described herein.
The embodiment of the present invention further provides a computer readable storage medium, as shown in fig. 9, on which a computer program 301 is stored, which when executed by a processor, implements the steps of a pseudo-thread scheduling monitoring alarm method in the above embodiment. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
It will be appreciated by those skilled in the art that implementing all or part of the above-described embodiment method may be implemented by a computer program to instruct related hardware, where the program may be stored in a computer readable storage medium, and the program may include the above-described embodiment method when executed. Wherein the storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
Although the exemplary embodiments and their advantages have been described in detail, those skilled in the art may make various changes, substitutions and alterations to these embodiments without departing from the spirit of the invention and the scope of protection as defined by the appended claims. For other examples, one of ordinary skill in the art will readily appreciate that the order of the process steps may be varied while remaining within the scope of the present invention.
Furthermore, the scope of the present application is not intended to be limited to the particular embodiments of the process, machine, manufacture, composition of matter, means, methods and steps described in the specification. From the present disclosure, it will be readily understood by those of ordinary skill in the art that processes, machines, manufacture, compositions of matter, means, methods, or steps, presently existing or later to be developed that perform substantially the same function or achieve substantially the same result as the corresponding embodiments described herein may be utilized according to the present disclosure. Accordingly, the appended claims are intended to include within their scope such processes, machines, manufacture, compositions of matter, means, methods, or steps.

Claims (10)

1. A pseudo-thread scheduling monitoring alarm method is characterized by comprising the following steps:
based on a priority transaction queue scheduled by a current pseudo thread, a monitoring pseudo thread is newly added, and the monitoring pseudo thread is mounted in the transaction queue with the lowest priority;
acquiring the current time and the last call time of the monitoring pseudo thread, and calculating the time difference between the current time and the last call time;
when the time difference is larger than a preset time difference threshold value, an alarm pseudo thread is newly added, and the alarm pseudo thread is mounted at the tail of a transaction queue with highest priority;
and when the alarm pseudo thread is a currently executing transaction, informing that the current pseudo thread scheduling state is busy.
2. The method for monitoring and alarming for pseudo-thread scheduling according to claim 1, wherein the adding a monitoring pseudo-thread based on the priority transaction queue of the current pseudo-thread scheduling, and mounting the monitoring pseudo-thread to the transaction queue with the lowest priority comprises:
adding a monitoring pseudo thread according to a preset rule;
triggering the monitoring pseudo thread, and mounting the monitoring pseudo thread into a transaction queue with the lowest priority;
and setting the value of the last call time parameter of the monitoring pseudo thread to 0.
3. The pseudo-thread scheduling monitoring alert method according to claim 1, wherein the obtaining the current time and the last call time of the monitoring pseudo-thread, calculating the time difference between the current time and the value of the last call time parameter, comprises:
acquiring the current time and the last calling time of the monitoring pseudo thread;
when the last call time of the monitoring pseudo thread is 0, setting the value of the last call time parameter of the monitoring pseudo thread as the current time;
and when the last call time of the monitoring pseudo thread is not 0, calculating the time difference between the current time and the last call time.
4. The method for monitoring and alarming by scheduling pseudo-threads according to claim 1, wherein the adding an alarm pseudo-thread, mounting the alarm pseudo-thread to the end of the transaction queue with the highest priority, comprises:
judging whether the alarm pseudo thread exists or not based on the alarm pseudo thread existence parameters of the pseudo thread queue;
when the alarm pseudo thread does not exist, triggering the alarm pseudo thread, and mounting the alarm pseudo thread to the tail of a transaction queue with highest priority;
and setting the existence parameters of the alarm pseudo thread to a value representing the existence of the alarm pseudo thread according to a preset rule.
5. The method of claim 4, wherein when the alert pseudo-thread is a currently executing transaction, advertising that a current pseudo-thread scheduling status is busy comprises:
acquiring a transaction currently being executed;
when the currently executing transaction is the alarm pseudo thread, acquiring parameters of a pseudo thread queue according to a preset rule;
informing the current pseudo-thread scheduling state as busy and parameters of the pseudo-thread queue;
adding one to the value of the alarm counting parameter of the pseudo thread queue;
setting the existence parameters of the alarm pseudo thread to a value representing that the alarm pseudo thread does not exist according to a preset rule;
a pseudo-thread scheduling mechanism is executed in a loop.
6. The pseudo-thread scheduling monitoring alarm method of claim 5 further comprising:
when the currently executing transaction is the monitoring pseudo thread, acquiring the current time;
setting the value of the last call time parameter of the monitoring pseudo thread as the current time;
resetting an execution count parameter and an alarm count parameter of the pseudo thread queue;
triggering a monitoring pseudo thread, and mounting the monitoring pseudo thread into a transaction queue with the lowest priority;
a pseudo-thread scheduling mechanism is executed in a loop.
7. The pseudo-thread scheduling monitoring alarm method of claim 6 further comprising:
when the currently executing transaction is not the alarm pseudo thread or the monitoring pseudo thread, normally processing the transaction;
adding one to the value of the execution count parameter of the queue to which the pseudo thread belongs;
a pseudo-thread scheduling mechanism is executed in a loop.
8. A pseudo-thread scheduling monitor and alarm device, comprising:
the monitoring and mounting module is used for newly adding a monitoring pseudo thread based on a priority transaction queue scheduled by the current pseudo thread and mounting the monitoring pseudo thread into the transaction queue with the lowest priority;
the time difference calculation module is used for acquiring the current time and the last call time of the monitoring pseudo thread and calculating the time difference between the current time and the last call time;
the alarm mounting module is used for adding an alarm pseudo thread when the time difference is larger than a preset time difference threshold value, and mounting the alarm pseudo thread to the tail of the transaction queue with the highest priority;
and the busy notification module is used for notifying that the current pseudo thread scheduling state is busy when the alarm pseudo thread is the currently executing transaction.
9. An electronic device, comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the steps of the pseudo-thread scheduling monitoring alert method according to any one of claims 1 to 7.
10. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the pseudo thread scheduling monitoring alert method according to any one of claims 1-7.
CN202311396548.8A 2023-10-26 2023-10-26 Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium Active CN117149582B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311396548.8A CN117149582B (en) 2023-10-26 2023-10-26 Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311396548.8A CN117149582B (en) 2023-10-26 2023-10-26 Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN117149582A true CN117149582A (en) 2023-12-01
CN117149582B CN117149582B (en) 2024-01-23

Family

ID=88884534

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311396548.8A Active CN117149582B (en) 2023-10-26 2023-10-26 Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117149582B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103905533A (en) * 2014-03-13 2014-07-02 广州杰赛科技股份有限公司 Distributed type alarm monitoring method and system based on cloud storage
US8954968B1 (en) * 2011-08-03 2015-02-10 Juniper Networks, Inc. Measuring by the kernel the amount of time a monitored thread spends in a queue in order to monitor scheduler delays in a computing device
CN115718652A (en) * 2022-11-24 2023-02-28 中盈优创资讯科技有限公司 Method and device for controlling scheduling algorithm and visually monitoring
CN116069518A (en) * 2021-11-03 2023-05-05 网联清算有限公司 Dynamic allocation processing task method and device, electronic equipment and readable storage medium
CN116560834A (en) * 2023-04-19 2023-08-08 上海中通吉网络技术有限公司 Method and device for built-in monitoring alarm of dynamic thread pool

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8954968B1 (en) * 2011-08-03 2015-02-10 Juniper Networks, Inc. Measuring by the kernel the amount of time a monitored thread spends in a queue in order to monitor scheduler delays in a computing device
CN103905533A (en) * 2014-03-13 2014-07-02 广州杰赛科技股份有限公司 Distributed type alarm monitoring method and system based on cloud storage
CN116069518A (en) * 2021-11-03 2023-05-05 网联清算有限公司 Dynamic allocation processing task method and device, electronic equipment and readable storage medium
CN115718652A (en) * 2022-11-24 2023-02-28 中盈优创资讯科技有限公司 Method and device for controlling scheduling algorithm and visually monitoring
CN116560834A (en) * 2023-04-19 2023-08-08 上海中通吉网络技术有限公司 Method and device for built-in monitoring alarm of dynamic thread pool

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
徐金波;常俊胜;李琰;: "支持多优先级多输出通道的数据队列调度方法和硬件实现", 计算机工程与科学, no. 10 *

Also Published As

Publication number Publication date
CN117149582B (en) 2024-01-23

Similar Documents

Publication Publication Date Title
CN109726072B (en) WebLogic server monitoring and alarming method, device and system and computer storage medium
CN107515796B (en) Equipment abnormity monitoring processing method and device
CN110162451B (en) Performance analysis method, performance analysis device, server and storage medium
CN108572898B (en) Method, device, equipment and storage medium for controlling interface
CN110224885B (en) Equipment monitoring alarm method and device, storage medium and electronic equipment
CN108845912B (en) Service interface calls the alarm method of failure and calculates equipment
CN103810823A (en) Alarm processing method and device
CN117149582B (en) Pseudo-thread scheduling monitoring alarm method and device, electronic equipment and storage medium
CN110875841A (en) Alarm information pushing method and device and readable storage medium
CN111082986A (en) Alarm notification method and device
CN111949421B (en) SDK calling method, device, electronic equipment and computer readable storage medium
CN111930719B (en) Database access method, device and system
CN110322671B (en) Alarm information processing method and device
CN114500249B (en) Root cause positioning method and device
CN115811459A (en) Alarm marking method and device, electronic equipment and storage medium
CN112181780A (en) Detection and alarm method, device and equipment for containerized platform core component
WO2014040470A1 (en) Alarm message processing method and device
CN113835961A (en) Alarm information monitoring method, device, server and storage medium
CN112068935A (en) Method, device and equipment for monitoring deployment of kubernets program
CN111354174A (en) Alarm method, device, server and readable storage medium
CN110633165A (en) Fault processing method, device, system server and computer readable storage medium
CN111782462B (en) Alarm method and device and electronic equipment
CN110990380B (en) Account information monitoring method and system
CN112052136A (en) Data verification method and device, equipment and storage medium
CN113778783B (en) Intelligent alarm method and system based on monitoring data

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
GR01 Patent grant
GR01 Patent grant