Method and device for destroying threads of multi-core processor
By implementing the thread destruction method on multi-core processors and using inter-core interrupt messages to cause the destroyed thread to destroy the thread stack by itself, the problem of thread destruction lag is solved and the synchronous recycling and safe destruction of thread resources are realized.
Patent Information
- Application Number
- CN202410415849.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-08
- Publication Date
- 2024-10-18
AI Technical Summary
In the existing technology, there is a lag problem in thread destruction in multi-core processors. In particular, the destruction of one's own thread and the destruction of threads running on other cores have serious lag and require additional thread resource overhead.
By implementing the thread destruction method on a multi-core processor, the main thread is used to update the status of the destroyed thread to the state to be destroyed, and send an inter-core interrupt message, so that the destroyed thread destroys the thread stack by itself, unblocks the main thread, and ensures Synchronous recycling of thread resources.
It solves the lag problem of thread destruction, realizes the timely recycling of thread resources, avoids additional thread resource overhead, and ensures the synchronization and safety of thread destruction.
Smart Images

Figure CN118796446A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of thread management, and in particular to a thread destruction method and device for a multi-core processor. Background Art
[0002] In the thread management of embedded operating systems, thread resources are recycled in time through the thread destruction process. In the prior art, all embedded operating systems can achieve synchronous destruction of threads that are not running. For destroying their own threads, many operating systems insert the threads that need to be destroyed into the destruction queue, and the threads that need to be destroyed actively give up the CPU, and the destruction of the threads has a lag. At the same time, a recycling thread is required to handle the destruction queue. IDLE threads are usually used as recycling threads. Since the IDLE thread has a lower priority, the destruction of the thread has a serious lag. If a high-priority daemon thread is created, there is still a certain lag, and additional thread resource overhead is required.
[0003] When destroying threads running on other cores, the operating system usually does the same thing as destroying its own threads. However, the running thread cannot actively give up the CPU, and the recycling thread needs to wait for the destroyed thread to give up the CPU before it can complete the thread destruction. Therefore, there is a serious lag in destroying the own thread and destroying the threads running on other cores. Summary of the invention
[0004] In view of this, the present application provides a thread destruction method and device for a multi-core processor to solve the hysteresis problem of destroying its own thread and destroying threads running on other cores.
[0005] In a first aspect, an embodiment of the present application provides a thread destruction method of a multi-core processor, wherein the multi-core processor comprises at least: a first processor and a second processor, wherein a first thread runs on the first processor and a second thread runs on the second processor, comprising:
[0006] In response to the destruction instruction of the second thread, updating the state of the second thread to a to-be-destroyed state through the first thread;
[0007] Updating the state of the first thread to a blocked state;
[0008] When it is determined that the second processor receives the inter-core interrupt message sent by the first processor; using the second thread to run a thread destruction program to destroy the second thread;
[0009] The blocking state of the first thread is released by the second thread.
[0010] In a possible implementation, after updating the state of the first thread to a blocked state, the method further includes:
[0011] Adding the first thread to the blocking queue of the second thread;
[0012] Controlling the first processor to send an inter-core interrupt message to the second processor;
[0013] The first thread is suspended to make the first thread yield the first processor.
[0014] In one possible implementation, after determining that the second processor receives the inter-core interrupt message sent by the first processor, the method includes:
[0015] Determine whether the state of the second thread is to be destroyed;
[0016] If it is determined that the state of the second thread is to be destroyed, the thread scheduler is run to make the second thread yield the second processor.
[0017] In a possible implementation, using the second thread to run a thread destruction program to destroy the second thread includes:
[0018] Pointing the pointer of the thread stack of the second thread to the independent stack space;
[0019] The thread destruction program is executed to release the thread stack of the second thread.
[0020] In a possible implementation, releasing the blocking state of the first thread by the second thread includes:
[0021] Deleting the first thread from the blocking queue of the second thread;
[0022] The state of the first thread is updated to a ready state.
[0023] The thread scheduler is run to allocate the first processor to the first thread, so that the first thread enters a running state.
[0024] In a possible implementation, after executing the thread scheduler to allocate the first processor to the first thread, the method further includes:
[0025] When the first thread terminates and enters a to-be-deregistered state, the pointer of the thread stack of the first thread is pointed to an independent stack space, and the thread destruction program is run to release the thread stack of the first thread.
[0026] In a possible implementation, before responding to the destroy instruction of the second thread, the method further includes:
[0027] It is determined that the second thread is terminated, or it is determined that the second thread is an abnormal thread.
[0028] In a second aspect, an embodiment of the present application provides a thread destruction device for a multi-core processor, wherein the multi-core processor comprises at least: a first processor and a second processor, wherein a first thread runs on the first processor and a second thread runs on the second processor, including:
[0029] A first processing unit, configured to update the state of the second thread to a to-be-destroyed state through the first thread in response to a destroy instruction of the second thread;
[0030] A second processing unit, configured to update the state of the first thread to a blocked state;
[0031] a destroying unit, configured to, when determining that the second processor receives the inter-core interrupt message sent by the first processor, use the second thread to run a thread destroying program to destroy the second thread;
[0032] The third processing unit is configured to release the blocking state of the first thread through the second thread.
[0033] In a third aspect, an embodiment of the present application provides an electronic device comprising: a memory, a multi-core processor, and a computer program stored in the memory and executable on the multi-core processor, wherein the multi-core processor implements the method of the embodiment of the present application when executing the computer program.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method of the embodiment of the present application is implemented.
[0035] This application can implement a synchronous mode of thread destruction, solving the hysteresis problem of cross-core thread destruction. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0037] Figure 1 A flowchart of a thread destruction method for a multi-core processor provided in an embodiment of the present application;
[0038] Figure 2 A flowchart of an application example of cross-core thread destruction provided in an embodiment of the present application;
[0039] Figure 3 A functional structure diagram of a thread destroying device for a multi-core processor provided in an embodiment of the present application;
[0040] Figure 4 A functional structure diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0042] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0043] First, the design concept of the embodiments of the present application is briefly introduced.
[0044] In the thread management of embedded operating systems, thread destruction mainly realizes the timely recovery of thread resources. Thread resources mainly include thread control blocks, thread IDs, thread stacks, etc.
[0045] Thread destruction usually involves directly executing the destruction for threads that can be destroyed immediately. For threads that cannot be destroyed immediately (running threads), they are hung on a destruction queue, and another thread polls the destruction queue to destroy the threads on the destruction queue.
[0046] Thread destruction mainly includes the following scenarios: destroying non-running threads, destroying own threads, and destroying threads running on other cores.
[0047] Embedded operating systems can achieve synchronous destruction of threads that are not running.
[0048] When destroying their own threads, many operating systems insert the destroyed threads into the destruction queue, and then the threads actively give up the CPU, so the thread destruction has a lag. At the same time, inserting the thread into the destruction queue also requires an additional thread (hereinafter referred to as the "recycling thread") to process the destruction queue. This additional thread can be an IDLE thread. Due to the low priority of the IDLE thread, the thread destruction has a serious lag. It can also be a newly created high-priority daemon thread. This method still has a certain lag and requires additional thread resource overhead.
[0049] When destroying threads running on other cores, the operating system usually does the same thing as destroying its own threads. However, the running thread cannot actively give up the CPU, and the recycling thread needs to wait for the destroyed thread to give up the CPU before the thread destruction can be completed. Waiting for the running thread to actively give up the CPU brings serious lag.
[0050] To this end, the present application proposes a thread destruction method for multi-core processors. The method adopts a synchronous method. The main destroying thread is mounted on the block queue of the destroyed thread, and then an inter-core interrupt is sent to allow the destroyed thread to actively destroy. After the destroyed thread completes self-destruction, the main destroying thread is awakened to complete the entire destruction process. When the thread self-destructs, the thread stack pointer (Stack Pointer, SP) points to an independent queue stack space to ensure that the thread can immediately reclaim its own resources (especially the stack space dynamically allocated by the thread), solving the asynchronous problem of thread self-destruction.
[0051] After introducing the application scenarios and design concepts of the embodiments of the present application, the technical solutions provided by the embodiments of the present application are described below.
[0052] Figure 1 A flowchart of a thread destruction method for a multi-core processor provided in an embodiment of the present application, wherein the multi-core processor includes at least: a first processor and a second processor, the first processor runs a first thread, and the second processor runs a second thread. The first processor and the second processor of this embodiment can be any two processors of the multi-core processor, and are intended to describe the execution steps of using a thread on one core to destroy a thread on another core.
[0053] like Figure 1 As shown, the specific steps of a thread destruction method of a multi-core processor in an embodiment of the present application include steps 101 to 104:
[0054] Step 101: in response to a destroy instruction of the second thread, updating the state of the second thread to a to-be-destroyed state through the first thread;
[0055] Exemplarily, the first thread is the main destroying thread, and the second thread is the destroyed thread. The state to be destroyed, that is, the state of the second thread is "CLOSE".
[0056] Step 102: updating the state of the first thread to a blocked state;
[0057] In this embodiment, when the current task of the first thread is to destroy the second thread, the state of the first thread is updated to the blocked state. The blocked state means that a thread that is being executed will give up the CPU and be temporarily suspended under certain special circumstances, such as being suspended manually or needing to perform time-consuming input and output operations. When blocked, the thread cannot enter the queue. Only when the cause of the blockage is eliminated, the thread will enter the ready state and queue up in the ready queue again. The blocked state is "BLOCK".
[0058] Step 103: when it is determined that the second processor receives the inter-core interrupt message sent by the first processor; using the second thread to run a thread destruction program to destroy the second thread;
[0059] In this embodiment, the first processor is controlled to send an inter-core interrupt message to the second processor, so that the second thread immediately enters self-destruction, thereby overcoming the serious hysteresis problem existing in thread destruction.
[0060] Step 104: Release the blocking state of the first thread through the second thread.
[0061] Exemplarily, when the second thread completes the destruction, the blocking state of the first thread is released, thereby achieving synchronous destruction and ensuring that the destruction is completed safely.
[0062] The multi-core destruction of cross-core running threads in this application adopts a synchronous method to ensure the safe destruction of threads when the thread destruction program is called and returns; by sending an inter-core interrupt message to a thread running on another CPU, the serious lag problem of thread destruction is overcome; a thread on one running core is used to destroy a thread on another core, and no additional recycling thread is required to complete the thread destruction.
[0063] In some embodiments, after updating the state of the first thread to a blocked state, the method further includes:
[0064] Adding the first thread to the blocking queue of the second thread;
[0065] Controlling the first processor to send an inter-core interrupt message to the second processor;
[0066] The first thread is suspended to make the first thread yield the first processor.
[0067] In some embodiments, after determining that the second processor receives the inter-core interrupt message sent by the first processor, the method includes:
[0068] Determine whether the state of the second thread is to be destroyed;
[0069] If it is determined that the state of the second thread is to be destroyed, the thread scheduler is run to make the second thread yield the second processor.
[0070] In this embodiment, the thread scheduling algorithms used by the thread scheduler include the following:
[0071] Preemptive Scheduling: The operating system determines the currently running thread based on the thread priority and time slice. When the time slice is used up or a higher priority thread is ready, the current thread will be preempted and give up CPU resources.
[0072] Round-Robin Scheduling: This is a variant of the preemptive scheduling algorithm. In round-robin scheduling, each thread is assigned a fixed time slice (usually a few milliseconds) during which the thread runs. When the time slice is used up, the operating system puts the current thread at the end of the ready queue and selects the next ready thread to execute.
[0073] Priority Scheduling: This algorithm determines the scheduling order of threads based on their priorities. Threads with higher priorities are executed first, while threads with lower priorities wait. Priorities can be set manually by developers, or the operating system can automatically adjust thread priorities based on some policies.
[0074] Fair Scheduling: tries to ensure that each thread gets a fair share of CPU resources. In fair scheduling, all threads get CPU time in the order in which they are ready. This means that threads that have been waiting longer will get a chance to execute earlier.
[0075] This embodiment does not limit which thread scheduling algorithm is specifically adopted.
[0076] In some embodiments, using the second thread to run a thread destruction program to destroy the second thread includes:
[0077] Pointing the pointer of the thread stack of the second thread to the independent stack space;
[0078] The thread destruction program is executed to release the thread stack of the second thread.
[0079] It should be noted that usually the data used by a thread are local variables, and the address space of the variables is in the thread stack space. Destroying a thread is to release the resources occupied by the thread. Since the thread is still running, the thread stack cannot be released. In order to solve the problem of using its own stack space when the thread is running, the stack pointer is switched to an independent stack space before running the thread destruction program, and then the thread destruction program can be executed to recycle the relevant resources of the thread; no additional recovery thread is required to complete the thread self-destruction.
[0080] In some embodiments, releasing the blocking state of the first thread by the second thread includes:
[0081] Deleting the first thread from the blocking queue of the second thread;
[0082] Updating the state of the first thread to a ready state;
[0083] The thread scheduler is run to allocate the first processor to the first thread, so that the first thread enters a running state.
[0084] After the first thread completes the task of deregistering the second thread, it needs to release the blocking state of the first thread, so that the first thread enters the ready state and waits for the resources of the first processor. When the first thread is allocated with processor resources, the first thread enters the running state and automatically calls its own run method.
[0085] In some embodiments, after executing the thread scheduler to allocate the first processor to the first thread, the method further includes:
[0086] When the first thread terminates and enters a to-be-deregistered state, the pointer of the thread stack of the first thread is pointed to an independent stack space, and the thread destruction program is run to release the thread stack of the first thread.
[0087] In this embodiment, for the self-destructing first thread, in order to solve the problem of using its own stack space when the thread is running, the SP is switched to an independent stack space before executing the thread destruction program, and then the recovery program is executed to recover the relevant resources of the thread. This can ensure that the thread immediately recovers its own resources (especially the stack space dynamically allocated by the thread), solve the asynchronous problem of thread self-destruction, and no additional recovery thread is required to complete the thread self-destruction.
[0088] In some embodiments, before responding to the destroy instruction of the second thread, the method further includes:
[0089] Determine that the second thread is terminated, or determine that the second thread is an abnormal thread. Wherein, the termination of the second thread includes the end of the second thread and the forced interruption of the second thread.
[0090] The specific implementation process of this application is described below in conjunction with a specific application scenario.
[0091] like Figure 2 As shown, for an electronic device with a multi-core processor, thread th0 is running on CPUx, and thread th1 is running on CPUy; the steps of using thread th0 to destroy thread th1 include:
[0092] S1: Thread th0 changes the state of thread th1 to CLOSE;
[0093] S2: Thread th0 changes its state to BLOCK;
[0094] S3: Mount thread th0 to the BLOCK queue of thread th1;
[0095] S4: CPUx sends an inter-core interrupt message to CPUy;
[0096] S5: CPUy responds to the inter-core interrupt message;
[0097] S6: Thread th1 switches SP to an independent stack space;
[0098] S7: Thread th1 completes self-destruction;
[0099] S8: Release the BLOCK state of th0;
[0100] S9: The scheduler makes th1 give up CPUy;
[0101] S10: The status of thread th0 is updated to ready;
[0102] S11: The scheduler assigns thread th0 to CPUx and puts it into running state.
[0103] Based on the same inventive concept, an embodiment of the present application provides a thread destruction device for a multi-core processor, wherein the multi-core processor comprises at least: a first processor and a second processor, wherein the first processor runs a first thread, and the second processor runs a second thread, Figure 3 As shown, the thread destruction device 200 of the multi-core processor provided in the embodiment of the present application at least includes:
[0104] A first processing unit 201 is configured to update the state of the second thread to a to-be-destroyed state through the first thread in response to a destroy instruction of the second thread;
[0105] A second processing unit 202, configured to update the state of the first thread to a blocked state;
[0106] A destroying unit 203 is configured to, when determining that the second processor receives the inter-core interrupt message sent by the first processor, use the second thread to run a thread destroying program to destroy the second thread;
[0107] The third processing unit 204 is configured to release the blocking state of the first thread through the second thread.
[0108] In some embodiments, after updating the state of the first thread to the blocked state, the second processing unit 202 is further configured to:
[0109] Adding the first thread to the blocking queue of the second thread;
[0110] Controlling the first processor to send an inter-core interrupt message to the second processor;
[0111] The first thread is suspended to make the first thread yield the first processor.
[0112] In some embodiments, after determining that the second processor receives the inter-core interrupt message sent by the first processor, the destroying unit 203 is further configured to:
[0113] Determine whether the state of the second thread is to be destroyed;
[0114] If it is determined that the state of the second thread is to be destroyed, the thread scheduler is run to make the second thread yield the second processor.
[0115] In some embodiments, using the second thread to run a thread destruction program to destroy the second thread includes:
[0116] Point the pointer of the running stack of the second thread to the independent stack;
[0117] The thread destruction program is executed to release the execution stack of the second thread.
[0118] In some embodiments, the apparatus further includes: a fourth processing unit, specifically configured to:
[0119] Deleting the first thread from the blocking queue of the second thread;
[0120] Updating the state of the first thread to a ready state;
[0121] The thread scheduler is run to allocate the first processor to the first thread, so that the first thread enters a running state.
[0122] In some embodiments, the apparatus further includes: a fifth processing unit, specifically configured to:
[0123] When the first thread terminates and enters a to-be-deregistered state, the pointer of the thread stack of the first thread is pointed to an independent stack space, and the thread destruction program is run to release the thread stack of the first thread.
[0124] In some embodiments, the apparatus further includes: a determining unit, specifically configured to: determine that the second thread has terminated, or determine that the second thread is an abnormal thread.
[0125] Based on the same inventive concept, the embodiment of the present application also provides an electronic device, such as Figure 4 As shown, it includes: a memory and a processor, wherein the memory stores an executable program, and the processor executes the executable program to implement the steps of the thread destruction method of the multi-core processor provided in the above embodiment. Among them, the processor is a multi-core processor.
[0126] The processor may be a general purpose processor, a digital signal processor, an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field programmable gate array (FPGA), a general purpose array logic (GAL) or any combination thereof. The general purpose processor may be a microprocessor or any conventional processor, etc.
[0127] Since the electronic device introduced in the embodiment of the present application is an electronic device provided with a memory for implementing the thread destruction method of the multi-core processor disclosed in the embodiment of the present application, based on the thread destruction method of the multi-core processor introduced in the embodiment of the present application, the technical personnel in this field can understand the structure and deformation of the electronic device introduced in the embodiment of the present application, so it is not repeated here.
[0128] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the thread destruction method of the multi-core processor provided in the above embodiment are implemented.
[0129] The storage medium in this embodiment may be included in the electronic device, or may exist independently without being installed in the electronic device. The storage medium carries one or more computer programs, and when the one or more computer programs are executed, the steps of the thread destruction method of the multi-core processor provided in the above embodiment are implemented.
[0130] It should be understood that each scheme in this embodiment has the corresponding technical effects in the above method embodiment, which will not be repeated here.
[0131] According to an embodiment of the present application, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. Optionally, the specific examples in this embodiment can refer to the examples described in any embodiment of the present application, and this embodiment is not repeated here. Obviously, it should be understood by those skilled in the art that the above-mentioned modules or steps of the present application can be implemented with a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented with a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from here, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present application is not limited to any specific combination of hardware and software.
[0132] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0133] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other.
[0134] In addition, although each operation is described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or to be performed in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the application. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0135] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
[0136] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.
Claims
1. A thread destruction method for a multi-core processor, the multi-core processor comprising at least: The first processor and the second processor are configured such that a first thread is run on the first processor and a second thread is run on the second processor, and the method includes: In response to the destruction instruction of the second thread, updating the state of the second thread to a to-be-destroyed state through the first thread; Updating the state of the first thread to a blocked state; When it is determined that the second processor receives the inter-core interrupt message sent by the first processor; using the second thread to run a thread destruction program to destroy the second thread; The blocking state of the first thread is released by the second thread.
2. The thread destroying method of a multi-core processor according to claim 1, characterized in that: After updating the state of the first thread to a blocked state, the method further includes: Adding the first thread to the blocking queue of the second thread; Controlling the first processor to send an inter-core interrupt message to the second processor; The first thread is suspended to make the first thread yield the first processor.
3. The thread destroying method of a multi-core processor according to claim 2, characterized in that: After determining that the second processor receives the inter-core interrupt message sent by the first processor, the method includes: Determine whether the state of the second thread is to be destroyed; If it is determined that the state of the second thread is to be destroyed, the thread scheduler is run to make the second thread yield the second processor.
4. The thread destroying method of a multi-core processor according to claim 2, characterized in that: Utilizing the second thread to run a thread destruction program to destroy the second thread includes: Pointing the pointer of the thread stack of the second thread to the independent stack space; The thread destruction program is executed to release the thread stack of the second thread.
5. The thread destroying method of a multi-core processor according to claim 2, characterized in that: Releasing the blocking state of the first thread by the second thread includes: Deleting the first thread from the blocking queue of the second thread; Updating the state of the first thread to a ready state; The thread scheduler is run to allocate the first processor to the first thread, so that the first thread enters a running state.
6. The thread destroying method of a multi-core processor according to claim 5, characterized in that: After running the thread scheduler to allocate the first processor to the first thread, the method further includes: When the first thread terminates and enters a to-be-deregistered state, the pointer of the thread stack of the first thread is pointed to an independent stack space, and the thread destruction program is run to release the thread stack of the first thread.
7. The thread destroying method of a multi-core processor according to claim 1, characterized in that: Before responding to the destroy instruction of the second thread, the method further includes: It is determined that the second thread is terminated, or it is determined that the second thread is an abnormal thread.
8. A thread destroying device for a multi-core processor, the multi-core processor comprising at least: The first processor and the second processor are configured such that a first thread is run on the first processor and a second thread is run on the second processor, and the method includes: A first processing unit, configured to update the state of the second thread to a to-be-destroyed state through the first thread in response to a destroy instruction of the second thread; A second processing unit, configured to update the state of the first thread to a blocked state; a destroying unit, configured to, when determining that the second processor receives the inter-core interrupt message sent by the first processor, use the second thread to run a thread destroying program to destroy the second thread; The third processing unit is configured to release the blocking state of the first thread through the second thread.
9. An electronic device, characterized in that: include: A memory, a multi-core processor, and a computer program stored in the memory and executable on the processor, wherein the multi-core processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
