VxWorks中logMsg与printf的区别
来源:互联网 发布:ubuntu安装包放在哪里 编辑:程序博客网 时间:2024/05/05 15:23
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可以在中断中使用,好像调用这个函数只是将相关的msg输出到缓冲区,它还有一个守候任务最终负责输出的,这样就可以在中断中使用了.(printf不能在中断中使用!)
the logMsg( ) routine takes a char * rather than a const char * and requires a fixed number of arguments (6).
logMsg()例程中的参数是char*而不是const char*,并且需要固定数目的参数(logMsg最多可接受6个参数,printf可以接受可变数目的参数)
logMsg( ) checks to see whether or not it is running in interupt context. If it is, it will not block. However, if invoked from a task, it can cause the task to block.
logMsg()检查其是否在中断上下文中运行.如果是,它不会进行阻塞(因为logTask的的优先级也);但是,如果其由任务调用,它将阻塞相应的任务(直到msg输出完成)
- VxWorks中logMsg与printf的区别
- VxWorks中logMsg与printf的区别
- VxWorks中logMsg与printf的区别
- Vxworks中printf()和logMsg()的区别
- vxWorks中的logMsg机制的实现
- JAVA 中printf与c的区别
- LINUX中printf与echo的区别
- vxworks 与Linux的区别
- 从printk和logMsg看linux和vxworks的设计理念差异
- java 中print 与printf与println的大致区别
- 浅析VxWorks与Linux操作系统的区别
- gcc中printf/scanf、printf_P/scanf_P的区别与用法
- C51与标准C在printf中标识符的区别
- 黑马程序员------OC中NSLog与printf的区别
- linux shell 中 printf 与 echo的区别
- printf与fprintf的区别
- cout与printf的区别
- print与printf的区别
- IBM
- 验证码
- ao接口通过经纬度求两点距离
- 【嵌入式Linux学习七步曲之第五篇 Linux内核及驱动编程】Linux内核抢占实现机制分析
- ZwSystemDebugControl函数列举系统PCI设备ID
- VxWorks中logMsg与printf的区别
- android中的左右滑屏实现By ViewPager
- 豆瓣书友Pro:这个小三比老婆#豆瓣购书单#好?
- 基于对象的层次结构
- Linux kill多个进程
- SVN修改用户名与密码
- 获取APP的链接
- android定时定位 - 利用百度定位API来实现定时定位功能
- libvirt-java编译安装