[net.micro.pc] Backround Processes under MSDOS??

greenber@timeinc.UUCP (Ross M. Greenberg) (05/14/85)

I'm in the process of writing up a backround processor of sorts under
MSDOS.  So I have already discovered the hard way that DOS is
non-re-entrant :-)

So I have taken over the DOS vector(s) and have the capability now
of determining if I am already in a DOS call.  The question that arises
is:

If I determine that I am in a dos call, how can I "suspend" the "process"
without executing an IRET.  Now the best method is probably to actually
execute the IRET, and then call the timer every 1/18.2 seconds to
determie if the guy that I'm executing can now call DOS.

I'd rather have a nice easy method (as the result of this program will
go public domain if it works).

Any ideas, suggestions, wishes??
I'll post the reults, etc.

Thanks!!

-- 
------------------------------------------------------------------
Ross M. Greenberg  @ Time Inc, New York 
              --------->{ihnp4 | vax135}!timeinc!greenber<---------

	Timeinc probably wouldn't acknowledge my existence, and has
	opinions of its own.  I highly doubt that they would make me
	their spokesperson.
------
"If ever the pleasure of one has to be bought by the pain of the other,
 there better be no trade. A trade by which one gains and the other
 loses is a fraud."         --- Dagny Taggart

johnl@ima.UUCP (05/18/85)

> So I have taken over the DOS vector(s) and have the capability now
> of determining if I am already in a DOS call.  The question that arises
> is:
> 
> If I determine that I am in a dos call, how can I "suspend" the "process"
> without executing an IRET.  Now the best method is probably to actually
> execute the IRET, and then call the timer every 1/18.2 seconds to
> determine if the guy that I'm executing can now call DOS.

I gather you've intercepted the INT 21 vector, so you can set a flag when the 
call happens, and then clear it when DOS returns.  Seems to me that if you find 
that your "process" wants to call DOS at an inconvenient time, it has but to 
remember its status, set a second flag, and return.  Then, when DOS returns to 
your code that clears the DOS-is-active flag, it can then test the second flag, 
realize that it has work pending, and pick up your process and do its work 
then.  That avoids inconvenient fooling with the clock, and should be faster 
since you'll get in to do your DOS call as soon as the previous one is done.  

Then again, you could get yourself a real operating system like PC/IX or
Xenix and avoid all this grief.

John Levine, Javelin Software, Cambridge MA 617-494-1400
{ decvax!cca | think | ihnp4 | cbosgd }!ima!johnl, Levine@YALE.ARPA

greenber@timeinc.UUCP (Ross M. Greenberg) (05/21/85)

John Levine  (Levine @ YALE.ARPA) talks about ways to "suspend a process"
in MSDOS.  This was in reply to my request regarding the problems of
a non-renterant DOS.


John, the problem with the idea of modifying my code to allow for the
IRET and to install a second flag isn't so easily solved: remember that
code such as COMMAND.COM and commercial packages also call DOS, and
only expect a return from DOS with return code indicating success or
failure.

So, my "transparent" patches to DOS can't return without the
correct status/return code, which can only be determined upon
the return from the "real" DOS, which can only be done when DOS
isn't in use by another process.

So the question still remains: how can I suspend a process under MSDOS
without hogging the CPU and without issuing the IRET?? Again, using the
timer interrupt areas seem legit, but also seems to be a kludge. 

Any other ideas???

(Suggestions to get a different operating system should include the
money to buy one, thank you :-) )


-- 
------------------------------------------------------------------
Ross M. Greenberg  @ Time Inc, New York 
              --------->{ihnp4 | vax135}!timeinc!greenber<---------

Timeinc probably wouldn't acknowledge my existence, and has opinions of its
own.  I highly doubt that they would make me their spokesperson.
------
"There's something wrong in the world. There's always been. Something no one
has ever named or explained" --- Francisco d'Anconia

g-frank@gumby.UUCP (05/24/85)

> So the question still remains: how can I suspend a process under MSDOS
> without hogging the CPU and without issuing the IRET?? Again, using the
> timer interrupt areas seem legit, but also seems to be a kludge. 
> 
> Any other ideas???
> 
> (Suggestions to get a different operating system should include the
> money to buy one, thank you :-) )
> 

Try Topview.  It's $149.00, and it makes MS-DOS truly multi-tasking.  It
even has messaging and event primitives for intertask and device communi=
cations.  Don't believe the magazines, by the way.  They just haven't
discovered operating systems yet.


-- 
      Dan Frank

	  Q: What's the difference between an Apple MacIntosh
	     and an Etch-A-Sketch?

	  A: You don't have to shake the Mac to clear the screen.