An event distribution method and device applied in a multi-thread system
A multi-threaded, event technology, applied in the field of communication, can solve the problems of resource competition and inability to achieve load balancing at the same time
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
example 1
[0069] Example 1: It is detected that event A is triggered, and it is determined that event A is associated with serialized cache area 1 by querying the identifiers recorded in each serialized cache area. First, query the serialized cache area to which event A belongs Whether there is an allocation mark in 1, the query result is none, and it is determined that the event A is the first event to be triggered in the serialized event group to which it belongs. Then, the event A can be directly assigned to the end of the event queue. If there are no other events in the queue at this time, the event A can be directly called and executed by the corresponding idle thread. Otherwise, it needs to wait in line.
[0070] It should be noted that the serialized buffer area 1 enters the working state when the event A is assigned to the event queue until the event A is executed by the corresponding thread. When the serialization buffer area 1 is in the working state, if other events other tha...
example 2
[0071] Example 2: Based on the execution of the above example 1, it is subsequently detected that event B is triggered, and it is determined that event B is also associated with serialized buffer area 1. Before that, only event A was triggered and has been assigned to the event The queue is waiting to be called and executed by the thread. Therefore, there are no other events cached in the serialized cache area 1. Then, according to the queried allocation mark (after each cached event is allocated to the event queue, it will be in the The allocation mark is set in the corresponding serialization buffer area, indicating that the event has been buffered in this space and has been allocated to the event queue or has been called by the thread), and it is determined that the event is not the string corresponding to the serialization buffer area 1 The first triggered event in the serialization event group; further check whether the serialization buffer area 1 is in the working state, ...
example 3
[0072] Example 3: Based on Example 2, then, it is detected that event C is triggered, and it is determined that event C is also associated with serialized buffer area 1. In fact, the time required for each event to be executed is uncertain. Therefore, in the event After C is triggered, it is necessary to check whether there is an event cached in the serialized cache area 1. If there is an event in the cache, it indicates that an event with a business logic relationship with it is executed at the current moment, and there is an event with a business logic relationship with it Events are buffered in the serialized buffer area 1, and the event C needs to be buffered in the serialized buffer area 1, and waits to be allocated according to the order in which it enters the serialized buffer area 1. For example, if event B is cached in the serialized buffer area 1, after the execution of event A is completed, the serialized buffer area 1 switches to the rest state, and event B can be a...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


