From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ce6f6f23c4e880ad X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-24 20:21:42 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!cyclone.socal.rr.com!cyclone3.kc.rr.com!news3.kc.rr.com!twister.socal.rr.com.POSTED!not-for-mail Message-ID: <3D17E1E2.AED28873@san.rr.com> From: Darren New X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Multitasking theory question References: <3d123f34.0@news.unibw-muenchen.de> <3D128BA9.8090707@telepath.com> <3D16B14B.2A5D8261@attbi.com> <3D173788.8758A005@san.rr.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 25 Jun 2002 03:21:41 GMT NNTP-Posting-Host: 66.75.151.160 X-Complaints-To: abuse@rr.com X-Trace: twister.socal.rr.com 1024975301 66.75.151.160 (Mon, 24 Jun 2002 20:21:41 PDT) NNTP-Posting-Date: Mon, 24 Jun 2002 20:21:41 PDT Organization: RoadRunner - West Xref: archiver1.google.com comp.lang.ada:26682 Date: 2002-06-25T03:21:41+00:00 List-Id: 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.