bcopy and page faults
In general, is there a correlation between the number of page faults occurred in the system and bcopy's performance? If the page fault is high, will the bcopy's performance become slower? Kindly enlighten me on this. If you can provide a URL that will support your answer, I will really appreciate it. Thank you very much!
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Quoted 3 lines · firnnauriel
In general, is there a correlation between the number of page faults occurred in the system and bcopy's performance?
No.
Quoted 5 lines
If the page fault is high, will the
bcopy's performance become slower? Kindly enlighten me on this. If you can provide a URL that will support your answer, I will really appreciate it. Thank you very much!
bcopy(3) copies stuff inside a process. If the memory areas copied from/to are available in RAM, the copy will go at full speed. If not, there will be delays (due to paging, etc). Now, the system might be paging like mad, but the memory _this_ process requires is available (== full speed bcopy), or there might be almost no paging activity, but the pages required for the copy aren't in RAM (== slowest possible).
PS: Consider using memcpy(3), bcopy is non-standard.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
Quoted 13 lines · Horst von Brand
Quoted 3 lines · firnnauriel
In general, is there a correlation between the number of page faults occurred in the system and bcopy's performance?
No.
Quoted 5 lines
If the page fault is high, will the
bcopy's performance become slower? Kindly enlighten me on this. If you can provide a URL that will support your answer, I will really appreciate it. Thank you very much!
Quoted 13 lines
bcopy(3) copies stuff inside a process. If the memory areas copied from/to are available in RAM, the copy will go at full speed. If not, there will be delays (due to paging, etc). Now, the system might be paging like mad, but the memory _this_ process requires is available (== full speed bcopy), or there might be almost no paging activity, but the pages required for the copy aren't in RAM (== slowest possible).
PS: Consider using memcpy(3), bcopy is non-standard.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
FYI bcopy() can copy overlapping buffers. It does this by determining if the destination buffer is higher or lower than the source buffer. If it's higher, it's an ordinary memcpy() if it's lower, it copies backwards so that it doesn't end up copying what was just copied, etc., the result being junk.
Both can cause page-faulting if the buffers are not in memory. Because bcopy() has some additional starting logic, it might be slower. Some POSIX man-pages claim that it's deprecated and one should use memmove() instead. The Linux man page claims one should use memcpy(), but this is wrong because memcpy cannot successfully copy overlapping buffers.
So, if the buffers overlap, use memmove(). If not use memcpy(). This different usage might alert people who look at the code in the future that there was some special reason for using memmove().
Cheers,
Dick Johnson
Penguin : Linux version 2.6.9 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.