Creating Concurrent Threads

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
lilltroll
XCore Expert
Posts: 955
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Creating Concurrent Threads

Postby lilltroll » Mon Mar 08, 2010 1:56 pm

Can some threads have fewer timeslots than other when using more than 4 treads per core ?

Like

Code: Select all

par{
 par{
  Thread(E); 
  Thread(F);
  Thread(G);
  Thread(H);
   }
 Thread(A); 
 Thread(B);
 Thread(C);

}
Resulting in that Thread A-C runs at 100% speed and thread E-H runs at 25% speed in average.
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am

Postby trousers » Mon Mar 08, 2010 3:18 pm

No, in short.

That code will get you 7 threads all with equal priority (because all threads on the xcore have equal priority). If you want a thread to consume fewer cycles you must make it block on something - a timer, maybe.
Best friends with the code fairy.
User avatar
lilltroll
XCore Expert
Posts: 955
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Postby lilltroll » Mon Mar 08, 2010 5:42 pm

Blocking - intresting.

A thread can pause when it is waiting for an event - you mean that with an timer I could make 3 threads to pause ??
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
Bianco
XCore Expert
Posts: 754
Joined: Thu Dec 10, 2009 6:56 pm

Postby Bianco » Tue Mar 09, 2010 1:22 pm

lilltroll wrote:Blocking - intresting.

A thread can pause when it is waiting for an event - you mean that with an timer I could make 3 threads to pause ??
You can't use a single timer in XC used by three threads.
You can use a timer in each thread to wait (block) for a timer value.
If you want to synchronise them you might want to consider using a master thread and three slave threads.
User avatar
lilltroll
XCore Expert
Posts: 955
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Postby lilltroll » Tue Mar 09, 2010 8:15 pm

Ahaa, then I think I will go for the master thread solution. It's because I would like to use all registers for maximum speed, and that all timing issues gets so simple with channels.
It's the 2+2 channel I2S function that needs to communicate with 2 decimating and 2 interpolating functions. But that sould be easy if I'm not running out of channels.

I think someone showed on the XLINKERS that you can do a 6:th order IIR filter without the need of memorycopies beween registers and RAM with the 12 XMOS registers.
(You have to load one filtercoef from the constant pool before each MAC but that is not devistating at all).

What about the amount of available streaming chan /core, and what about the difference in overhead in the communication between channel and streaming channel ?
Probably not the most confused programmer anymore on the XCORE forum.

Who is online

Users browsing this forum: No registered users and 9 guests