Limitation of using global variable as semaphore in RTOS

Status
Not open for further replies.

sacrpio

Member level 3
Joined
May 24, 2004
Messages
56
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
500
ANYBODY RTOS EXPERT

DEAR FRIEND,
I WANT TO USE GLOBAL VARIABLE AS A BINARY SEMAPHORE IN ONE MY RTOS PROGRAM. I KNOW IT IS POSSIBLE, BUT I DONOT KNOW THE LIMITATION WITH THIS TYPE OF USE. WHAT ARE THE LIMITATION (EXCLUDING FACILITY OF MUTEX SEMAPHORE) HERE.

THANKS
 

ANYBODY RTOS EXPERT

Actually, "binary semaphore" and "mutex semaphore" are the same. As to implementation - it is the standard rule: you have to ensure atomic operations of test-modify for your semaphore if your system is pre-emptive. In others words, there should be no task switching during operation like "if (mutex==0) then mutex=1;".
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…