Home |
RTKernel-32 Programming Manual Multitasking, Real-Time, and RTKernel-32 Alternate APIs for RTKernel-32 Resource Management |
Resource ManagementMany errors in multitasking applications have to do with the erroneous (or neglected) management of global resources. Global resources are global variables, files, the screen, the keyboard, etc.; all entities that may be used by more than one task but exist in the system only in one instance. Whenever a task accesses something accessible by other tasks, the programmer must consider what happens when another task simultaneously performs an access. The only safe method to manage data in a controlled manner is the explicit transfer of data from one task (or interrupt handler) to another using mailboxes or message passing, as well as the protection of global resources using semaphores. Resource semaphores are especially suited for this purpose, because they can make sure the synchronization protocol is observed.
|