[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pexec :)



I have been fiddling around over the past couple of days, trying to do two
ultimately simple things.

Firstly, I thought I'd try and get around the fact that MiNT doesn't have a
non-blocking fork by using Pexec's mode 104 (I think) that just runs a
basepage concurrently where the child shares the parents memory. The basepage
I passed was the parents... (I have this little bit of code that checks a flag
that tells the process if it's the child or parent :) Everything worked really
well, except that if the child terminates before the parent, the child enters
EXIT state until the parent terminates...

Secondly, I was trying to get around the really annoying aspect of GEMDOS that
hath plagued my life since the dawn of time - the fact that when a program is
first executed, it is given ALL of the availalbe memory. This causes no end of
problems for me, so I thought I'd use Pexec's mode 3 (I think) to just load
the program I want to execute and shrink its memory block before the thing is
run. All this is done in supervisor state so as to halt multi-tasking until
the memory is freed.

Then I use Pexec's mode 106 (this one I know :) to execute the program such
that is doesn't share memory with the parent. This way, I figured, I could
build a little routine called MyPexec or something which laugned an
application as if you'd done it with mode 100 of Pexec.

However, I found the same problem as with my little fork program - if the
child terminates before the parent, then the child sit in an eternal EXIT
state until the parent terminates.

The only thing I can't quite understand is that whilst in the EXIT state, the
process is not, according to TOP, using any memory (or processor time :) but
still registers. If I try to kill it from TCSH, then it says that it couldn't
find the process... Why doesn't MiNT dump the thing and be done with it? Is
there a way of doing what I am attempting that I am unaware of?

As as result of these pass few days, I would like to propose a new flag for
Pexec that indicates that the program should be loaded into a memory block
just big enough for the program. I understand that this would cause some
difficulty, since the program being launched in this way would have to be able
to detect whether or not it needs to perform a memory shrink call or not,
otherwise it won't run very nicely without MiNT.

Apologies for waffling on a bit :)

Cheers,

James Cox
<jamesco@cogs.susx.ac.uk>
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DISCLAIMER:

This article may be harmful or fatal if swallowed. Do not insert this article
into the ear canal. Not responsible for injuries due to reading this article
while showering. Prolonged inhalation of fumes from this article may result in
nausea, dizzyness, convulsions, and death. Do not operate a motor vehicle,
heavy equipment, or power tools while reading this article. Dispose of this
article in a responsible manner when finished reading. No warranties expressed
or implied. May *not* be suitable for children under 12. Discontinue reading
the article if skin rash appears, or vision blurrs, and consult a physician.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~