Hello,
I know that variable sharing is illegal between threads, and threads should always communicate with channels. And i know also that sharing variable between threads in XC will cause compile error except if the variable is read-only.
Anyway, it is still possible in assembler language to access any memory location from different threads. My question is specially adressed to XMOS processor experts or employee.
What append if writing a variable from a thread and reading the same variable from another thread (on the same core) in assembly language :
1) The processor become mad and lead to un unpredictable state
OR
2) The processor still work fine on other tasks but the reading of the variable is unpredictable ,
giving an intermediate value from a write in progress.
OR
3) The reading of the variable correct, ie giving the most recent value that was written at the same location by the other thread
Sharing variable betweed Threads
-
- Member++
- Posts: 31
- Joined: Fri Aug 31, 2012 3:42 pm
-
- XCore Expert
- Posts: 971
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
-
- XCore Expert
- Posts: 754
- Joined: Thu Dec 10, 2009 6:56 pm
He means 3 :)
-
- Member++
- Posts: 31
- Joined: Fri Aug 31, 2012 3:42 pm
Thank bianco. The previous answer was not very clear, this is good to receive help in the things i am interested about.
-
- Respected Member
- Posts: 259
- Joined: Thu Sep 16, 2010 9:15 am
I have used shared memory from XC and assembler. And you can also do it in C. It is a restriction in XC that two or more threads cannot access the same location, unless read-only.
-
- XCore Expert
- Posts: 971
- Joined: Thu Dec 10, 2009 9:20 pm
- Location: Bristol, UK
Thanks! ;)Bianco wrote:He means 3 :)
Sorry, for some reason I read the options as A,B,C, not 1,2,3! Must be working too hard ;)Carpentier wrote:Thank bianco. The previous answer was not very clear, this is good to receive help in the things i am interested about.