qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] monitor: increase amount of data for monitor to


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] monitor: increase amount of data for monitor to read
Date: Sat, 06 Mar 2021 08:15:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> writes:

> Hmm. An idea. What we want: read more than one character at a time, as
> it's inefficient. May be instead of modifying monitor_can_read() and
> therefore influence monitor behavior in unpredictable way, we'd better
> add a separate read-cache, and just read through this cache?

I think this idea is worth exploring.

With a classical parser structure, this would be trivial.  Classical
structure: application gets expression tree from parser, parser gets
tokens from lexer, lexer reads characters from the input.  Just use a
suitably buffered read.

We use a streaming structure, though: main loop reads and pushes
characters to lexer one by one, lexer pushes tokens to parser one by
one, parser pushes expression tree to the monitor application.  All via
callbacks.

Additional complication: flow control.  The monitor can tell the main
loop to stop / resume pushing.  This is monitor_suspend(),
monitor_resume().  It takes effect immediately.

We can make the read buffered, but we still have to ensure "stop
pushing" takes effect immediately.  Stupidest way that could possibly
work: keep pushing characters to the lexer one by one.

I think that's what you have in mind.  Would be great if you could give
it a try!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]