Difference between ArrayBlockingQueue and LinkedBlockingQueue


Blocking queue interface is the part of Java.util.concurrent package. Blocking queue is specially designed for producer consumer queues and also support collection. This interface is divided into four parts of methods to support all types of operation which can be performed over the queue. It doesn't accept null keys. ArrayBlockingQueue and LinkedBlockingQueue both implements Blocking queue interface

ArrayBlockingQueue and LinkedBlockingQueue both stores elements in FIFO order. In both queues Insertion of element always happened at the tail of the queue and removal of the element always happened from the head of the queue.  

Sr. No.KeyArrayBlockingQueueLinkedBlockingQueue
1
Basic
It is backed by Array
It is backed by Linked list
2
Bounded
It is bounded array queue . Therefore Once created, the capacity cannot be changed
It is unbounded queue
3
Throughput
It has lower throughput than Linked queues queues
Linked queues have higher throughput than array-based queues
4.
Lock
It uses single-lock double condition algorithm
It has putLock for inserting element in the queue  and takeLock for removing elements from the queue

Updated on: 27-Jan-2020

310 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements