public static int insertPage(int spn, int ppn) { swapLock.acquire(); int numBits = swapFile.write(spn * PAGESIZE, memory, ppn * PAGESIZE, PAGESIZE); // assert that numBits == PAGESIZE allocatedPages.add(spn); swapLock.release(); return spn; }