 	u32 leastEntry = DNE;
 	u32 leastTime  = DNE;
 	for (u32 i = 0; i < PAGE_ENTRIES; i++) {
-		if (leastTime > getLastUsedTime(pageTable[i])) {
+		if (leastTime > getLastUsedTime(pageTable[i]) && threadIdx.x == getPid(pageTable[i])) {
 			leastTime = getLastUsedTime(pageTable[i]);
 			leastEntry = i;
 		}

const uint32_t INVALID			= 0;
const uint32_t PAGENUMBERMASK	= 0x00003FFE;
const uint32_t LASTTIMEMASK		= 0xFFFFC000;
const uint32_t DNE				= 0xFFFFFFFF;

// Lock & Unlock

		storage[toStorageAddress] = memory[memoryAddress];
		memory[memoryAddress] = storage[storageAddress];
	}
	pageTable[leastEntry] = makePTE(threadIdx.x, CURRENTTIME, pageNumber, VALID);
	return leastEntry * PAGE_SIZE + pageOffset;
}

