I run some 32bit applications in 64bit Linux. I find the CPU usage is high, and 3/4 of CPU is spent on "sy" in "top" output window. I don't understand why so much CPU usage is开发者_运维问答 for kernel -- there are not much IO operations in the applications.
So my question is: how about the performance for running 32bit app in 64bit Linux? For example, if the app occupies 10% CPU in 32bit Linux, then will it occupy more CPU in the corresponding 64bit Linux? Does the OS use some software methods to emulate the running environment for applications?
how about the performance for running 32bit app in 64bit Linux?
I think, performance is similar.
For example, if the app occupies 10% CPU in 32bit Linux, then will it occupy more CPU in the corresponding 64bit Linux?
You should split user and system times.
user time will be very same (the same code is running on CPU)
system time may be a bit bigger, because kernel need to translate 32-bit requests from userspace into 64-bit (especially when struct is passed, as in readv
syscall). Also, kernel should switch CPU into 32-bit "legacy" mode (heavier switch_to
or context switch). Kernel should also create a page table in different way.
But if your application spend little time in system calls and does a small number of system calls, performance will be good.
Does the OS use some software methods to emulate the running environment for applications?
No, there is almost no emulation (in case of x86-64/x86, SPARC64/32, PowerPC64/32 and other pairs of archs which uses _compat
technique). Linux kernel does only translation of 32-bit system call interface into internal format using _compat
versions of syscall handlers.
精彩评论