Reputation: 1370
the program is in the memory and first prosesor executes it, then there is a call to a function which is said to be executed on the other core - how the first core sends the call adres to the other core ? Is there some communication mechanism between the cores other than the shared ram for both?
Upvotes: 0
Views: 45
Reputation: 24907
OK, it's like this. Threads cannot be called, only signaled, and function are not, in general, tied to threads - several threads on several cores may be executing the same function/code.
That said, there is certainly an inter-processor driver that can communicate between cores. This is essential to allow threads to be allocated to cores and also to allow the OS to stop threads when a process terminates.
When inter-core comms is required, the producer thread stores data in shared memory and signals the other core by asserting a hardware-interrupt, so forcing the 'target' core to enter the OS and handle the signaled data.
Essentially, none of this is even remotely trivial and, if you wish to know more/have your brain bent out of shape, look at the scheduler/dispatcher code for linux or sign your life away with M$.
Upvotes: 1