The application discloses a
Java-based micro-
thread management system and method, which comprises a micro-thread class, a
queue, an executor and a scheduler, etc., the micro-thread class defines relevant interfaces, the
queue stores instances, the running state of the
queue is marked by an atomic variable and has multiple states, and there is a life
cycle control module.The management method comprises the following steps: micro-thread instance creation and initialization, queue
insertion and thread awakening, execution
state switching and task execution, dynamic
state management and control, and
priority scheduling strategy execution, etc.The executor comprises a thread cycle and an exception
processing module, the scheduler comprises a dynamic priority chaos mapping module, the exception
processing module has classification
processing and a shadow thread mechanism, etc.The application reduces the resource occupation of a single micro-thread through the cooperation of various components, the queue structure improves the memory
utilization rate, and the priority and execution strategy can be flexibly set through the scheduler and the executor.