The invention discloses an inter-core
mutual exclusion method, an inter-core communication method, an inter-core interruption method and a terminal.The inter-core
mutual exclusion method comprises the steps that a task is responded to initiate a resource access request, a priority
label of the task is identified, and the task priority is determined according to the priority
label; for the priority
processing task, the priority
processing task obtains a hardware
spin lock through a preset instruction, and if the hardware
spin lock obtaining operation is completed within a preset period, the hardware
spin lock is obtained within a first preset
delay time, and a
watchdog timer is started; for the real-time / best effort
processing task, the real-time / best effort processing task enters an MCS
linked list queuing lock, a thread corresponding to the real-time / best effort processing task performs variable
spinning in a local memory, the MCS
linked list queuing lock is obtained within second preset
delay time, and a
watchdog timer is started; and during the lock
holding period, the watchdog continuously monitors, and if the lock
holding time exceeds a preset multiple of the worst task
execution time, the lock is forcibly released and an alarm is given. According to the inter-core
mutual exclusion method, an MCS
linked list queuing lock is adopted to replace a traditional spin lock when tasks are processed in real time or as much as possible, disordered competitive self-rotation is converted into
FIFO queue waiting, a precursor node only
spins locally and actively notifies a subsequent node, the problems of
bus cache consistency storm and hunger are thoroughly solved, and fairness and predictable
delay of multi-core access are guaranteed.