home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.amiga
- Path: sparky!uunet!sybus.sybus.com!myrddin!tct!ckctpa!crash
- From: crash@ckctpa.UUCP (Frank "Crash" Edwards)
- Subject: Re: HELP!! Is there a LoadSeg command or an Overlay under Unix?
- Message-ID: <1992Sep10.231141.8296@ckctpa.UUCP>
- Date: Thu, 10 Sep 1992 23:11:41 GMT
- Reply-To: crash%ckctpa@tct.com (Frank "Crash" Edwards)
- References: <1992Sep2.173457.58586@cc.usu.edu>
- Organization: Edwards & Edwards Consulting
- Lines: 56
-
- slmt9@cc.usu.edu (Joshua Dinerstein) writes:
- > Hi All,
- >
- > Is there a LoadSeg type of command under Unix? Or even and overlay
- >manager?
- >
- > Any information at all would be great!
-
- Hmmm, I suppose this isn't a joke, eh?
-
- (Most) Unix implementations provide a flat memory model (as opposed to
- a segmented model) which utilizes a virtual memory scheme that renders
- an "overlay manager" obsolete. Just keep dynamically allocating
- memory using malloc() or some such and the system will provide up to
- (physical memory) + (paging space) - (some constant) amount of memory
- to your program.
-
- There are efficiency considerations of course, but they don't usually
- figure in until you start paging pretty bad -- check the man pages on
- swap(1) and ps(1) for some information on process management by the
- kernel.
-
- If your question was really, "how do I spawn another program" then
- that should have been the question asked (!). The easiest way is to
- call system(3) with a character string which contains the command line
- you want executed. The shell (determined by the SHELL environment
- variable) parses the command so it may contain I/O redirection, pipes,
- wildcards, etc.
-
- However, system(3) is not the most secure nor the most efficient way
- to get the job done. It is implemented using system-level calls known
- as fork(2), exec(2), and wait(2). There is an entire family of
- exec(2) routines and wait(2) routines; look in the man pages for
- details.
-
- Some versions of Unix, such as Amiga Unix, provide for dynamic linking
- of object modules into the executing program at _run_time_. This
- allows a program, for example, to decide which algorithm it wants to
- use and then dynamically link in the associated object module and
- execute it. When it's done, it frees that module and its resources.
- Something similar to this can be arranged with shared libraries (see
- ld(1) and ar(1) in the man pages).
-
- > Thanks
- > Joshua
-
- Perhaps you could ask your question(s) in terms of what you want to do
- rather than what you want to implement? Generally that lets other
- netters hear the problem and you get flooded with a variety of answers
- that you can simply pick from.
-
- --
- Frank "Crash" Edwards King Marine Electronics, Inc.
- Home: 813/786-3675 Work: 813/530-3411
- There will be times in life when everyone you meet smiles and pats you on
- the back and tells you how great you are ... so hold on to your wallet.
-