Example #1
0
def test():
    PCB.createInitProcess()
    print(PCB.current_process.ID)

    PCB.createNewProcess("x", 2)
    print(PCB.current_process.ID)

    PCB.createNewProcess("y", 1)
    print(PCB.current_process.ID)

    PCB.processTimeOut()
    print(PCB.current_process.ID)

    PCB.createNewProcess("z", 2)
    print(PCB.current_process.ID)

    PCB.processTimeOut()
    print(PCB.current_process.ID)

    PCB.requestResource("R1", 1)
    print(PCB.current_process.ID)

    PCB.processTimeOut()
    print(PCB.current_process.ID)

    PCB.requestResource("R1", 1)
    print(PCB.current_process.ID)

    PCB.deleteProcess("z")
    print(PCB.current_process.ID)

    PCB.releaseResource("R1", 1)
    print(PCB.current_process.ID)

    PCB.deleteProcess("x")
    print(PCB.current_process.ID)
Example #2
0
    PCB.createNewProcess("z", 2)
    print(PCB.current_process.ID)

    PCB.processTimeOut()
    print(PCB.current_process.ID)

    PCB.requestResource("R1", 1)
    print(PCB.current_process.ID)

    PCB.processTimeOut()
    print(PCB.current_process.ID)

    PCB.requestResource("R1", 1)
    print(PCB.current_process.ID)

    PCB.deleteProcess("z")
    print(PCB.current_process.ID)

    PCB.releaseResource("R1", 1)
    print(PCB.current_process.ID)

    PCB.deleteProcess("x")
    print(PCB.current_process.ID)



if __name__ == '__main__':
    #test()
    PCB.createInitProcess()
    readFile()