How To Install libconcurrentqueue-dev on Ubuntu 22.04
Introduction
In this tutorial we learn how to install libconcurrentqueue-dev
on Ubuntu 22.04.
What is libconcurrentqueue-dev
libconcurrentqueue-dev is:
Features
- Knock-your-socks-off blazing fast performance.
- Single-header implementation. Just drop it in your project.
- Fully thread-safe lock-free queue. Use concurrently from any number of threads.
- C++11 implementation – elements are moved (instead of copied) where possible.
- Templated, obviating the need to deal exclusively with pointers – memory is managed for you.
- No artificial limitations on element types or maximum count. Memory can be allocated once up-front, or dynamically as needed.
- Fully portable (no assembly; all is done through standard C++11 primitives).
- Supports super-fast bulk operations.
- Includes a low-overhead blocking version (BlockingConcurrentQueue).
- Exception safe.
Reasons to use
There are not that many full-fledged lock-free queues for C++. Boost has one, but it’s limited to objects with trivial assignment operators and trivial destructors, for example. Intel’s TBB queue isn’t lock-free, and requires trivial constructors too. There’re many academic papers that implement lock-free queues in C++, but usable source code is hard to find, and tests even more so.
This queue not only has less limitations than others (for the most part), but it’s also faster. It’s been fairly well-tested, and offers advanced features like bulk enqueueing/dequeueing (which, with the new design, is much faster than one element at a time, approaching and even surpassing the speed of a non-concurrent queue even under heavy contention).
There are three methods to install libconcurrentqueue-dev
on Ubuntu 22.04. We can use apt-get
, apt
and aptitude
. In the following sections we will describe each method. You can choose one of them.
Install libconcurrentqueue-dev Using apt-get
Update apt database with apt-get
using the following command.
sudo apt-get update
After updating apt database, We can install libconcurrentqueue-dev
using apt-get
by running the following command:
sudo apt-get -y install libconcurrentqueue-dev
Install libconcurrentqueue-dev Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install libconcurrentqueue-dev
using apt
by running the following command:
sudo apt -y install libconcurrentqueue-dev
Install libconcurrentqueue-dev Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude
using the following command.
sudo aptitude update
After updating apt database, We can install libconcurrentqueue-dev
using aptitude
by running the following command:
sudo aptitude -y install libconcurrentqueue-dev
How To Uninstall libconcurrentqueue-dev on Ubuntu 22.04
To uninstall only the libconcurrentqueue-dev
package we can use the following command:
sudo apt-get remove libconcurrentqueue-dev
Uninstall libconcurrentqueue-dev And Its Dependencies
To uninstall libconcurrentqueue-dev
and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:
sudo apt-get -y autoremove libconcurrentqueue-dev
Remove libconcurrentqueue-dev Configurations and Data
To remove libconcurrentqueue-dev
configuration and data from Ubuntu 22.04 we can use the following command:
sudo apt-get -y purge libconcurrentqueue-dev
Remove libconcurrentqueue-dev configuration, data, and all of its dependencies
We can use the following command to remove libconcurrentqueue-dev
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge libconcurrentqueue-dev
References
Summary
In this tutorial we learn how to install libconcurrentqueue-dev
package on Ubuntu 22.04 using different package management tools: apt
, apt-get
and aptitude
.