1 / 23

Semaphores

Semaphores. -Gajendra Singh. SHARED DATA PROBLEM. ATOMIC or CRITICAL SECTION. Interrupt Latency. The longest period of time during which that interrupt is disabled Task code1 :disable interrupt for 125uS. Task code2 :disable interrupt for 250uS.

ahner
Download Presentation

Semaphores

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Semaphores -Gajendra Singh

  2. SHARED DATA PROBLEM

  3. ATOMIC or CRITICAL SECTION

  4. Interrupt Latency • The longest period of time during which that interrupt is disabled • Task code1 :disable interrupt for 125uS. • Task code2 :disable interrupt for 250uS. • Task code3 :critical & need to respond within 625us. • Interprocessor interrupt routine takes 300uS to execute.

  5. Points to be noted • Lets cut the cost and replace uP that runs half as fast. • Similarly adding an extra task might also be awful. • Conclusion: Disabling Interrupts “Not a very good idea.”

  6. Architectures • Round Robin • Round Robin with Interrupts • Function Queue Scheduling • RTOS

  7. ISR_A; ISR_B; : : ISR_Z main(){ while(1){ if(A){ // do something} if(B){// do something} : : if(Z){// do something} } }

  8. Tasks And Data

  9. Shared data Problem with OS

  10. Have a Look:

  11. Reentrancy • Reentrant Functions: can be called by more than one task and still work correctly even if RTOS switches from one task to another in middle of executing one function.

  12. Gray Areas:

  13. For 8051 For INTEL 80x86

  14. Semaphores

  15. Initializing Semaphores

  16. Advantages • Multiple Semaphores. • As signaling Device

  17. DeadLock

More Related