I'm writing a serial port class. My team lead said that when using
simple, non-overlapped I/O on Windows 2000, they found that doing 1 and
2 byte reads caused a significant peak in CPU utilization. (All our
packets are read with a 1 byte, then either a 1 or 2 byte read then a
lengthy read.) Do reduce this, they double buffered the reads.
I converted the class to use basic OVERLAPPED I/O. I wrote 2 versions
of the class; one uses straight reads, the other reads the data in
chunks and queues it up for the reader.
When testing both, I found that the process utilization was the same on
average. Does anyone know if OVERLAPPED I/O is already buffering serial
port reads? (Do serial port reads even make a ring transition at the
driver level? Did this possibly change between Windows 2000 and Windows
XP?)