From: Mark H Weaver <mhw@netris.org>
To: Nala Ginrut <nalaginrut@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: [PATCH] Add current-suspendable-io-status parameter
Date: Mon, 13 May 2019 19:00:02 -0400 [thread overview]
Message-ID: <87lfzaj6ya.fsf@netris.org> (raw)
In-Reply-To: <87pnomjcs9.fsf@netris.org> (Mark H. Weaver's message of "Mon, 13 May 2019 16:54:03 -0400")
Hello again,
Previously I wrote:
> I also have doubts about the utility of the information provided.
> 'start' seems completely irrelevant, since it merely indicates the
> position within the read/write buffer. It's easier to make a case that
> 'count' might be relevant, but it's not a reliable indicator of the
> overall amount of pending I/O on that port. With a few exceptions,
> 'count' is normally limited to the port buffer size, and does not
> necessarily reflect the amount of I/O pending in the higher-level code.
I gave this some more thought, and I think I now understand why you want
these values. When performing large binary I/O operations, larger than
the port buffers, Guile bypasses the port buffers and passes the user's
bytevector directly to {read,write}-bytes. In that case, 'start' and
'count' correspond to values that are meaningful to the user.
I'd like to help you get the information you need, but I don't want to
use the mechanism you proposed. In addition to the efficiency problem
regarding heap allocation that I already mentioned, another problem is
that it's unreliable. The 'start' and 'count' provided *might*
correspond to the user's buffer, or it might not, and there's no
reliable way to find out. It would encourage users to write code that
depends on undocumented details of Guile's internal ports
implementation.
I guess what you want is the ability to see incremental reports on the
progress of your large I/O operations. Is that right? If we are going
to add an API for this, it needs to be reliable, and always give reports
in terms of the high-level requests that the user gave.
My preferred approach would be something like this: we could add a
'put-bytevector-some' I/O primitive which writes some bytes from a
bytevector, blocking only as needed to write at least one byte. It
would return the number of bytes written. This can be used to implement
an efficient variant of 'put-bytevector' that gives you access to the
real-time progress information.
On the read side, we already have 'get-bytevector-some', and I plan to
add 'get-bytevector-some!' soon as well. This could be used to
implement progress-tracking read operations.
What do you think?
Regards,
Mark
next prev parent reply other threads:[~2019-05-13 23:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-13 10:54 [PATCH] Add current-suspendable-io-status parameter Nala Ginrut
2019-05-13 10:56 ` Nala Ginrut
2019-05-13 20:54 ` Mark H Weaver
2019-05-13 23:00 ` Mark H Weaver [this message]
2019-05-14 4:22 ` Nala Ginrut
2019-05-14 20:22 ` Mark H Weaver
2019-05-15 9:31 ` Nala Ginrut
2019-05-16 0:58 ` Mark H Weaver
2019-05-17 11:07 ` Nala Ginrut
2019-05-18 23:06 ` Mark H Weaver
2019-05-15 10:09 ` tomas
2019-05-15 11:25 ` Chris Vine
2019-05-15 12:08 ` tomas
2019-05-15 11:25 ` Nala Ginrut
2019-05-15 12:10 ` tomas
2019-05-15 12:26 ` Nala Ginrut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lfzaj6ya.fsf@netris.org \
--to=mhw@netris.org \
--cc=guile-devel@gnu.org \
--cc=nalaginrut@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).