HTMLify

Page Replacment Algotithems in Python
Views: 226 | Author: abh
# Page Replacment Smulator

def FIFO(string: list["anything"], frames=3):
    page = [None]*frames
    pages = []
    status = []
    i = 0
    for c in string:
        if c in page:
            status.append(True)
        else:
            status.append(False)
            page[i] = c
            i = (i+1)%frames
        pages.append(page.copy())
    return pages, status, (status.count(True)/len(status))

# LRU function to be added

Comments

sabkacode 2023-10-30 17:18

abh 2023-11-01 19:31