免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1611 | 回复: 1
打印 上一主题 下一主题

Linux二进制兼容模式是否影响程序执行效率? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-06-06 10:24 |只看该作者 |倒序浏览
摘自http://www.freebsd.org.cn/snap/d ... uxemu-advanced.html
  1. ......
  2.     在FreeBSD内核中有一个Linux内核;由内核提供的能够提供所有服务的各种潜在功能在FreeBSD系统调用表记录和Linux系统调用表记录之间是一样的:文件系统操作,虚拟内存操作,信号发送,System V IPC,...等等。唯一的不同是FreeBSD会得到FreeBSD的胶合功能, 而Linux程序会得到Linux的胶合功能 (大部分老的操作系统只有它们自己的胶合函数, 函数地址在静态全局变量sysent[]结构数据里面, 而不是动态的初始化到进程的proc结构)。

  3. 哪一个是FreeBSD自己的ABI呢?这无关紧要。基本上, 唯一的不同是FreeBSD的胶合功能是被静态连接到内核,而Linux的胶合功能可能是被静态连接到内核,也可能它们通过一个内核模块来访问。

  4. 有一个真正的模拟器吗?没有,它只不过是一个ABI执行机制,不是一个模拟器。

  5. 为什么有时它被叫做“Linux模拟器”? 只是为了更容易地卖出FreeBSD罢了!实际上,历史上从来没有描述这样一种执行机制的名字,FreeBSD并不是真正地运行Linux程序,如果您不编译进代码,或加载一个模块。就需要有一个名字来描述这样一种加载功能--因此就想出了“Linux模拟器”这样一个名字。
复制代码


摘自http://www.freebsd.org/doc/en_US ... uxemu-advanced.html
  1. ... ffect, there is a Linux kernel in the FreeBSD kernel; the various underlying functions that implement all of the services provided by the kernel are identical to both the FreeBSD system call table entries, and the Linux system call table entries: file system operations, virtual memory operations, signal delivery, System V IPC, etc... The only difference is that FreeBSD binaries get the FreeBSD glue functions, and Linux binaries get the Linux glue functions (most older OS's only had their own glue functions: addresses of functions in a static global sysent[] structure array, instead of addresses of functions dereferenced off a dynamically initialized pointer in the proc structure of the process making the call).

  2. Which one is the native FreeBSD ABI? It does not matter. Basically the only difference is that (currently; this could easily be changed in a future release, and probably will be after this) the FreeBSD glue functions are statically linked into the kernel, and the Linux glue functions can be statically linked, or they can be accessed via a kernel module.

  3. Yeah, but is this really emulation? No. It is an ABI implementation, not an emulation. There is no emulator (or simulator, to cut off the next question) involved.

  4. So why is it sometimes called “Linux emulation”? To make it hard to sell FreeBSD! Really, it is because the historical implementation was done at a time when there was really no word other than that to describe what was going on; saying that FreeBSD ran Linux binaries was not true, if you did not compile the code in or load a module, and there needed to be a word to describe what was being loaded--hence “the Linux emulator”.

复制代码


freebsd没有采用模拟的方式对linux程序支持,这一点与vmware、wine之类的模拟器应该不一样。它仅是在freebsd的ABI基础上增加了linux的ABI,这样看来Linux二进制兼容模式与native模式程序运行的机制相同,不该有执行效率的问题,至少不该有很大影响,是不是       

论坛徽章:
0
2 [报告]
发表于 2005-06-06 10:54 |只看该作者

Linux二进制兼容模式是否影响程序执行效率?

个人认为不影响效率。可以认为FreeBSD kernel支持两种ABI,它们是对等的,最终都是产生native process.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP