title: order of setting cpu affinity and scheduling on multicore systems (Linux 2.6)
body: <p>I have some doubts regarding the order of setting cpu affinity and scheduling on multicore systems (Linux 2.6)</p>
  
  <p>Suppose (a hypothetical situation) I have a process and I have set it's affinity to core1 and I suspend that process (put in sleep mode) in between, and while it's suspended I change the CPU affinity of this process to core2. Now will this process, run on core1 first and then shifted to core2 when it wakes up or will it be shifted in the background directly to core2?</p>
  
  <p>Something similar like : (If this could be done somehow)
  I create a new entry in the task struct, but put this new process in sleep mode from the beginning. Is this process assigned to some core as per its set affinity, when it is in sleep mode? Or, the process is assigned to some core (as per its affinity) only when it starts running (Then meanwhile when this process was sleepig in the beginning where this process is kept, in the sleep queue for which core) ?</p>
  
  <p>I think each core has its own copy of scheduler and maintains its own ready queue (SMP processors), then which process migrates the processes between cores?</p>
  
  <p>(I could be wrong on some points, may be I am assuming a lot, but thanks to share your knowledge)</p>
  
  <p>Thanks</p>