vxworks嵌入式操作系统

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Signal
Signals asynchronously alter the control flow of a task. Any task or ISR can raise a signal for a particular task. The task being signaled immediately suspends its current thread of execution and executes the task-specified signal handler routine.
Signal
Signals asynchronously alter the control flow of a task. Any task or ISR can raise a signal for a particular task. The task being signaled immediately suspends its current thread of execution and executes the task-specified signal handler routine.
Task Control Routine
Task
taskSpawn Task Name and ID Routines Task Information Routines Task Deleting Routines Task Control Routines Task Hook Routines
Binary Semaphore - Synchronization
Binary Semaphore - Synchronization
Mutual Semaphore - Recursive Resource Access
Mutual Semaphore - Recursive Resource Access
Sockets
In VxWorks, the basis of intertask communication across the network is sockets. VxWorks supports the Internet protocols TCP and UDP. TCP provides reliable, guaranteed, two-way transmission of data with stream sockets. UDP provides a simple but less robust form of communication.
Message Queues
Wind Message Queue Control
Message Queue Example
Message Queue Example
Message Queue Exaபைடு நூலகம்ple
Message Queues
Pipes
Pipes provide an alternative interface to the message queue facility that goes through the VxWorks I/O system.
Task Spawn
Task Name and ID Routines
Task Information Routines
Task Information Routines
Task Deleting Routines
Task Deleting Routines
Task Control Routines
Semaphores
Highly optimized and provide the fastest intertask communication mechanism in VxWorks. Three types of Wind semaphores: - Binary - Mutual exclusion - Counting
RPC
Remote Procedure Calls (RPC) is a facility that allows a process on a machine to call a procedure that is executed by another process on either the same machine or a remote machine.
Code Reentrancy Solutions
Dynamic Stack Variables Guarded Global and Static Variables Task Variables
Dynamic Stack Variables
Guarded Global and Static Variables
A task’s context is saved in the task control block (TCB).
Task
A task’s context includes: - a thread of execution; that is, the task’s program counter - the CPU registers and (optionally) floating-point registers - I/O assignments for standard input, output, and error - a delay timer - a time-slice timer - kernel control structures - signal handlers - debugging and performance monitoring values
Providing a mutual-exclusion mechanism to prohibit tasks from simultaneously executing critical sections of code.
Task Variables
Intertask Communication
Task Scheduler Control Routines
Task
Task Lock When a task disables the scheduler by calling taskLock(), no priority-based preemption can take place while that task is running.
Multiple tasks can send to and receive from the same message queue. Full-duplex communication between two tasks generally requires two message queues, one for each direction.
嵌入式软件VxWorks编程介绍
邹昕光 哈尔滨工业大学自动化测控所 联系电话:86413531 - 609 E-mail: xgzou@dsp.hit.edu.cn
Agenda
Task Intertask communication ISR
Task
Each task has its own context, which is the CPU environment and system resources that the task sees each time it is scheduled to run by the kernel.
Counting Semaphores
Message Queue
Message queues allow a variable number of messages, each of variable length, to be queued. Tasks and ISRs can send messages to a message queue, and tasks can receive message form a message queue.
Semaphore Control Routines
Binary Semaphore
Binary Semaphore
Binary Semaphore - Mutual Exclusion
Binary Semaphore - Mutual Exclusion
Binary Semaphore - Synchronization
Shared Data Structure Mutual Exclusion Semaphores Message Queues Pipes Network Intertask Communication Signals
Shared Data Structures
Global variables Linear buffers Ring buffers Linked lists Pointers
Task
The default task scheduling algorithm in wind is priority-based preemptive scheduling. Round Robin is an optional algorithm. The wind kernel has 256 priority levels, numbered 0 through 255. Priority 0 is the highest and priority 255 is the lowest.
If the task explicitly blocks or suspends, the scheduler selects the next highest-priority eligible task to execute.
When the preemption-locked task unblocks and begins running again, preemption is again disabled. The taskLock() prevent task context switching, but do not lock out interrupt handling.
Preemptive locks
Less restrictive form of mutual exclusion. No other task is allowed to preemptive the current executing task, ISR are able to execute. Tasks of higher priority are unable to execute until the locking task leaves the critical region.
Task Hook Routines
Shared Code and Reentrancy
A single copy of code executed by multiple tasks is called shared code. A subroutine is reentrant if a single copy of the routine can be called from several task contexts simultaneously without conflict. Modify global or static variables.
Shared Data Structures
Mutual Exclusion
Disable interrupts Disable preemption Resource locking with semaphores
Disable Interrupts
The most powerful method It prevents the system from responding to external events for the duration of these locks. Keep the duration of interrupt lockouts short.
相关文档
最新文档