Vxworks中printf()和logMsg()的区别
来源:互联网 发布:it项目管理 pdf 编辑:程序博客网 时间:2024/04/29 17:48
Vxworks中printf()和logMsg()的区别
请问在Vxworks系统中,printf()和logMsg()的本质区别? 为什么在调试状态下printf()有可能引起阻塞,而logMsg不会呢 谢谢!
printf( ) - write a formatted string to the standard output stream (ANSI).
logMsg( ) does not actually perform the output directly to the logging streams, but instead queues the message to the logging task, logMsg( ) can be called from interrupt service routines.
printf()是将信息输出到标准输出设备(STDIN/STDOUT)中,如果此时设备正在工作,那么就会发生阻塞.
logMsg()是使用消息队列的方式,它将信息地址发送到队列,由专门的任务将信息打印出来.
关于LogMsg的工作机理。LogMsg利用消息队列将用户所发的消息传送给LogTask,然后由LogTask将其显示在屏幕或者其他输出设备上。而VxWorks默认的LogTask的任务优先级很高,这就直接导致了任务的切换。
切换是这样发生的,假设用户任务usrTask的优先级是51级(通常要低于网络任务50级,一般在100级以后),而我记忆中的LogTask是1级任 务,仅次于中断响应。
当usrTask调用LogMsg的时候,LogTask解除阻塞状态,获得CPU资源,而usrTask则排队到就绪任务队列去 了。LogTask释放CPU资源后,就绪队列中的第一个任务开始执行,usrTask则继续在就绪队列里等待,呵呵。
所以在通常情况下,在中断处理函数中使用LogMsg就可以了,在任务中使用LogMsg是近乎画蛇添足的举动
printf( ) - write a formatted string to the standard output stream (ANSI).
logMsg( ) does not actually perform the output directly to the logging streams, but instead queues the message to the logging task, logMsg( ) can be called from interrupt service routines.
printf()是将信息输出到标准输出设备(STDIN/STDOUT)中,如果此时设备正在工作,那么就会发生阻塞.
logMsg()是使用消息队列的方式,它将信息地址发送到队列,由专门的任务将信息打印出来.
关于LogMsg的工作机理。LogMsg利用消息队列将用户所发的消息传送给LogTask,然后由LogTask将其显示在屏幕或者其他输出设备上。而VxWorks默认的LogTask的任务优先级很高,这就直接导致了任务的切换。
切换是这样发生的,假设用户任务usrTask的优先级是51级(通常要低于网络任务50级,一般在100级以后),而我记忆中的LogTask是1级任 务,仅次于中断响应。
当usrTask调用LogMsg的时候,LogTask解除阻塞状态,获得CPU资源,而usrTask则排队到就绪任务队列去 了。LogTask释放CPU资源后,就绪队列中的第一个任务开始执行,usrTask则继续在就绪队列里等待,呵呵。
所以在通常情况下,在中断处理函数中使用LogMsg就可以了,在任务中使用LogMsg是近乎画蛇添足的举动
0 0
- Vxworks中printf()和logMsg()的区别
- VxWorks中logMsg与printf的区别
- VxWorks中logMsg与printf的区别
- VxWorks中logMsg与printf的区别
- vxWorks中的logMsg机制的实现
- 从printk和logMsg看linux和vxworks的设计理念差异
- C中printf 和write的区别
- vxWorks的ld()和loadModule()的区别?
- VxWorks上tShell和hostshell的区别
- c语言中sprinf和printf的区别
- printf和cout的区别
- snprintf和printf的区别
- printf()和cout的区别
- puts 和printf 的区别
- cout和printf的区别
- printk和printf的区别
- cout和printf的区别
- printk和printf的区别
- 抽象工厂设计模式(Abstract Factory Design Pattern)
- 解决错误 Some projects cannot be imported because they already exist in the workspace
- 一些数论的公式
- 我工作常用的软件
- 3款开源的微信公众平台对比
- Vxworks中printf()和logMsg()的区别
- o2o商场
- 好名字大全
- 我很伤心
- 小云桌面发布
- 多线程
- MySql指令大全
- iOS内存错误EXC_BAD_ACCESS的解决方法(message sent to deallocated instance)