1998Q3/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: lurker emerges -->
<!--X-From-R13: "F. Oyrknaqre Bbcvry" <cbcvryNfahtuneobe.pbz> -->
<!--X-Date: Mon, 10 Aug 1998 21:45:23 &#45;0700 -->
<!--X-Message-Id: 199808110445.VAA07689#cashew,snugharbor.com.snugharbor.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 35CFBD79.68748E69#freehold,crocodile.org -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: lurker emerges</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:popiel#snugharbor,com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00651.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00653.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00649.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00653.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00652">Author</A>
&nbsp;|&nbsp;<A HREF="#00652">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00652">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: lurker emerges</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Re: lurker emerges </LI>
<LI><em>From</em>: "T. Alexander Popiel" &lt;<A HREF="mailto:popiel#snugharbor,com">popiel#snugharbor,com</A>&gt;</LI>
<LI><em>Date</em>: Mon, 10 Aug 1998 21:45:05 -0600</LI>
<LI><em>cc</em>: <A HREF="mailto:popiel#snugharbor,com">popiel#snugharbor,com</A></LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
In message:  &lt;<A HREF="msg00649.html">35CFBD79.68748E69#freehold,crocodile.org</A>&gt;
             Vadim Tkachenko &lt;vt#freehold,crocodile.org&gt; writes:
&gt;Preserved for clarity
Again...
&gt; 
&gt;&gt; Blocking I/O: you make a library/system call requesting an I/O
&gt;&gt; operation of a given size.  The call does not return until the
&gt;&gt; entire operation completes for the entire size requested,
&gt;&gt; regardless of delays incurred.  Under some implementations,
&gt;&gt; external (and only external) sources may interrupt the call.
&gt;&gt; Under no circumstances is your program able to do other work
&gt;&gt; while waiting for the I/O to complete.
&gt;&gt; 
&gt;&gt; Non-blocking I/O: you make a library/system call requesting
&gt;&gt; an I/O operation of a given size.  The call always returns
&gt;&gt; 'immediately' (after minimal processing of the request,
&gt;&gt; responding with whatever data is already on hand), with an
&gt;&gt; indication of how much I/O was actually performed.  In some
&gt;&gt; implementations (UNIX sockets), no further processing is done
&gt;&gt; without additional request.  In other implementations (Amiga,
&gt;&gt; apparently, and some of the old mainframes), when the remainder
&gt;&gt; of the requested I/O is completed, the calling program is
&gt;&gt; informed.  In both cases, a _separate_ library/system call is
&gt;&gt; available to wait until more I/O is possible or I/O completes
&gt;&gt; (depending on flavor).
&gt;
&gt;Okay, now I see that I meant the same definitions, although have a
&gt;different viewpoint.
&gt;
&gt;For last 2 years I'm thinking in Java, before that I'd been thinking in
&gt;C++ for 6 years, 2 of which were preemptive and multithreaded, before
&gt;that, it was Windows.

For reference, I only started Java two years ago, and before and
during that, I've been a big UNIX and C (_not_ C++) fan.  Java is
not my first exposure to multithreading issues (I also do MUSHcode
which exhibits many of the same problems), but I generally view
multithreading in terms of the large amount of overhead it brings.

