11.07.2015 Views

Chapter 2 Real-Time Systems Concepts Foreground/Background ...

Chapter 2 Real-Time Systems Concepts Foreground/Background ...

Chapter 2 Real-Time Systems Concepts Foreground/Background ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

• Disabling and Enabling the Scheduler– If no shared variables or data structures with an ISR, we candisable and enable schedulingvoid Function (void){OSSchedLock();.. /* You can access shared data in here */.OSSchedUnlock();}– Two or more tasks can share data without contention– While the scheduler is locked, interrupts are enable• If the ISR generates a new event which enables a higherpriority, the higher priority will be run when theOSSchedunlock() is called.2-27Semaphores• Semaphores are used to– Control access to a shared resource (mutual exclusion)– Signal the occurrence of an event– Allow two tasks to synchronize their activities• Two types of semaphores– Binary semaphores– Counting semaphores• Three operations of a semaphore– INITIALIZE (called CREATE)– WAIT (called PEND)– SIGNAL (called POST) --Release semaphore• Highest priority task waiting for the semaphore is activized (uCOS-IIsupports this one)• First task that requested the semaphore is activized (FIFO)2-28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!