Page 1 of 1

atomic operation

Posted: Thu Nov 10, 2011 12:00 pm
by Badhan
Hi guys,
i have a confusion with automic instruction. In the following code , i have a TSL instruction, which works automic. Thats fine. But, my question is, can i conside that the whole tsl_function works automic. (like , these 4 lines will be executed without being interrupted.)

TSL_enter_region:
tsl reg, lock
cmp reg, #0
jne TSL_enter_region
ret


Thanks for your help.

Re: atomic operation

Posted: Thu Nov 10, 2011 12:08 pm
by Badhan
i think , NO. This might be a implementation of Spin-lock. When a Theard is in busy-wait. And , An timer interrupt can occur, which takes this Thread away from this looping(spin-lock).

Am i right?

Re: atomic operation

Posted: Thu Nov 10, 2011 12:51 pm
by gerryg400
Firstly, please take some care with your spelling and capitalisation.
But, my question is, can i conside that the whole tsl_function works automic. (like , these 4 lines will be executed without being interrupted.)
No the entire function is not atomic. It looks like it contains an atomic instruction.
This might be a implementation of Spin-lock. When a Theard is in busy-wait. And , An timer interrupt can occur, which takes this Thread away from this looping(spin-lock).
You are probably correct that it is a spinlock implementation.
Am i right?
It depends. What is your real question ?

Re: atomic operation

Posted: Thu Nov 10, 2011 1:10 pm
by Badhan
Thank you very much . I have got my answer.