forked from codehouseindia/Python-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLSUR_ago.py
More file actions
27 lines (24 loc) · 685 Bytes
/
LSUR_ago.py
File metadata and controls
27 lines (24 loc) · 685 Bytes
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
frames = []
page_fault = 0
try :
frame_num = int(input("Enter Number of frames that you want : "))
page_no = input("Enter the page number seperate with dot(.) : ")
page_list = page_no.split('.')
except Exception as e :
print(e)
for page in page_list :
if (len(frames) == frame_num) :
if page not in frames :
frames.pop(0)
frames.append(page)
print(frames)
page_fault += 1
else :
element = frames.pop(0)
frames.append(element)
else :
if page not in frames :
frames.append(page)
print(frames)
page_fault += 1
print(page_fault)