- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
2、Communication between tasks In a multitasking (multithreaded) program, multiple tasks work completely separately. Because they all work in the same application, it will sometimes be necessary for them to exchange information with each other. a、GLOBAL VARIABLES The easiest way to do this is by using global variables. In certain situations, it can make sense for tasks to communicate via global variables, but most of the time this method has various disadvantages. For example, if you want to synchronize a task to start when the value of a global variable changes, you have to poll this variable, wasting precious calculation time and power, and the reaction time depends on how often you poll. b、COMMUNICATION MECHANISMS When multiple tasks work with one another, they often have to: ● exchange data, ● synchronize with another task, or ● make sure that a resource is used by no more than one task at a time. a) Signals Signals represent the simplest and fastest form of task communication. No actual information is exchanged - only a stimulus is activated for a task. These can always be used when a pure task synchronisation is required without data exchange. b) MAILBOXES AND QUEUES A mailbox is basically a data buffer managed by the RTOS and is used for sending a message to a task. A queue works in a similar manner, but handle larger messages than mailboxes, and every message may have a individual size. c) SEMAPHORES In a multi-tasking system there is often competition for resources. When several tasks can use the same portion of memory, the same serial I/O channel or another system resource, you have to find a way to keep the tasks out of each other‘s way. The semaphore is a protocol mechanism, which is used primarily to control access to shared resources (mutual exclusion). By means of the semaphore concept, resources can be shared free of conflicts between the individual tasks. RTX51 是美国Keil 公司开发的一种小型的应用于MCS51 系列单片机的实时多任务操作系统,它的使用可以简化比较复杂、有严格时间限制的软件的设计过程。RTX51主要有两个不同的可用版
文档评论(0)