shared libraries in sun solaris
Simon Marlow
simonmar@microsoft.com
Thu, 9 Aug 2001 10:26:41 +0100
> we are writing a haskell program that does a calculation for=20
> an intranet=20
> application. We assume that at peak times, several thousand=20
> users are going=20
> to use the program at the same time.
> Our problem is, that our binary file has several MBs and we=20
> don't know how=20
> to compile it (we are using ghc 5.01) in a way, that all=20
> users can share ONE=20
> binary file in memory. If every user has one file, we would=20
> need several GBs=20
> of memory.
> At the moment we are using Microsoft Windows NT but planning=20
> to use Sun=20
> Solaris later.
> Every hint would be a big help,
Most operating systems, including Windows NT and Solaris, will share the
text of a binary in memory between several invocations. Only the data
section of the binary will be duplicated (and then only the pages that
are actually modified). =20
To get slightly better sharing performance you might want to statically
link the binary - it'll already be statically linked against the Haskell
libraries, but statically linking against the C libraries will mean that
you dirty slightly fewer pages for each new instance of the running
program. This is a tradeoff with shared libraries: shared libraries are
good when lots of different binaries use the same library(*), but don't
give you any benefit when you have many running instances of the same
binary.
(*) I've heard people argue that even in this case shared libraries
aren't actually a win, so YMMV.
Cheers,
Simon