Page 1 of 1
Keyboard buffer queue, Maximum size?
Posted: 15. May 2013, 10:36
by mp3party
I generate openvpn certificates with a keyboard emulator not a batch file and the problem is the time it takes to generate the DH Parameters file the time for this can be from 3 to 20 mins while this is going on I am deliving approx 140 keystrokes a second to fill out the certificates info and copy the files to a location on my hdd, my system eventually fills my enoumous keyboard data queue up (600 000 at the moment) and starts missing keystrokes causing errors in my system. This happens when the CPU usage of the other core hits 100%.
My system is XP SP3 running on a P4 3G HT
Below is the reg hack to increase the buffer size if you have a OS to Trash N Crash.
System Key: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Kbdclass\Parameters]
Value Name: KeyboardDataQueueSize
Data Type: REG_DWORD (DWORD Value)
I am about to try is a Guest win 2000 install to see what is the biggest buffer is before it crashes.
I could just be asking to much from my system but its only another 140 interrupts a sec.
Does VirtualBox 4.2.12 use the host OS keyboard buffer settings or the Guest OS?
Re: Keyboard buffer queue, Maximum size?
Posted: 15. May 2013, 10:58
by noteirak
Very very technical question for a very technical need - I would take this to the
dev mailing list or directly browse
the source code.
Re: Keyboard buffer queue, Maximum size?
Posted: 15. May 2013, 11:39
by michaln
mp3party wrote:Does VirtualBox 4.2.12 use the host OS keyboard buffer settings or the Guest OS?
That depends on how the data flows. If the host keyboard is involved then effectively both.
From a design standpoint, feeding huge amounts of data through a keyboard controller
quickly is a bad idea. There is zero flow control and the sending side has no feedback whatsoever. The queues do have limited sizes and there is no guarantee that keystrokes will be processed quickly.
Keyboard input mechanisms were designed for keyboard input with very low data rates and built-in error correction in the form of the human operating the keyboard. For other data transfer needs, there's Ethernet and the like

Re: Keyboard buffer queue, Maximum size?
Posted: 15. May 2013, 16:00
by mp3party
michaln wrote:mp3party wrote:Does VirtualBox 4.2.12 use the host OS keyboard buffer settings or the Guest OS?
That depends on how the data flows. If the host keyboard is involved then effectively both.
From a design standpoint, feeding huge amounts of data through a keyboard controller
quickly is a bad idea. There is zero flow control and the sending side has no feedback whatsoever. The queues do have limited sizes and there is no guarantee that keystrokes will be processed quickly.
Keyboard input mechanisms were designed for keyboard input with very low data rates and built-in error correction in the form of the human operating the keyboard. For other data transfer needs, there's Ethernet and the like

I agree its a bad idea to feed large and fast data into the keyboard but since I have implemented some protocol to slow down my system the acuracy is 100% until the system gets overworked. Windows seems to poll the keyboard every .5 seconds to say send no data from what I can work out .
Back in the day of a dual P3 700 server can handle about 1000 interupts a second was the limit from memory I think at idle it was below 200.
Maybe I need a faster computer?
Some time ago if I sent a short amount of typing to the keyboard port and I acheived over 4000 WPM but after finding the little time where you cant send anything it is greatly slowed down but is 100 % acurate until the buffers fill or the CPU gets overloaded.
Maybe I will have to experement my self assuming a 32 bit OS its in the range of 4 G for a keyboard buffer.
Re: Keyboard buffer queue, Maximum size?
Posted: 15. May 2013, 16:42
by michaln
I suspect that USB keyboards handle considerably slower data rates than PS/2 ones. With a normal USB keyboard, there's no way you're going to get 1000 interrupts (events) per second, more like 125. And while the USB HID protocol allows several key presses/releases to be reported at once, there is no guaranteed ordering, so... Again, keyboard interfaces are designed for keyboards driven by human fingers. Try hitting a key 50 times a second

Re: Keyboard buffer queue, Maximum size?
Posted: 21. Sep 2014, 07:50
by Smokingwheels
michaln wrote:I suspect that USB keyboards handle considerably slower data rates than PS/2 ones. With a normal USB keyboard, there's no way you're going to get 1000 interrupts (events) per second, more like 125. And while the USB HID protocol allows several key presses/releases to be reported at once, there is no guaranteed ordering, so... Again, keyboard interfaces are designed for keyboards driven by human fingers. Try hitting a key 50 times a second

You are right about the USB port.
I got my PS/2 to hit peak speed of 6000 WPM and the USB is barely 700 WPM.
I implemented slight protocol to pause when PC complains.