comp.lang.ada
 help / color / mirror / Atom feed
From: Darren New <dnew@san.rr.com>
Subject: Re: Multitasking theory question
Date: Tue, 25 Jun 2002 03:21:41 GMT
Date: 2002-06-25T03:21:41+00:00	[thread overview]
Message-ID: <3D17E1E2.AED28873@san.rr.com> (raw)
In-Reply-To: o8QR8.121$7G4.12770@news.xtra.co.nz

AG wrote:
> Well, let's take a step back and regard it as a theoretical question:
> If you use something like "inc ax" - how do you know if it's blocking
> or not? 

Um... It's not. I'm assuming the normal use of the word "blocking" here:

   "To delay or sit idle while waiting for something."

You know an increment instruction isn't "blocking" because you're not
sitting idle during its execution. You know this because you read the
instruction manual for the CPU. Similarly, you know that the MS-DOS call to
wait for a key from the keyboard is indeed a blocking call, because of
similar types of documentation.

But surely this isn't what you were asking?

> And how does it matter? Assuming the operation completes
> *at all*,

Well, now, there's the rub, isn't it? How do you know it'll complete? If
it's waiting for the user, and the user is waiting for the other thread to
progress before typing, you just deadlocked. (Assuming you're talking about
a blocking call, that is, and not [inc ax])

Again, if you have two threads, and one calls an OS routine that loops
indefinitely, and the OS isn't supporting threads, then your second thread
won't progress. Sure, you can be sophistic about it and simply define away
the problem by saying "as long as the program ends before the end of the
universe...", but then you're just Humpty Dumptying. 

If the question is "where does the OS enter into it if I do all my
scheduling myself", the answer is "when you call the OS with one thread and
the OS prevents all the other threads from running." Some OSes do, some
don't. If your OS doesn't support threads and your OS doesn't support
non-blocking I/O, then you're definitely going to get different behavior
than if neither of these are true. If you don't think this is an actual
concern, then you simply haven't tried to write multitasking programs under
a single-tasking OS. :-)

-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.
** http://home.san.rr.com/dnew/DNResume.html **
** http://images.fbrtech.com/dnew/ **

     My brain needs a "back" button so I can
         remember where I left my coffee mug.



  reply	other threads:[~2002-06-25  3:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-20 20:46 Multitasking theory question Kai Schuelke
2002-06-20 20:53 ` Stephen Leake
2002-06-21  2:13 ` Ted Dennison
2002-06-24  3:18   ` AG
2002-06-24  4:13     ` tmoran
2002-06-24  4:24       ` AG
2002-06-24  7:33         ` Dale Stanbrough
2002-06-25  3:27           ` AG
2002-06-25  4:48             ` tmoran
2002-06-25  5:00               ` AG
2002-06-25  5:17               ` Darren New
2002-06-25  5:25                 ` AG
2002-06-24  5:43     ` Mark Biggar
2002-06-24  6:48       ` AG
2002-06-24 15:14         ` Darren New
2002-06-24 16:19           ` Larry Kilgallen
2002-06-25  2:01           ` AG
2002-06-25  3:21             ` Darren New [this message]
2002-06-25  4:01               ` AG
2002-06-25  4:19                 ` Darren New
2002-06-25  4:51                   ` AG
2002-06-26  1:58                     ` Darren New
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox