Beispiel #1
0
class Priority_Test(unittest.TestCase):
    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(9)])
        self.program1 = Program("p.exe", [CPUInstruction(2)])
        self.program2 = Program("x.exe", [CPUInstruction(5)])
        self.program3 = Program("e.exe", [CPUInstruction(10)])

        self.hardware = Hardware(memorySize=64)
        self.kernel = Kernel(
            self.hardware, Priority(5),
            Pagination(self.hardware.memory(),
                       self.hardware.mmu(),
                       frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)
        self.fileSystem.save("home/nicolas/program2", self.program2)
        self.fileSystem.save("home/nicolas/program3", self.program3)

    def prioridad_Test(self):
        self.kernel.execute("home/nicolas/program2",
                            3)  # 1 porque cpu esta ociosa
        self.kernel.execute("home/nicolas/program1", 2)  # 4
        self.kernel.execute("home/nicolas/program0", 1)  # 3
        self.kernel.execute("home/nicolas/program3", 0)  # 2
        self.kernel.start_running()
class FCFS_Test(unittest.TestCase):

    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(9)])
        self.program1 = Program("p.exe", [CPUInstruction(5)])
        self.program2 = Program("f.exe", [CPUInstruction(5), IOInstruction(1)])

        self.hardware = Hardware(memorySize = 32)
        self.kernel = Kernel(self.hardware, FCFS(), Pagination(self.hardware.memory(), self.hardware.mmu(), frameSize=2))
        self.fileSystem = self.kernel.fileSystem()


        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)
        self.fileSystem.save("home/nicolas/program2", self.program2)


    def FCFS_Test(self):
        self.kernel.execute("home/nicolas/program0")
        self.kernel.execute("home/nicolas/program1")
        self.kernel.start_running()

    def FCFS_IO_Test(self):
        self.kernel.execute("home/nicolas/program0")
        self.kernel.execute("home/nicolas/program2")
        self.kernel.execute("home/nicolas/program1")
        self.kernel.start_running()
class Mem_Test(unittest.TestCase):

    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(9)])
        self.program2 = Program("s.exe", [CPUInstruction(5), IOInstruction(1)])

        self.hardware = Hardware(memorySize = 32)
        self.kernel = Kernel(self.hardware, FCFS(), Pagination(self.hardware.memory(), self.hardware.mmu(), frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program2", self.program2)


    # frameSize = 2
    # GetFramesForProgram0 --> frames[15,14,13,12,11]
    # pag = pc = 0 / frameSize (2)
    # offset = pc = 0 % frameSize
    # DirFisic = frame * FrameSize (2) + offset
    # Dirs Fisicas --> # PAg0 --> 30, 31 # PAg1 --> 28, 29 # PAg2 --> 26, 27 # etc
    def load_a_Program_Test(self):
        self.kernel.execute("home/nicolas/program0")
        self.kernel.start_running(11)
        print(self.kernel.hardware().memory())


    def load_two_programs_Test(self):
        self.kernel.execute("home/nicolas/program0")
        self.kernel.execute("home/nicolas/program2")
        self.kernel.start_running(25)
        print(self.kernel.hardware().memory())
Beispiel #4
0
class PriorityExp_Test(unittest.TestCase):
    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(3)])
        self.program1 = Program("p.exe", [CPUInstruction(5)])
        self.program2 = Program("t.exe", [CPUInstruction(7)])

        self.hardware = Hardware(memorySize=64)
        self.kernel = Kernel(
            self.hardware, PreemptivePriority(5),
            Pagination(self.hardware.memory(),
                       self.hardware.mmu(),
                       frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)
        self.fileSystem.save("home/nicolas/program2", self.program2)

    def prioridadExp_Simple_Test(self):
        self.kernel.execute("home/nicolas/program0",
                            3)  # 2 CPU esta ociosa y llega program0 primero
        self.kernel.execute(
            "home/nicolas/program1", 2
        )  # 1 # pero luego llega a la cola de listos program1 con una prioridad mayor
        self.kernel.start_running()

    def prioridadExp_Test(self):
        self.kernel.execute("home/nicolas/program0", 3)  # 3
        self.kernel.execute("home/nicolas/program1", 2)  # 1
        self.kernel.start_running(3)  # Ejecuta por 3 ticks
        self.kernel.execute(
            "home/nicolas/program2",
            1)  # 2 Se agrega el prog2 y toma CPU por expropiacion
        self.kernel.start_running()  # Termina de correr todos los progs.
Beispiel #5
0
class SO_Test(unittest.TestCase):
    def setUp(self):
        self.program0 = Program("p.exe", [CPUInstruction(3)])
        self.program1 = Program("t.exe", [CPUInstruction(5)])
        self.program2 = Program("t.exe", [
            IOInstruction(1),
            CPUInstruction(5),
        ])
        self.program3 = Program("f.exe", [
            CPUInstruction(3),
            IOInstruction(1),
        ])

        self.hardware = Hardware(memorySize=32)
        self.kernel = Kernel(
            self.hardware,
            RoundRobin(3, self.hardware.clock(), self.hardware.irqVector()),
            Pagination(self.hardware.memory(),
                       self.hardware.mmu(),
                       frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)
        self.fileSystem.save("home/nicolas/program2", self.program2)
        self.fileSystem.save("home/nicolas/program3", self.program3)

    def test_RR(self):
        self.kernel.execute("home/nicolas/program0")
        self.kernel.execute("home/nicolas/program1")
        self.kernel.start_running()

    def test_RR_IO(self):
        self.kernel.execute("home/nicolas/program2")
        self.kernel.execute("home/nicolas/program1")
        self.kernel.execute("home/nicolas/program3")
        self.kernel.start_running()
class Priority_Test(unittest.TestCase):
    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(3)])
        self.program1 = Program("p.exe", [CPUInstruction(5)])
        self.program2 = Program("e.exe", [CPUInstruction(10)])

        self.hardware = Hardware(memorySize=32)
        self.kernel = Kernel(
            self.hardware, Priority(5),
            Pagination(self.hardware.memory(),
                       self.hardware.mmu(),
                       frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)
        self.fileSystem.save("home/nicolas/program2", self.program2)

        self.scheduler = self.kernel.scheduler()
        self.pcbTable = self.kernel.pcbTable()
        self.cpu = self.kernel.hardware().cpu()

    def priority_Test(self):
        self.kernel.execute(
            "home/nicolas/program0",
            3)  # CPU esta ociosa y llega program0 primero, se ejecuta primero
        self.kernel.execute("home/nicolas/program1",
                            2)  # Llega program1 1 pero se ejecuta ultimo
        self.kernel.execute("home/nicolas/program2",
                            1)  # Llega program2 y se ejecuta segundo
        self.kernel.start_running(2)  # Ejecuto 2 ticks
        self.assertTrue(len(self.scheduler.getReadyQueue()),
                        2)  # La cola de listos tiene 2 pcbs, de program1 y 2
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         0)  # verifico que tiene el pid para program0
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        self.kernel.start_running(
            2)  # Ejecuta los ticks necesarios para terminar program0
        self.assertTrue(
            len(self.scheduler.getReadyQueue()),
            1)  # La cola de listos tiene solo un pcb, el de program1
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         2)  # el pid de program2, que tiene mayor prioridad
        self.assertEqual(self.cpu.getPCB().getPid(), 2)
        self.kernel.start_running(
            11)  # Ejecuta los ticks necesarios para terminar program2
        self.assertTrue(len(self.scheduler.getReadyQueue()),
                        0)  # La cola de listos ya no tiene pcbs
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         1)  # el pid de program1
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        print(self.kernel.hardware().memory())
Beispiel #7
0
class PreemptivePriority_Algorithm_Test(unittest.TestCase):
    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(3)])
        self.program1 = Program("p.exe", [CPUInstruction(5)])

        self.hardware = Hardware(memorySize=32)
        self.kernel = Kernel(
            self.hardware, PreemptivePriority(5),
            Pagination(self.hardware.memory(),
                       self.hardware.mmu(),
                       frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)

        self.scheduler = self.kernel.scheduler()
        self.pcbTable = self.kernel.pcbTable()
        self.cpu = self.kernel.hardware().cpu()

    # Agrego un prog le ejecuto 2 ticks, agrego otro con mayor prioridad el cual expropia Cpu, este termina y se vuelve a ejecutar
    # el primer programa
    def prioridadExp_Test(self):
        self.kernel.execute("home/nicolas/program0",
                            3)  # CPU esta ociosa y llega program0 primero
        self.kernel.start_running(2)  # Ejecuta por 2 ticks
        self.assertTrue(self.scheduler.isEmpty(
        ))  # la cola de listos pasa a estar vacia, program0 esta en Cpu
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 0)
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        self.kernel.execute("home/nicolas/program1",
                            2)  # llega program1 y expropia Cpu
        self.kernel.start_running(2)  # Ejecuta 2 ticks
        self.assertTrue(len(self.scheduler.getReadyQueue()),
                        1)  # la cola de listos tiene el pcb de program0
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.kernel.start_running(
            4
        )  # Despues de 6 ticks program1 termina, y vuelve a ejecutar program0
        self.assertTrue(len(self.scheduler.getReadyQueue()), 0)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 0)
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        print(self.kernel.hardware().memory())
class FCFS_Test(unittest.TestCase):
    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(10)])
        self.program1 = Program("p.exe", [CPUInstruction(5)])
        self.program2 = Program("x.exe", [
            IOInstruction(1),
            CPUInstruction(2),
        ])

        self.hardware = Hardware(memorySize=64)
        self.kernel = Kernel(
            self.hardware, FCFS(),
            Pagination(self.hardware.memory(),
                       self.hardware.mmu(),
                       frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)
        self.fileSystem.save("home/nicolas/program2", self.program2)

        self.scheduler = self.kernel.scheduler()
        self.pcbTable = self.kernel.pcbTable()
        self.cpu = self.kernel.hardware().cpu()
        self.waitingQueue = self.kernel.hardware().IOdevice().getWaitingQueue()

    def FCFS_Test(self):
        self.kernel.execute("home/nicolas/program0")
        self.kernel.execute("home/nicolas/program1")
        self.kernel.start_running(2)  # Ejecuto 2 ticks
        self.assertEqual(self.scheduler.getReadyQueue().qsize(),
                         1)  # La cola de listos tiene el pcb de program1
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         0)  # el pid de program0
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        self.kernel.start_running(
            9)  # debe cambiar de contexto a program1, program0 termino
        self.assertEqual(self.scheduler.getReadyQueue().qsize(),
                         0)  # Program1 termino, program0 esta en Cpu
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         1)  # el pid de program1
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.kernel.start_running(3)  # ejecuto tres instrucciones de program1
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 0)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.kernel.start_running(
            3)  # ejecuto las instrucciones que quedan de program1
        self.assertEqual(
            self.cpu.getPC(),
            -1)  # Cpu esta ociosa [en realidad deberia ser pc = -1]
        print(self.kernel.hardware().memory())

    def FCFS_IO_Test(self):
        self.kernel.execute("home/nicolas/program2")
        self.kernel.execute("home/nicolas/program0")
        self.kernel.start_running(
            1)  # ejecuto un tick, program 2 tira una interrupcion de IO
        self.assertEqual(
            self.scheduler.getReadyQueue().qsize(),
            0)  # vacia, program2 esta haciendo IO, program0 en Cpu
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         1)  # el pid de program0
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.assertEqual(self.waitingQueue.qsize(), 1)  # el pcb de program2
        self.kernel.start_running(6)  # program2 termina IO y pasa a readyQueue
        self.assertEqual(self.scheduler.getReadyQueue().qsize(),
                         1)  # program0 sigue ejecutando
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.kernel.start_running(5)  # program0 termina
        self.assertEqual(self.scheduler.getReadyQueue().qsize(),
                         0)  # program2 esta en Cpu
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         0)  # el pid de program2
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        self.kernel.start_running(3)  # termina program2
        print(self.kernel.hardware().memory())
