struct set{ struct line *head; } struct line{ char valid; int tag; char block[30]; struct line *next; } // JUST PSEUDOCODE char * searchInSet(int address, struct **head){ line selectedLine = search(address, head); if(selectedLine != null){ //cache hit! moveToFront(head, selectedLine); return selectedLine.block; } else{ //cache miss line invalidLine = findInvalidLine(head); if(invalidLine != null){ // WE Have an empty line! //replace invalid line with block read from lower //level memory replaceLine(head, invalidLine, {block read from lower memory}) } else{ // We don't have an empty line. So choose the least // recently used line line lastLine = getLastNode(head); replaceLine(head, lastLine, {block read from lower memory}); moveToFront(getLastNode(head)) //Move the newly inserted block to } } }