示例#1
0
文件: orig.py 项目: sghosh1991/Asynch
def main():
    nprocs = (int(sys.argv[1]) if (len(sys.argv) > 1) else 10)
    nrequests = (int(sys.argv[2]) if (len(sys.argv) > 2) else 1)
    da.config(channel='fifo', clock='Lamport')
    ps = da.new(P, num=nprocs)
    for p in ps:
        da.setup(p, ((ps - {p}), nrequests))
    da.start(ps)
示例#2
0
def main():
    nprocs = (int(sys.argv[1]) if (len(sys.argv) > 1) else 10)
    nrounds = (int(sys.argv[2]) if (len(sys.argv) > 2) else 1)
    da.config(clock='Lamport')
    ps = da.new(P, num=nprocs)
    mainProc = da.new(X, num=1)
    for p in mainProc:
        da.setup({p}, (nprocs, {}, mainProc))
    da.start(mainProc)
    for p in ps:
        da.setup({p}, ((ps - {p}), nrounds, {}, mainProc))
    da.start(ps)