Is it possible to get a race condition in clean XC on XCore?

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
aclassifier
Respected Member
Posts: 483
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

Is it possible to get a race condition in clean XC on XCore?

Post by aclassifier »

I have a rather unusual piece of code where I seem to have a race condition between tasks. I can post the code here, but first I just wanted to know if I'm far off in my thinking.

What happens is that a task seems to be rescheduled (with a timerafter "now", the code is in the timerafter case), in such a way that the three interface calls that were just done seems not to be done. I can see this by the previous data set in one of the tasks being unmodified.

If I introduce short delays (with a timerafter "now+1000us" (which isn't terribly short)) at several strategic places places to (one or the other), I guess that in effect it causes a "yield" to happen, then the right thing happens.

There are four tasks and each of them have three client-started only interfaces between them. They could each have their core or two could be combined, the first needs longer delays to "get in synch". Two clients and two servers, connected in a "torus". Which means that all of them have two interfaces with a neighbour. It's to simulate temperature flow, and is not a typical application for XC/XCore at all.

All communication is done over this interface:

Code: Select all

typedef interface conn_if_t {
    temp_degC_t set_get (const temp_degC_t temp_degC);
    // FAIR and SYNCHRONISED and COMBINABLE! Will some times imply more than one polling per round trip:
    bool poll_all_clients_seen (void);
} conn_if_t;
I don't see that I have an application type of race, I am pointing at XC/XCore. I don't think I'll end up pointing at my own nose, but this case isn't settled yet.

I am struggling with all kinds of problems, and have been rather active in issuing tickets to XMOS. But about this hypothesis of a race I though Id'd ask here first.

From my earlier pre-XC life anything that was solvable by introducing a delay in a concurrent system of tasks usually showed the presence of a race condition.

Is this possible for XC/XCore (not application)?


--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
User avatar
aclassifier
Respected Member
Posts: 483
Joined: Wed Apr 25, 2012 8:52 pm
Contact:

Post by aclassifier »

I did have an error in my own application code.

However, I still see differences in behaviour dependent on delay(s), as a function on how I configure with par and combine.

I guess the case of a race condition per se, in XC/XCore has been weakend! This makes me feel much better!
--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
Post Reply