Short answer
No, It is Immpossible.
Long answer
in a general situation, you cannot do this, because processes are not tied to specific kernels. Processes do not have fixed processors, on which they are always guaranteed to work: the operating system depends to a certain extent, which kernel it uses to start a specific process at a certain time. This decision was made by scheduling , and its implementation is OS-specific.
On certain operating systems, you can control how processors are used to retrieve specific processes. Assigning preferred processors is often referred to as processor affinity . Even installing affinitity does not guarantee that the process will always run on the given kernels: ultimately, before the OS (and CPU), you need to decide how planning is done in the future.
Of all the operating systems that I know of, the closest I could think of would be Linux sched_getcpu , which can be used "to determine the processor the calling thread is running on" (see man sched_getcpu ). Even if you check the current processor using this function, the kernel can immediately change the kernel.
jsalonen
source share