Почему ArrayBlockingQueue называется ограниченной очередью, а LinkedBlockingQueue называется неограниченной очередью блокировки?

Насколько я знаю, и связанный список, и массив могут расти без ограничений, или я ошибаюсь? Но когда я просмотрел документацию в Службе исполнителей , я вижу это:

Unbounded queues. Using an unbounded queue (for example a LinkedBlockingQueue without a predefined capacity) will cause new tasks to wait in the queue when all corePoolSize threads are busy. Thus, no more than corePoolSize threads will ever be created. (And the value of the maximumPoolSize therefore doesn't have any effect.)

Изменяется ли свойство Unbounded Queue, когда LinkedBlockingQueueимеет определенную емкость?

И это написано дляArrayBlockingQueue:

Bounded queues. A bounded queue (for example, an ArrayBlockingQueue) helps prevent resource exhaustion when used with finite maximumPoolSizes, but can be more difficult to tune and control. Queue sizes and maximum pool sizes may be traded off for each other: Using large queues and small pools minimizes CPU usage, OS resources, and context-switching overhead, but can lead to artificially low throughput. If tasks frequently block (for example if they are I/O bound), a system may be able to schedule time for more threads than you otherwise allow. Use of small queues generally requires larger pool sizes, which keeps CPUs busier but may encounter unacceptable scheduling overhead, which also decreases throughput.

8
задан Geek 6 August 2012 в 14:49
поделиться