We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The two options are available.
What is the difference in respect of "cost" "speed" and "complexity" for the two method?
When we need more than few mutexs like that, say 100, is the answer different?
Hi amiry,
is there an example to use the bitband for the synchronization? I think the bitband would not be used for the synchronization because we could not know the previous value of the bitband target area although the bitband initiates a read-modify-write transaction (i.e. atomic access). The previous value would show the transaction had succeeded or failed.
Best regards,Yasuhiko Koumoto.
As bitband performs RMW I guess it can serve as primitive mutex.
You are right about don't know what was happend before, however, think of:
Startup:
Select a word and Assign bit1 to Task1, Assign bit2 to Task2...and so on
Task1:
Read all word, if <> 0 resource is taken
Write task1 bit, atomic
Read all word again
if == excactly Task1.bit --> all well. resource is taken by task1.
if <> excactly Task1.bit --> bad. not mine. Clear task1 bit, atomic
try again.
Ha?
ok, thank you. I understood your method. It seems to be performed successfully. However the number of read and write times will be bigger than LDREX/STREX method. As Joseph Yiu said, the benefit of the bitband method would be small.
Best regards,
Yasuhiko Koumoto.