Continue to Site

Welcome to EDAboard.com

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.

how to implement semaphore?

Status
Not open for further replies.

ahgu

Full Member level 3
Full Member level 3
Joined
Jun 19, 2001
Messages
172
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
1,552
how to implement simple semaphore?

and task threading control?

anywhere I can read on?

thanks
ahgu
 

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.
 

depending for your O.S there is primitive that implement semaphore.
 

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)

tahiti
 

Hi,

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.

Hope helps,

NeuralC
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top