&gt;Now, I agree that UNIX may not (I'm not really strong in C++ in UNIX)
&gt;and Java does not have asynchronous I/O as you describe it. However, I
&gt;was doing the stuff mostly top-to-the-bottom and don't really see a
&gt;problem here. Let me draft it (I guess, it's pretty obvious):
&gt;
&gt;ACT is the Asynchronous Completion Token (Design patterns...), has
&gt;read_count field and a semaphore.
&gt;
&gt;ACT	asyncread( buffer, how_much_do_I_want, boolean all_async );
&gt;
&gt;OK, so what I have is some read performed at once (no sense in async
&gt;read if I know the absolute minimum I want), and then I know how much
&gt;did I read - the ACT has it. Then, I can go out and do my stuff, and
&gt;when I'm ready I may go out and wait for the completion semaphore (let
&gt;me emphasise, _event_ semaphore).

If I'm reading this correctly, your asyncread() creates a semaphore,
spawns a thread, associates the two, and returns immediately.  The
spawned thread does the actual blocking read, then notifies the
semaphore and exits.

To recreate my non-blocking I/O library call, you've added the
overhead of semaphore creation and destruction (and a possible
semaphore leak if the caller does not dispose of the semaphore
properly), and thread creation and destruction, all to end up
with something functionally equivalent to what I wanted in the
first place.  Personally, I don't see this as a win.  Especially
on systems (like SunOS 4.1.3) which don't support threading at
all, making what you suggest well nigh impossible.

&gt;So, on the API level - what's the difference between the _library_ call
&gt;and the simple piece of code I'm talking about? Agreed, the former may
&gt;be _much_ more effective, but if you're going to production, you need
&gt;the _scalable_ solution anyway, and if it really bothers you, go to the
&gt;platform which does have the stuff you mentioned and make it native, in
&gt;Java case.

I think the only difference is in performance and the a stylistic
preference in choice of primitives.  I prefer async primitives,
because sync can be built on async with trivial performance loss
(two routine calls (request, wait) instead of one), while async
can be built on sync only with lots of other cruft (semaphores,
threads) and large performance loss.

&gt;&gt; The most important distinction in my mind is the ability (or
&gt;&gt; lack thereof) to separate the request and the wait for request
&gt;&gt; completion.
&gt;
&gt;Nah, the Asynchronous Completion Token is a solution in this case.

A solution which only works if you have a multithreaded environment...
which I don't.  :-(

- Alex


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00656" HREF="msg00656.html">[MUD-Dev] Re: lurker emerges</A></strong>
<ul compact><li><em>From:</em> Petri Virkkula &lt;pvirkkul#iki,fi&gt;</li></ul>
<li><strong><A NAME="00653" HREF="msg00653.html">[MUD-Dev] Re: lurker emerges</A></strong>
<ul compact><li><em>From:</em> Vadim Tkachenko &lt;vt#freehold,crocodile.org&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00649" HREF="msg00649.html">[MUD-Dev] Re: lurker emerges</A></STRONG>
<UL><LI><EM>From:</EM> Vadim Tkachenko &lt;vt#freehold,crocodile.org&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00651.html">[MUD-Dev] Re: async i/o and threads (was: Re: lurker emerges</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00653.html">[MUD-Dev] Re: lurker emerges</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00649.html">[MUD-Dev] Re: lurker emerges</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00653.html">[MUD-Dev] Re: lurker emerges</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00652"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00652"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>[MUD-Dev] Re: lurker emerges</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="00610" HREF="msg00610.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Mon 10 Aug 1998, 05:05 GMT
<UL>
<LI><strong><A NAME="00611" HREF="msg00611.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Mon 10 Aug 1998, 05:23 GMT
<UL>
<LI><strong><A NAME="00632" HREF="msg00632.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Mon 10 Aug 1998, 15:29 GMT
<UL>
<LI><strong><A NAME="00649" HREF="msg00649.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Tue 11 Aug 1998, 03:41 GMT
<UL>
<LI><strong><A NAME="00652" HREF="msg00652.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Tue 11 Aug 1998, 04:45 GMT
<UL>
<LI><strong><A NAME="00653" HREF="msg00653.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Tue 11 Aug 1998, 05:39 GMT
<LI><strong><A NAME="00658" HREF="msg00658.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Tue 11 Aug 1998, 15:05 GMT
<LI><strong><A NAME="00676" HREF="msg00676.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
Vadim Tkachenko <a href="mailto:vt#freehold,crocodile.org">vt#freehold,crocodile.org</a>, Wed 12 Aug 1998, 04:33 GMT
</LI>
</LI>
</LI>
<LI><strong><A NAME="00656" HREF="msg00656.html">[MUD-Dev] Re: lurker emerges</A></strong>, 
Petri Virkkula <a href="mailto:pvirkkul#iki,fi">pvirkkul#iki,fi</a>, Tue 11 Aug 1998, 07:53 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</ul>
</ul>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>