home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / amiga / 2118 < prev    next >
Encoding:
Text File  |  1992-09-11  |  2.8 KB  |  68 lines

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