What is more efficient (*.a or *.so) libraries?

Ask a Question related to AIX, Design and Development.

  1. #1

    Default What is more efficient (*.a or *.so) libraries?

    Hi,

    Recently I developed a series of static libraries (*.a files) for
    performing
    various different operations. I used these libraries to create CGI
    script
    applications - however I noticed that when I run the CGI scripts via
    APACHE they were slow. Im wondering whether its because of the
    loading of the *.a files when the CGI script is invoked (i.e. there are
    approx
    2Mb's of *.a files that need to be loaded!).

    My understanding of libaries is very limited - so please bare with me.
    As far as I know *.a files are loaded into memory each time an
    application
    is executed (at runtime). Therefore if you were to run 5 applications
    that referenced the same *.a files then each library would be loaded 5
    times.
    (i.e. the *.a libraries when loaded into memory are not shared between
    applications).

    Assuming the above statement is correct then I would imagine that *.so
    shared objects are more efficient. Would I be correct in thinking that
    if
    5 applications were invoked that referenced the same *.so files then
    only
    one instance of each so (shared object) would be loaded, and once loaded
    it would be shared amongst the other applications. Therefore I the
    system
    is not having to do multiple reads of the same so file. Is this
    assumption
    correct?

    If you have any additional advice / recommendations with regards to
    using shared objects or static libaries please let me know. Anything
    that
    can improve the loading time of the application would be a bonus.

    Best regards

    Spencer


    Spencer Guest

  2. Similar Questions and Discussions

    1. Efficient Table Design
      Hi Guys, I have a 35 records to be store. So which design should I use? 1. Create SIngle table and store all 35 records inside the table 2....
    2. Working Efficient with ID CS
      Hello, A couple of weeks ago I went to a seminar of ID CS Page maker edition. I saw that ID has much more possibilities than Page maker 6.5 which...
    3. Looking for the most EFFICIENT way to do the following...
      I have a table that has links in it. Columns: id, item, link_name, url. I want to run through the recordset of this table and so something like...
    4. Efficient structure
      I have multiple types of information to associate to one object. I have data structures that store data structures. What is the best/most...
    5. Efficient query without using NOT IN clause
      Hi all, I have got two tables:- a) students ======== std_id Numeric std_name Varchar(50) std_grade Varchar(10)
  3. #2

    Default Re: What is more efficient (*.a or *.so) libraries?

    "Spencer" <spickett1234567890@hotmail.com> writes:
    > Recently I developed a series of static libraries (*.a files) for
    > performing
    > various different operations. I used these libraries to create CGI
    > script
    [Please fix your Outlook to use *reasonable* line legth. This
    looks horrible, rest of the message reformatted.]
    > applications - however I noticed that when I run the CGI scripts via
    > APACHE they were slow. Im wondering whether its because of the
    > loading of the *.a files when the CGI script is invoked (i.e. there are
    > approx 2Mb's of *.a files that need to be loaded!).
    If these libraries are truly static, then you are quite wrong:
    they do not get loaded at runtime. Rather, parts of them become
    embedded in the an executable at link time, and you can remove them
    after the exe is built without any ill effect on that executable.

    Also note, that on AIX (unlike on most other UNICes), you can't
    assume that libfoo.a is a static library; it may well be a shared
    library, or even a mixture of shared and static parts. libc.a
    is a prime example of this.
    > My understanding of libaries is very limited - so please bare with me.
    Which part exactly do you want me to bare ?-)
    > As far as I know *.a files are loaded into memory each time an
    > application is executed (at runtime). Therefore if you were
    > to run 5 applications that referenced the same *.a files then
    > each library would be loaded 5 times.
    This is partially correct: running 5 different apps (all using the
    same 2MB archive library) will cause that library to be loaded into
    memory exactly 0 times. However, the *code* from that library, which
    was linked into all of the 5 apps, will be loaded (once for each app,
    if the app actually uses that code).
    > Would I be correct in
    > thinking that if 5 applications were invoked that referenced
    > the same *.so files then only one instance of each so
    >(shared object) would be loaded, and once loaded it would be
    > shared amongst the other applications.
    Yes.
    > Therefore I the system
    > is not having to do multiple reads of the same so file. Is this
    > assumption correct?
    Yes. There is a further benefit: all instances of the 5 apps will
    share memory pages containing executable code of that shared library
    (that's why they are called shared), reducing load on system memory.

    On AIX, there is even further benefit: shared libraries on AIX are
    "sticky" -- once loaded, they stay in memory, and subsequent
    executions of the same (or another) app using a given shared library
    may be significantly faster, then the first one.

    However, creating shared libraries on AIX is a bit of a black art
    (and quite different from most other UNICes), and you'll do well
    to read the paper below before attempting to do that.

    [url]http://www.ibm.com/servers/esdd/pdfs/aix_ll.pdf[/url]

    Finally, you should first measure the time it takes for your CGI
    executable to reach main() [the startup time]. If you discover
    that the exe reaches main in 1 second, and then takes another 59
    to produce its output, then switching to shared libraries will not
    produce any measurable speedup.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Paul Pluzhnikov Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139