1. A code generating method, applied to a scheduling system, wherein the scheduling system comprises a heterogeneous system, a compiler, and an executable code, wherein the executable code is applied to the heterogeneous system, wherein the heterogeneous system comprises an accelerated processor and a central processing unit (CPU), and wherein the method comprises: acquiring, by the compiler, resource information of the accelerated processor and resource information of the CPU in order to generate an operable platform list; identifying accelerable code from first user code according to the resource information of the accelerated processor, wherein the operable platform list comprises all accelerated processors and CPUs; embedding, by the compiler, a hook function and an exception handling function before the accelerable code to form second user code; and compiling, by the compiler, the second user code to obtain the executable code, wherein the executable code comprises executable user code obtained by compiling the hook function and the exception handling function, and first accelerable branch code and second accelerable branch code that are obtained by compiling the accelerable code, wherein the first accelerable branch code is executed by an accelerated processor in the operable platform list, wherein the second accelerable branch code is executed by a CPU in the operable platform list, and wherein a purpose of embedding the hook function and the exception handling function is to use condition control code in the exception handling function to select target processors for the first accelerable branch code and the second accelerable branch code when the hook function is being executed in a process of executing the executable code.