Welcome to my Technical Blog on VxWorks- Real Time Operating System used in majority of Semi Equipment Control systems.
Let me give some briefing on VxWorks, followed by some tips you can use if you get a chance to work with systems which run in this RTOS.
VxWorks is a Real Time Operating System (RTOS) for embedded computers developed by Wind River Systems. It is used in Aerospace, Defense, transport, Medical, Automation devices. It is also widely used to run control systems of SEMI Manufacturing Equipments.
To know more about this special RTOS, take a look at,
The purpose of my blog post is to provide some useful Tips\Notes\methods that you can follow to Identify\Track issues in VxWorks related to Memory Footprint and RTOS Tasks,
VxWorks supports multitasking which enables the system to run any number of tasks. There is no limit on the number of tasks created, as long as sufficient memory is available.
When a task is created, memory is assigned to that task, If any task gets suspended or it runs out of memory, VxWorks system crashes.
The first step for the developer to fix this issue is to identify the source of the error (i.e. where in the code did the Task crashed and why it crashed).
We would not easily find the root cause of the crash, unless we monitor the tasks running in the system. It is a good practice to monitor each task running in the system without affecting other tasks.
Tip #1 Locating Task and identify source of Issue in VxWorks System
Below are the steps for monitoring tasks running in VxWorks system,
- Create a Task dedicated for monitoring purpose; make sure it has low priority.
- By using the Function “taskIdListGet()” get the list of all Active tasks in the system.
- Loop through each task and perform following checks:
- Check whether the task is suspended using the function “taskIsSuspended()”.
- If any task is suspended, print the stack trace and all necessary information about the suspended task which can be used for our analysis.
- Check the stack margin of the task.
- If it is <= zero then stack overflow has occurred, Voila! Print that a stack overflow has occurred along with the task name and stack trace.
Tip #2 Monitor CPU usages in VxWorks system
Below are the steps for monitoring CPU Usage\Memory footprint in your VxWorks System,
Spy command can be used to get CPU usage of each task in the VxWorks System
- Spy command can be given in the telnet window of VxWorks system.
- Syntax of spy command is “spy n,m” where n is the interval in seconds and m is the number of samples collected within an interval. So m number of samples will be collected every n seconds and the CPU usage of each task is printed in the telnet window.
- To stop the spy command, use “spyStop” command.
Hope the above tips would be useful for your development in reducing lead time in fixing issues with memory consumption and RTOS Tasks related Crash.
Overview on the VxWorks System,