Beispiel #9
0
class PaginationTest(unittest.TestCase):

    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(10)])
        self.program2 = Program("x.exe", [IOInstruction(1),
                                           CPUInstruction(60),
                                           ])

        self.program3 = Program("f.exe", [CPUInstruction(65)]) # Programa demasiado grande para la memoria disponible


        self.hardware = Hardware(memorySize=64)
        self.kernel = Kernel(self.hardware, FCFS(), Pagination(self.hardware.memory(), self.hardware.mmu(), frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program2", self.program2)
        self.fileSystem.save("home/nicolas/program3", self.program3)


        self.scheduler = self.kernel.scheduler()
        self.pcbTable = self.kernel.pcbTable()
        self.cpu = self.kernel.hardware().cpu()
        self.waitingQueue = self.kernel.hardware().IOdevice().getWaitingQueue()


    def load_program_Test(self):
        self.assertEqual(self.fileSystem.get("home/nicolas/program0"), self.program0)
        program0 = self.fileSystem.get("home/nicolas/program0")
        self.assertEqual(self.kernel.memoryManager().freeFramesLength(), 32)
        self.assertEqual(self.kernel.memoryManager().cantPages(program0), 6)
        self.assertEqual(self.kernel.memoryManager().freeFrames(), [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
                                                                    21,22,23,24,25,26,27,28,29,30,31])
        self.assertEqual(self.kernel.memoryManager().generatePageTable([26,27,28,29,30,31], program0).getFrames(), [26,27,28,
                                                                                                                    29,30,31])
        self.kernel.execute("home/nicolas/program0")
        self.kernel.start_running(1) # Ejecuto 1 tick
        self.assertEqual(self.kernel.memoryManager().freeFramesLength(), 26)
        self.assertEqual(self.kernel.memoryManager().freeFrames(),
                         [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])
        self.assertEqual(self.pcbTable.runningPcb().pageTable().getFrames(), [31,30,29,28,27,26])

    def pagination_memory_Test(self):
        self.kernel.execute("home/nicolas/program0") # El programa tiene 11 instrucciones, 10 de Cpu y una de Exit
        self.assertEqual(type(self.kernel.hardware().memory().get(62)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(63)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(60)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(61)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(58)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(59)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(56)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(57)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(54)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(55)).__name__, type(CPUInstruction(0)).__name__)
        self.assertEqual(type(self.kernel.hardware().memory().get(52)).__name__, type(EXITInstruction(0)).__name__)
        for x in range(0, 52): # 52 no incluye
            self.assertEqual(self.kernel.hardware().memory().get(x), 'trash')
        self.assertEqual(self.kernel.hardware().memory().get(53), 'trash')


    def no_enough_memory_Test(self):
        with self.assertRaises(NotEnoughSpaceInMemoryException):
            self.kernel.execute("home/nicolas/program3")

    def no_program_available_Test(self):
        with self.assertRaises(ProgramNotAvailableException):
            self.kernel.execute("home/nicolas/programNoHay")

    def put_one_program_try_put_another_but_there_is_no_memory_Test(self):
        self.kernel.execute("home/nicolas/program0") # program0 tiene 11 instrucciones
        self.kernel.start_running(3) # ejecuto 3 ticks, program0 no libero su memoria
        with self.assertRaises(NotEnoughSpaceInMemoryException): # Llega un programa de 62 instrucciones
            self.kernel.execute("home/nicolas/program2") # como la memoria disp es 64 pero ambos progs ocupan 62 + 11 inst, no hay mem suficiente


    # Ahora pongo los mismos progs. que antes pero como program0 termina libera su memoria y program3 tiene suficiente para ejecutarse
    def put_one_program_try_put_another_Test(self):
        self.kernel.execute("home/nicolas/program0") # program0 tiene 11 instrucciones
        self.kernel.start_running(11) # ejecuto 11 ticks, program0 termina, libera su mem y puede cargarse program3
        self.kernel.execute("home/nicolas/program2") # Llega un programa de 62 instrucciones como program0 termino libero 11 lugares en mem
Beispiel #10
0
class RoundRobin_Test(unittest.TestCase):
    def setUp(self):
        self.program0 = Program("t.exe", [CPUInstruction(10)])
        self.program1 = Program("p.exe", [CPUInstruction(5)])
        self.program2 = Program("t.exe", [
            IOInstruction(1),
            CPUInstruction(2),
        ])

        self.hardware = Hardware(memorySize=32)
        self.kernel = Kernel(
            self.hardware,
            RoundRobin(3, self.hardware.clock(), self.hardware.irqVector()),
            Pagination(self.hardware.memory(),
                       self.hardware.mmu(),
                       frameSize=2))
        self.fileSystem = self.kernel.fileSystem()

        # Load programs
        self.fileSystem.save("home/nicolas/program0", self.program0)
        self.fileSystem.save("home/nicolas/program1", self.program1)
        self.fileSystem.save("home/nicolas/program2", self.program2)

        self.scheduler = self.kernel.scheduler()
        self.pcbTable = self.kernel.pcbTable()
        self.cpu = self.kernel.hardware().cpu()
        self.waitingQueue = self.kernel.hardware().IOdevice().getWaitingQueue()

    def RR_Test(self):
        self.kernel.execute("home/nicolas/program0")
        self.kernel.execute("home/nicolas/program1")
        self.kernel.start_running(3)  # Ejecuto 3 ticks, el quantum
        self.assertEqual(self.scheduler.getReadyQueue().qsize(),
                         1)  # La cola de listos tiene el pcb de program1
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         0)  # el pid de program0
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        self.kernel.start_running(
            3)  # cambia de proceso, debe ejecutar program1
        self.assertEqual(self.scheduler.getReadyQueue().qsize(),
                         1)  # La cola de listos tiene el pcb de program0
        self.assertEqual(self.pcbTable.runningPcb().getPid(),
                         1)  # el pid de program1
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.kernel.start_running(3)
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 1)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 0)
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        self.kernel.start_running(2)  # los ticks que le quedan a program 1
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 1)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.kernel.start_running(1)
        self.assertEqual(self.scheduler.getReadyQueue().qsize(),
                         0)  # ya no esta program1
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 0)
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        print(self.kernel.hardware().memory())

    def RR_IO_Test(self):
        self.kernel.execute("home/nicolas/program2")
        self.kernel.execute("home/nicolas/program0")
        self.kernel.start_running(1)
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 0)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.assertEqual(self.waitingQueue.qsize(), 1)
        self.kernel.start_running(2)
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 0)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.assertEqual(self.waitingQueue.qsize(), 0)
        self.kernel.start_running(3)
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 0)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        self.kernel.start_running(3)
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 1)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 0)
        self.assertEqual(self.cpu.getPCB().getPid(), 0)
        self.kernel.start_running(3)
        self.assertEqual(self.scheduler.getReadyQueue().qsize(), 0)
        self.assertEqual(self.pcbTable.runningPcb().getPid(), 1)
        self.assertEqual(self.cpu.getPCB().getPid(), 1)
        print(self.kernel.hardware().memory())