Previous | Next --- Slide 21 of 48
Back to Lecture Thumbnails
kapalani

Who would be responsible for placing related threads on the same processor? I don't think the OS will have any knowledge of whether 2 threads are related in terms of what they are doing. Would it be the compiler's job to perhaps see 2 threads are operating on adjacent portions of an array for example and perhaps add some directives/additional code to tell the operating system to migrate a thread to the same core as another thread that is operating on a neighboring piece of data?

tarabyte

Hi, everyone. I would like some clarification on the last bullet point. I understand why placing related threads on the same processor would be beneficial. Is the reason that placing unrelated threads on different process because if one is bandwidth limited and one is compute limited then we can switch from the thread waiting for memory access and run the compute heavy one instead (hiding memory latency)? When would it be a good strategy to place threads on different processors?

shpeefps

@Tara Yes I'm pretty sure that's the reason. You're basically scheduling two complementary programs to maximize use of the resources. I think placing them on different processes would be useful in cases where you are trying to maintain work balance. For example, even if you have two related programs, but both of them take a really long time, it makes sense to move it to a different processor. Anyone have other examples?