Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
302 views
in Technique[技术] by (71.8m points)

windows - Usefulness of COM port latency

As you can see in this tutorial, the default latency timer for the COM port is 16ms.
COM Port Latency

But in most cases we want the minimum latency.

On the internet we see a lot of explanation on why this value should be as small as possible, but never when it is good to choose a large value.

So why the default value is 16ms when it could be 1ms ?

question from:https://stackoverflow.com/questions/65941007/usefulness-of-com-port-latency

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It's more CPU-efficient to transfer data in larger chunks. If you have a 1ms latency, your serial port may cause up to 1000 transfers per second through the OS (interrupt, lower handler, context switch, user callback, etc). With a 16ms latency, you would process the same amount of data in only 60 transfers, with each transfer handling a larger block.

Reducing the interrupt count is a lot less useful on a modern multicore system than it was on a single core, where all time spent in a serial (or USB) interrupt meant delays in processing other I/O such as disk transfers. Now that work can be split among multiple cores, although inefficient processing still has a bad effect on e.g. battery life.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...