Applications are typically loaded in the same manner as shared libraries
(through mmap() on unix), so application code is already shared between
processes using the same executable.  There have even been experimental
versions of linux that would share identical pages from non-identical
executables, so if you linked object files on page boundaries even static
libraries could be shared.  It never caught on through, probably because of
the overhead of maintaining hash tables for every write protected page.

Shared libraries only reduce the memory footprint significantly when
different applications use the same library.


On Wed, Jun 18, 2014 at 5:06 AM, Raistmer the Sorcerer <[email protected]>
wrote:

>  On modern PCs 2 to 16 (or even more, if host has few GPUs installed each
> runs 2 or more tasks simultaneosly) instances of application can work at
> the same time.
> Having non inner loop code reside in shared libs could reduce memory
> footprint and improve L2/3 cache hit ratio. That's how this related to
> applications.
> If BOINC client uses same libs too it allows additionally not distribute
> corresponding shared libs with apps improving download bandwidth
> particularly.
> That's the reason to use dynamic libraries in client.
>
> Of course it would be advantaneous only when BOINc API would be mature
> enough and not requre rebuilding with each new version advance.
>
> As side effect app developers could download shared libs, import libs and
> headers only, avoiding full BOINC source tree download and compilation, as
> was already proposed before.
> That way BOINC will become more convenient framework than it is now.
>
>
> Tue, 17 Jun 2014 21:07:54 -0700 от David Anderson <[email protected]
> >:
> >What's the reason for using dynamic libraries in the client?
> >And how does this relate to applications?
> >-- David
> >
> >On 17-Jun-2014 6:11 AM, Gianfranco Costamagna wrote:
> >> Hi Boinc development team,
> >>
> >> as you already know debian has a little patched boinc version that
> dynamically links
> >> almost everything and exports those libraries to applications that uses
> them (e.g.
> >> seti, milkyway)
> >>
> >>
> >> This approach has never been merged upstream since you don't want to
> dynamically
> >> link almost anything in your source tree, however since in debian we
> have really
> >> nice results I decided to merge my patches and give you a single patch
> with a new
> >> autoconf swich, that permits distros who wants to automagically
> dynamically build
> >> the source code.
> >>
> >> This approach is disabled by default, so the current behaviour will
> still be the default
> >> what do you think about?
> >>
> >> This will simplify a lot the debian maintaining of your package.
> >>
> >> Thanks,
> >>
> >>
> >>
> >> Gianfranco
> >>
> >> --- /dev/null
> >> +++ b/debian/patches/dynamic-libs.patch
> >> @@ -0,0 +1,203 @@
> >> +--- a/configure.ac
> >> ++++ b/configure.ac
> >> +@@ -71,6 +71,11 @@
> >> +     [dynamic_client=${enableval}],
> >> +     [dynamic_client=no])
> >> +
> >> ++AC_ARG_ENABLE(dynamic-libs,
> >> ++    AS_HELP_STRING([--enable-dynamic-libs],
> >> ++                   [build dynamic libraries]),
> >> ++    [dynamic_libs=yes])
> >> ++
> >> + AC_ARG_ENABLE(server,
> >> +     AS_HELP_STRING([--disable-server],
> >> +                    [disable building the scheduling server]),
> >> +@@ -949,6 +954,7 @@
> >> +
> >> + dnl tell automake about whether to build client and/or server
> >> + AM_CONDITIONAL(DYNAMIC_CLIENT, [test "${dynamic_client}" = yes])
> >> ++AM_CONDITIONAL(DYNAMIC_LIBS,   [test "x${dynamic_libs}" = xyes])
> >> + AM_CONDITIONAL(ENABLE_SERVER, [test "${enable_server}" = yes])
> >> + AM_CONDITIONAL(ENABLE_CLIENT, [test "${enable_client}" = yes])
> >> + AM_CONDITIONAL(ENABLE_MANAGER, [ test "x${ac_cv_have_wxwidgets}" =
> xyes -a
> >> "${enable_manager}" = yes ])
> >> +--- a/Makefile.incl
> >> ++++ b/Makefile.incl
> >> +@@ -41,26 +41,36 @@
> >> + # dependencies to make sure libs gets compiled before
> >> + # programs linking to them:
> >> +
> >> +-LIBSCHED = $(top_builddir)/sched/libsched.la
> >> ++if DYNAMIC_LIBS
> >> ++  LIBSCHED = -lsched
> >> ++  LIBSCHED_FCGI = -lsched_fcgi
> >> ++  LIBBOINC = -lboinc
> >> ++  LIBBOINC_CRYPT = -lboinc_crypt
> >> ++  LIBBOINC_FCGI = -lboinc_fcgi
> >> ++  LIBAPI = -lboinc_api
> >> ++else
> >> ++  LIBSCHED = $(top_builddir)/sched/libsched.la
> >> ++  LIBSCHED_FCGI = $(top_builddir)/sched/libsched_fcgi.la
> >> ++  LIBBOINC = $(top_builddir)/lib/libboinc.la
> >> ++  LIBBOINC_CRYPT = $(top_builddir)/lib/libboinc_crypt.la
> >> ++  LIBBOINC_FCGI = $(top_builddir)/lib/libboinc_fcgi.la
> >> ++  LIBAPI = $(top_builddir)/api/libboinc_api.la
> >> ++endif
> >> ++
> >> + $(LIBSCHED):
> >> +       cd $(top_builddir)/sched; ${MAKE} libsched.la
> >> +-LIBSCHED_FCGI = $(top_builddir)/sched/libsched_fcgi.la
> >> + $(LIBSCHED_FCGI):
> >> +       cd $(top_builddir)/sched; ${MAKE} libsched_fcgi.la
> >> +-LIBBOINC = $(top_builddir)/lib/libboinc.la
> >> + $(LIBBOINC):
> >> +       cd $(top_builddir)/lib; ${MAKE} libboinc.la
> >> +-LIBBOINC_CRYPT = $(top_builddir)/lib/libboinc_crypt.la
> >> + $(LIBBOINC_CRYPT):
> >> +       cd $(top_builddir)/lib; ${MAKE} libboinc.la
> >> +-LIBBOINC_FCGI = $(top_builddir)/lib/libboinc_fcgi.la
> >> + $(LIBBOINC_FCGI):
> >> +       cd $(top_builddir)/lib; ${MAKE} libboinc_fcgi.la
> >> +-LIBAPI = $(top_builddir)/api/libboinc_api.la
> >> + $(LIBAPI):
> >> +       cd $(top_builddir)/api; ${MAKE} libboinc_api.la
> >> +
> >> + SERVERLIBS = $(LIBSCHED) $(LIBBOINC_CRYPT) $(LIBBOINC) $(MYSQL_LIBS)
> >> $(PTHREAD_LIBS) $(RSA_LIBS) $(SSL_LIBS)
> >> + SERVERLIBS_FCGI = $(LIBSCHED_FCGI) $(LIBBOINC_CRYPT) $(LIBBOINC_FCGI)
> -lfcgi
> >> $(MYSQL_LIBS) $(PTHREAD_LIBS) $(RSA_LIBS) $(SSL_LIBS)
> >> + APPLIBS = $(LIBAPI) $(LIBBOINC)
> >> +-
> >> ++.PHONY: $(LIBBOINC) $(LIBBOINC_CRYPT) $(LIBBOINC_FCGI) $(LIBAPI)
> $(LIBSCHED)
> >> $(LIBSCHED_FCGI)
> >> +--- a/client/Makefile.am
> >> ++++ b/client/Makefile.am
> >> +@@ -31,7 +31,11 @@
> >> + boinccmd_DEPENDENCIES = $(LIBBOINC)
> >> + boinccmd_CPPFLAGS = $(AM_CPPFLAGS)
> >> + boinccmd_LDFLAGS = $(AM_LDFLAGS) -L$(top_srcdir)/lib
> >> ++if DYNAMIC_LIBS
> >> ++boinccmd_LDADD = $(LIBBOINC) $(BOINC_EXTRA_LIBS) $(PTHREAD_LIBS)
> -L../lib/.libs
> >> ++else
> >> + boinccmd_LDADD = $(LIBBOINC) $(BOINC_EXTRA_LIBS) $(PTHREAD_LIBS)
> >> ++endif
> >> +
> >> + boinc_client_SOURCES = \
> >> +     acct_mgr.cpp \
> >> +--- a/apps/Makefile.am
> >> ++++ b/apps/Makefile.am
> >> +@@ -8,15 +8,27 @@
> >> +
> >> + upper_case_SOURCES = upper_case.cpp
> >> + upper_case_CXXFLAGS = $(PTHREAD_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++upper_case_LDFLAGS = -static-libtool-libs $(PTHREAD_CFLAGS)
> -L../api/.libs
> >> -L../lib/.libs
> >> ++else
> >> + upper_case_LDFLAGS = -static-libtool-libs $(PTHREAD_CFLAGS)
> >> ++endif
> >> + upper_case_LDADD = $(APPLIBS)
> >> +
> >> + concat_SOURCES = concat.cpp
> >> + concat_CXXFLAGS = $(PTHREAD_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++concat_LDFLAGS = -static-libtool-libs $(PTHREAD_CFLAGS)
> -L../api/.libs -L../lib/.libs
> >> ++else
> >> + concat_LDFLAGS = -static-libtool-libs $(PTHREAD_CFLAGS)
> >> ++endif
> >> + concat_LDADD = $(APPLIBS)
> >> +
> >> + 1sec_SOURCES = 1sec.cpp
> >> + 1sec_CXXFLAGS = $(PTHREAD_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++1sec_LDFLAGS = -static-libtool-libs $(PTHREAD_CFLAGS) -L../api/.libs
> -L../lib/.libs
> >> ++else
> >> + 1sec_LDFLAGS = -static-libtool-libs $(PTHREAD_CFLAGS)
> >> ++endif
> >> + 1sec_LDADD = $(APPLIBS)
> >> +--- a/lib/Makefile.am
> >> ++++ b/lib/Makefile.am
> >> +@@ -175,13 +175,21 @@
> >> + libboinc_la_SOURCES = $(generic_sources) $(mac_sources) $(win_sources)
> >> + libboinc_la_CFLAGS = $(AM_CFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
> >> + libboinc_la_CXXFLAGS = $(AM_CXXFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++libboinc_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -version-number
> $(LIBBOINC_VERSION)
> >> ++else
> >> + libboinc_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -static
> -version-number
> >> $(LIBBOINC_VERSION)
> >> ++endif
> >> + libboinc_la_LIBADD =
> >> +
> >> + libboinc_crypt_la_SOURCES = crypt.cpp
> >> + libboinc_crypt_la_CFLAGS = $(AM_CFLAGS) $(PICFLAGS) $(PTHREAD_CFLAGS)
> $(SSL_CFLAGS)
> >> + libboinc_crypt_la_CXXFLAGS = $(AM_CXXFLAGS) $(PICFLAGS)
> $(PTHREAD_CFLAGS)
> >> $(SSL_CXXFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++libboinc_crypt_la_LDFLAGS = -L$(libdir) -rpath $(libdir)
> -version-number
> >> $(LIBBOINC_VERSION)
> >> ++else
> >> + libboinc_crypt_la_LDFLAGS = -L$(libdir) -rpath $(libdir) -static
> -version-number
> >> $(LIBBOINC_VERSION)
> >> ++endif
> >> + libboinc_crypt_la_LIBADD =
> >> +
> >> +
> >> +@@ -250,7 +258,11 @@
> >> + msg_test_LDADD = $(LIBBOINC)
> >> + crypt_prog_SOURCES = crypt_prog.cpp
> >> + crypt_prog_CXXFLAGS = $(PTHREAD_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++crypt_prog_LDADD = $(LIBBOINC_CRYPT_STATIC) $(LIBBOINC) $(SSL_LIBS)
> -L../lib/.libs
> >> ++else
> >> + crypt_prog_LDADD = $(LIBBOINC_CRYPT_STATIC) $(LIBBOINC) $(SSL_LIBS)
> >> ++endif
> >> + parse_test_SOURCES = parse_test.cpp
> >> + parse_test_CXXFLAGS = $(PTHREAD_CFLAGS)
> >> + parse_test_LDADD = $(LIBBOINC)
> >> +--- a/vda/Makefile.am
> >> ++++ b/vda/Makefile.am
> >> +@@ -4,7 +4,11 @@
> >> + vda_PROGRAMS = vda vdad ssim
> >> +
> >> + AM_CXXFLAGS += $(MYSQL_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++AM_LDFLAGS += -L../sched -L../lib/.libs
> >> ++else
> >> + AM_LDFLAGS += -static
> >> ++endif
> >> +
> >> + vda_SOURCES = vda.cpp vda_lib.cpp vda_lib2.cpp vda_policy.cpp
> stats.cpp
> >> + vda_LDADD = $(SERVERLIBS)
> >> +--- a/sched/Makefile.am
> >> ++++ b/sched/Makefile.am
> >> +@@ -4,7 +4,11 @@
> >> + include $(top_srcdir)/Makefile.incl
> >> +
> >> + AM_CPPFLAGS += $(MYSQL_CFLAGS) $(PTHREAD_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++AM_LDFLAGS += -L../lib/.libs
> >> ++else
> >> + AM_LDFLAGS += -static
> >> ++endif
> >> +
> >> + if ENABLE_LIBRARIES
> >> +
> >> +--- a/tools/Makefile.am
> >> ++++ b/tools/Makefile.am
> >> +@@ -44,7 +44,11 @@
> >> +     gui_urls.xml
> >> +
> >> + AM_CXXFLAGS += $(MYSQL_CFLAGS)
> >> ++if DYNAMIC_LIBS
> >> ++AM_LDFLAGS += -L../sched -L../lib/.libs
> >> ++else
> >> + AM_LDFLAGS += -static
> >> ++endif
> >> +
> >> + cancel_jobs_SOURCES = cancel_jobs.cpp
> >> + cancel_jobs_LDADD = $(SERVERLIBS)
> >> +--- a/clientgui/Makefile.am
> >> ++++ b/clientgui/Makefile.am
> >> +@@ -13,7 +13,9 @@ if ENABLE_CLIENT_RELEASE
> >> + ## so we'll use the safer "-static-libtool-libs" by default.
> >> + else
> >> + if DYNAMIC_CLIENT
> >> +-## if libtool starts to need flags for dynamic linking, add them here
> >> ++if DYNAMIC_LIBS
> >> ++  AM_LDFLAGS +=  -L../lib/.libs
> >> ++endif
> >> + else
> >> +   AM_LDFLAGS += -static
> >> + endif
> >>
> >_______________________________________________
> >boinc_dev mailing list
> >[email protected]
> >http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
> >To unsubscribe, visit the above URL and
> >(near bottom of page) enter your email address.
>
> _______________________________________________
> boinc_dev mailing list
> [email protected]
> http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
> To unsubscribe, visit the above URL and
> (near bottom of page) enter your email address.
>
>
_______________________________________________
boinc_dev mailing list
[email protected]
http://lists.ssl.berkeley.edu/mailman/listinfo/boinc_dev
To unsubscribe, visit the above URL and
(near bottom of page) enter your email address.

Reply via email to