Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexNSG::InterInsert lock issue #42

Open
yangzq50 opened this issue Nov 28, 2023 · 1 comment
Open

IndexNSG::InterInsert lock issue #42

yangzq50 opened this issue Nov 28, 2023 · 1 comment

Comments

@yangzq50
Copy link

https://github.com/ZJULearning/nsg/blob/eceb09e2754d978b4c8b07e3248018987feb597a/src/index_nsg.cpp#L308C7-L308C7

这里会用一个锁来读取 des_pool,之后又会加个锁写入 des_pool,假如处理另一个节点的函数在读、写操作中间读了,又在本线程写后写了数据,那么本线程的工作不就等于没干?

当然,这里这样处理可能是没问题的,在 des_pool 空间未满时,写操作分别在末尾添加数据是没有问题的,在 des_pool 空间已满时,究竟怎么更新数据(把入边反转一下也加入出边?),也许并没有区别?

@fc731097343
Copy link
Member

全程加锁会有些延长执行时间,读写分开加锁会快一些,这么做的一个假设是当图比较稀疏的时候,锁冲突概率比较低,你说这种互相干扰的情况发生的概率也比较低,可以忽略。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants