240 likes | 266 Views
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.
E N D
Semaphores -Gajendra Singh
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.
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.”
Architectures • Round Robin • Round Robin with Interrupts • Function Queue Scheduling • RTOS
ISR_A; ISR_B; : : ISR_Z main(){ while(1){ if(A){ // do something} if(B){// do something} : : if(Z){// do something} } }
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.
For 8051 For INTEL 80x86
Advantages • Multiple Semaphores. • As signaling Device