Which Java blocking queue is most efficient for single-producer single-consumer scenarios

后端 未结 7 2183
野的像风
野的像风 2020-12-23 16:32

I\'m working on a standard Java system with critical timing requirements for my producers (1/100s of ms matters).

I have a producer placing stuff in a blocking queu

7条回答
  •  情书的邮戳
    2020-12-23 17:04

    LinkedBlockingQueue will have O(1) insertion cost unless there is a memory allocation delay. A very large ArrayBlockingQueue will have O(1) insertion cost unless the system is blocked due to a garbage collection; it will, however, block on insert when at capacity.

    Even with concurrent garbage collection I'm not sure if you should be writing a real-time system in a managed language.

提交回复
热议问题