The efficiency of distributed shared memory (DSM) has been greatly improved by recent hardware technologies. But, the difficulty of distributed memory management can still be a major obstacle to the democratization of DSM, especially when a partial failure of the participating clients (due to crashed processes or machines) should be tolerated.
Therefore,we present CXL-SHM, an automatic distributed memory management system based on reference counting. The reference count maintenance in CXL-SHM is implemented with a special era-based non-blocking algorithm. Thus, there are no global blocking, memory leak, double free, and wild pointer problems, even if some participating clients unexpectedly fail without destroying their possessed memory references. We evaluated our system on real CXL hardware with both micro-benchmarks and end-to-end applications, which demonstrate the efficiency of CXL-SHM and the simplicity and flexibility of using CXL-SHM to build efficient distributed applications.
CXL-SHM is a C++ libaray, and it provides two ways to install.
You can install CXL-SHM with compiling the project.
cd cxl-shm
mkdir build
cmake ..
make -j
make install
TODO
Here is a simple C++ example. You can compile it with g++ test.cpp -o test -lcxlmalloc -latomic
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <thread>
#include <unistd.h>
#include <future>
#include <cxlmalloc.h>
#include <cxlmalloc_internal.h>
#include <sys/ipc.h>
#include <sys/shm.h>
size_t length;
int shm_id;
void consumer(uint64_t queue_offset, std::promise<uint64_t> &offset)
{
sleep(3);
cxl_shm shm = cxl_shm(length, shm_id);
shm.thread_init();
void* start = shm.get_start();
CXLRef r1 = shm.cxl_unwrap(queue_offset);
offset.set_value(r1.get_tbr()->pptr);
}
int main()
{
using namespace std;
length = (ZU(1) << 28);
shm_id = shmget(100, length, IPC_CREAT|0664);
cxl_shm shm = cxl_shm(length, shm_id);
shm.thread_init();
shm.thread_init();
int result = (shm.get_thread_id() != 0);
CXLRef ref = shm.cxl_malloc(32, 0);
result = (ref.get_tbr() != NULL && ref.get_addr() != NULL);
shmctl(shm_id, IPC_RMID, NULL);
return 0;
}
[^1]: Li, Huaicheng, et al. Pond: CXL-based memory pooling systems for cloud platforms. Proceedings of the 28th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 2. 2023. [^2]: Maruf, Hasan Al, et al. TPP: Transparent page placement for CXL-enabled tiered-memory. Proceedings of the 28th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 3. 2023.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。