Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
I assume that you are using a RTOS?. These usually have built in communication between tasks. Of couse you can always use public bit variables to flag between tasks. Can you be more specific on what you are trying to do.
reply no1 is good, you could have binary semaphore (mutex between 2 threads) or a counting semaphore with atomic WAIT(S) and SIGNAL(S). Depending on what you init the S with you can have that many threads accessing the critical section. WAIT(S) decrements S (and lets x threads through, x=current S) and SIGNAL(s) increments.
However reply2 is also good. there are generic wait(S) and signal(S) depending on what you use for coding.
If you are good in java, read :
lee : concurrent programming in java,
it's a bit heavy for reading, but it's very
good. you will understand all synchronization
issues (even quite advance ones)
I think the answer depends on the platform that you will use for the semaphor.
If it is an embebed system, you must think in an RTOS, depending on the micro that you will use, you can find many RTOS framworks (ex. Slavo for PIC, ...)
If you whan to use a PC or something simillar (a PC/104, a Java enabled processor, ...) you can use Languages such Java that disponibilize threads that can be sincronized, and you can use the system timer events.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.