I/O Buffering

Tim Bray notes that buffering is good, in his own inimitable, humourous style. I feel his pain though. I remember wincing when I read about the improvements to 4.2BSD some years ago to stop doing single character reads and writes in libc. It sped the system up enormously and made for some very happy users.

Incidentally, I’m not old enough to remember 4.2BSD. I just read the paper a few years back.

2 replies on “I/O Buffering”

Here is something every software engineer with less than 20 years of experience needs to understand. All computers wait at the same speed.

Disable interrupts, read one byte at a time under program control until you have processed a buffer of data and enable interrupts. While interrupts are disabled no other task will be serviced.

To send and receive data under program control on a fast microprocessor is brain dead. Modems should have an onboard processor so that the fast microprocessor can do other things like respond to the mouse or keyboard.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s