|
Post by achyuthans on Apr 11, 2017 18:23:45 GMT
New to multi-core programming. I wanted to know if 2 cores [say core1 and core2] can call the same function at the same time? I'm not sure if they have separate call stacks. Will this lead to unpredictable behaviour?
|
|
|
Post by Admin on Apr 11, 2017 18:52:41 GMT
Yes you can do this. Although there is only instance of the function, it can be executed simultaneously by 2 or 3 cores. Each core has its own RAM and stacks.
|
|
|
Post by Lockstepper on Apr 9, 2018 11:09:16 GMT
Hello, I asked myself the same question. I am running a performance test to put core0 and core1 in comparison. core0 is efficiency and core1 is for performance.
I run a test function which adds 100000 nodes to a linked list. Before and after the function i toggle a LED and put the result on the oszi. These are my results
core0 needs 35ms core1 needs 14ms
This makes sense but if I ran them at the same time, both need 18ms. Can anybody explain why is that?
|
|
|
Post by Admin on Apr 9, 2018 12:18:09 GMT
First thing to say is that cores 1 & 2 are about 18% faster than core0 due to the extra pipeline stage. This does not explain the timings you have seen though. Was each core using its own data RAM (DSPRx)? If a core uses variables in another core's local DSPRx RAM, the performance is hugely reduced.
If both try to access the same function simultaneously, there is a bottleneck accessing the FLASH memory. To prevent one core (i.e. the faster one) hogging the internal bus, "starvation prevention" is used to make sure that both cores get equal access rights to the flash. This is why both cores show the same run time. In situations like this, it would be a good idea to put frequently called functions into the PSPRx RAM for each core. This is not currently supported in the ShieldBuddy environment but it can be done from Eclipse.
|
|
|
Post by lockstepper on Apr 11, 2018 11:52:09 GMT
I make now sinusoidal calculations with float64. The performance difference is about 18% now. Thank you for your answer!
|
|