This invention provides a method and apparatus for dynamic instruction redirection of hardware resources, relating to the technical field of terminal device
resource management. The method includes: real-time collection of
device status information from all connected home terminal devices via the HarmonyOS distributed soft
bus, and screening of candidate idle devices in an idle state; matching the execution architecture requirements of the instruction to be migrated with the underlying
hardware architecture of the candidate idle devices, and selecting candidate compatible devices that support the execution architecture requirements; constructing a priority mechanism for migration instructions based on the HarmonyOS scheduling framework, calculating dynamic priority weights, and combining these weights to call a device performance
evaluation function; constructing a task migration benefit function by comprehensively considering multi-dimensional performance indicators; and finally selecting the optimal target device based on the result of the benefit function. This invention enables the design of a dedicated priority mechanism for cross-
device migration instructions under the HarmonyOS native scheduling framework, thereby achieving efficient scheduling of migration tasks under heterogeneous hardware conditions across multiple devices.