home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / aix / 8014 < prev    next >
Encoding:
Text File  |  1992-07-20  |  4.1 KB  |  81 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!newsgate.watson.ibm.com!yktnews!admin!yktnews!prener
  3. From: prener@watson.ibm.com (Dan Prener)
  4. Subject: Re: AIXv3 shared-library binding anomolies
  5. Sender: news@watson.ibm.com (NNTP News Poster)
  6. Message-ID: <PRENER.92Jul21033506@prener.watson.ibm.com>
  7. In-Reply-To: marc@mercutio.ultra.com's message of 20 Jul 92 22:35:21 GMT
  8. Date: Tue, 21 Jul 1992 08:35:06 GMT
  9. Distribution: comp
  10. Disclaimer: This posting represents the poster's views, not necessarily those of IBM
  11. References: <PRENER.92Jul15030511@prener.watson.ibm.com> <1192@curly.appmag.com>
  12.     <PRENER.92Jul18020046@prener.watson.ibm.com>
  13.     <1992Jul18.143244.12523@athena.mit.edu>
  14.     <PRENER.92Jul19022217@prener.watson.ibm.com>
  15.     <1992Jul20.223521.1080@ultra.com>
  16. Nntp-Posting-Host: prener.watson.ibm.com
  17. Organization: IBM T.J. Watson Research Center, Hawthorne, New York
  18. Lines: 61
  19.  
  20. In article <1992Jul20.223521.1080@ultra.com> marc@mercutio.ultra.com (Marc Kwiatkowski {Host Software-AIX}) writes:
  21.  
  22. >In article <PRENER.92Jul19022217@prener.watson.ibm.com> prener@watson.ibm.com (Dan Prener) writes:
  23.  
  24. >>   We are both wrong.  I was thinking of the case of the call using a
  25. >>   function pointer.  That takes 6 cycles, because the function pointer
  26. >>   (i.e., the address of the function descriptor) must be loaded regardless
  27. >>   of whether the function is in a shared library.
  28.  
  29. >There are two separate issues here.  First, the shared libc binds 
  30. >local function calls at load time.  
  31.  
  32. Actually, it binds them at link time.  Is that what you mean by "load time"?
  33. I tend to think of load time as the time "exec" loads the program.
  34.  
  35. >That is, a call by function foo00
  36. >in the libc namespace to function foo01 in the libc namespace gets bound at
  37. >load time.  So, if the program declares a function foo01 in the application
  38. >namespace and then calls foo00, foo00 will still call foo01 in the 
  39. >libc namespace.  In this case, efficiency is an issue, but it is questionable
  40. >whether or not this is a valid area for optimization.  As a comparison,
  41. >imagine someone discovering that they could write a user application that
  42. >could used traps and other protected-mode instructions, and then being told
  43. >by the developers that both kernel and user threads run in protected mode
  44. >because it is more efficient.  While the statement is true, it also
  45. >useless, because, by definition, user threads cannot run in a protected mode.
  46. >Similarly, it is true that static binding of intra-libc function calls
  47. >is more efficient, but by definition application space functions must
  48. >override their libc counterparts, period.  
  49.  
  50. The optimization can, of course, be defeated by linking a non-shared copy
  51. of libc.  The issue can get more complicated with other libraries, since
  52. some other libraries may make use of the tight binding of shared libraries.
  53.  
  54. Just out of curiousity, where is the definition that says that application
  55. space functions must override their libc counterparts?
  56.  
  57. >The second issue is that for inter-libc function calls, the 
  58. >libc search path is also bound at load time.  For example, consider
  59. >an application that uses a shared library libshare.a that redefines 
  60. >the function write().  When the application calls write directly, the
  61. >run-time binding correctly transfers execution to the libshare.a version
  62. >of write(), however, if the application calls printf the run-time binding
  63. >of write() within libc.a does not reevaluate the search path, and so does
  64. >not discover that libshare.a is the correct namespace to use.  This has
  65. >nothing to do with efficiency.  The cost of run-time binding to the 
  66. >libshare.a write() or the /unix write() is exactly the same.
  67.  
  68. This second issue is not orthogonal to the first, though.  Given the
  69. lack of indirection in the current scheme, there is no way the bindings
  70. can be changed at run time.
  71.  
  72. >I am a little skeptical about the claims of improved performance by 
  73. >statically binding inter-library calls to exported functions.  What 
  74. >percentage of all function calls within libc.a are calls to libc.a entry 
  75. >points?
  76.  
  77. The figure would depend on the application.  Statically, I think the
  78. vast majority are.
  79. --
  80.                                    Dan Prener (prener@watson.ibm.com)
  81.