负载平衡
Example: Floyd algorithm Dual-Pass Ring Termination Algorithm 双通环形终止算法 双通环形能够处理进程重新激活的问题 如果令牌已经经过Pj 现在已经传给Pi ( j i ),此时Pi继续往下传,但同时Pi又回传给Pj一个任务,Pj被重新激活了。若发生这种情况,令牌必须第二次沿着环巡回。 为了区别这种情形,令牌被分成白色和黑色两种,进程也分成白色和黑色两种。 接到黑色令牌意味着全局终止还没发生,令牌必须沿着环重新流动. Passing task to previous processes 黑色进程, 把黑色令牌传出去后变白色进程 黑色进程会把令牌染成黑色,白色进程会让令牌以原来的颜色前传。 P0收到黑色令牌,它就发一个白色令牌,若收到白色令牌,则stop 白色令牌 黑色令牌 发白色令牌 树形终止算法 若有m个叶子,根root就得收到m个令牌,然后从root通过树广播 给所有进程,才能全局终止。 传递令牌 令牌1 令牌2 Fixed Energy Distributed Termination Algorithm 固定能量分布式终止算法 固定数值的 “energy”,相当带数值的令牌。 ? 系统开始时,所有能量由主进程持有. ? 主进程把部分能量与任务传送给请求任务的进程. ? 如果这些进程收到任务请求,它会把能量进一步划分传送下去。 ? 若进程空闲,它要在请求新的任务之前把持有的能量返回。 ? 一个进程只有在它发出的能量均已返回,并且组合到所持有的总能量中后,才会交回其能量。 ? 当所有能量返回到主进程,且主进程空闲时,所有进程必定空闲,计算终止。 严重缺陷 –计算精度可能导致各部分能量之和不等于原始总能量. Load balancing/termination detection Example举例 Shortest Path Problem最短路问题 Finding the shortest distance between two points on a graph. It can be stated as follows: Given a set of interconnected nodes where the links between the nodes are marked with “weights,” find the path from one specific node to another specific node that has the smallest accumulated weights. The interconnected nodes can be described by a graph. The nodes are called vertices, and the links are called edges. If the edges have implied directions (that is, an edge can only be traversed in one direction, the graph is a directed graph. Example: The Best Way to Climb a Mountain Graph of mountain climb Weights in graph indicate amount of effort that would be expended in traversing the route between two connected camp sites. The effort in one direction may be different from the effort in the opposite direction (downhill instead of uphill!). (directed graph) Graph Representation Two basic ways that a graph can be represented in a program: 1. Adjacency matrix(邻接矩阵) — a two-dimensional array, a, in which a[i][j] holds the weight associated with the edge between vertex i and vertex j if one exists 2. Adjacency list (邻接表) — for each vertex, a list of
您可能关注的文档
最近下载
- 2024年湖南汽车工程职业学院单招职业技能测试题库及答案(历年真题).docx VIP
- 广东省潮州市2024-2025学年高三上学期期末教学质量检测物理试卷.docx VIP
- 上海电力学院大一机械制图C习题本解答(造福学弟,不谢)-新版.pptx
- 广东省潮州市2024-2025学年高二上学期期末教学质量检测物理试卷(含答案).docx VIP
- 新生儿身份识别制度.pptx
- 康迪泰克空气弹簧.pdf VIP
- LY/T 2817-2017山桐子栽培技术规程.pdf
- 缓刑担保承诺书范文.docx VIP
- 记账实操-电梯保养公司会计账务处理分录.doc
- 脑机接口专利关键技术白皮书-复旦大学-2025.pdf VIP
原创力文档

文档评论(0)