Do Interfaces use shared memory?

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
atena
Member
Posts: 12
Joined: Fri Apr 25, 2014 3:35 pm

Do Interfaces use shared memory?

Post by atena »

Hi all,

I have heard sometimes from colleagues that when using interfaces between two tasks allocated in the same tile, they do not pass the whole data over the interface, but they send a reference to the memory address where the data is. This way, creating interfaces between tasks in a same tile becomes a way to share memory and a really efficient resource.

Nevertheless, I could not read any document where this is described. Could anyone confirm me this fact about interfaces or explain a bit how they work in the behind?

Thanks a LOT!!

Best!


User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

It depends.. Interfaces provide a unified way for calling methods (passing data and synchronising across tasks) but how it works under the bonnet (hood) depends on the specifics.

In general, normal interface calls across tasks do use channels underneath. This allows the compiler to use the channel hardware mechanism to get the core to wait for a comms event.

Distributable tasks are different - the allow the task to be a simple function call, except wrapped in locks to preserve the "CSP"ness of it and keep synchronisation. So no channel ends used if the distributable requirements are met..

You can explicitly send a pointer across an interface call (in which case you'll be limited to tasks on the same tile, which is checked by the compiler) and you can also use a distributable task between two other tasks as a very neat and well behaved shared memory manager..

Take a look at this example.. http://www.xcore.com/forum/viewtopic.php?p=18531#p18531
User avatar
atena
Member
Posts: 12
Joined: Fri Apr 25, 2014 3:35 pm

Post by atena »

Thank you VERY MUCH!
:)