网络中移动对象导航算法解析
在网络环境中,移动对象的导航算法至关重要,它决定了移动对象在网络中的高效传输和合理分配。本文将详细介绍两种不同的导航算法:基于完全网络的导航算法和基于生成树的导航算法。
1. 基于完全网络的导航算法
1.1 算法代码
operation acquire_object() is
(1)
interestedi ←true;
(2)
if (¬ object_presenti) then
(3)
request_byi[i] ←request_byi[i] + 1;
(4)
for k ∈{1,...,n} \ {i} do send REQUEST(i) to pk end for;
(5)
wait (object_presenti)
(6)
end if.
operation release_object() is
(7)
interestedi ←false;
(8)
obtained[i] ←request_byi[i];
(9)
for k from i + 1 to n and then from 1 to i −1 do
(10)
if (request_byi[k] > obtained[k]) then
(11)
object_presenti ←false;
(12)
send OBJECT() to pk; exit loop
(13)
end if
(14) end for.
when OBJECT() is received do
(15) object_presenti ←true.
when REQUEST(k) is received do
(1
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



