Method of mapping between virtual cpu and physical cpu, and electronic device

Disclosed are a method of mapping between a virtual CPU and a physical CPU, and an electronic device, the method comprising: in the current time period, a virtual machine manager obtains a first virtual CPU collection to be mapped and a first physical CPU having the fewest tasks to run in the next time period; the virtual machine manager obtains a first feature value of each first virtual CPU in the first virtual CPU collection and a second feature value of a first physical CPU; the virtual machine manager obtains from all first feature values a target feature value matching the second feature value, and mapping the target virtual CPU corresponding to the target feature value onto the first physical CPU for running. The technical solution solves the technical problems in the prior art of resource competition and overall system performance degradation during the mapping between a virtual CPU and a physical CPU.