📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "最少使用置换策略(LFU)"
ClientHeight = 5280
ClientLeft = 4800
ClientTop = 3015
ClientWidth = 5580
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 5280
ScaleWidth = 5580
Begin VB.TextBox Text3
Height = 270
Index = 4
Left = 2715
Locked = -1 'True
TabIndex = 37
Text = "0"
Top = 3345
Width = 255
End
Begin VB.TextBox Text3
Height = 270
Index = 3
Left = 2715
Locked = -1 'True
TabIndex = 36
Text = "0"
Top = 2985
Width = 255
End
Begin VB.TextBox Text3
Height = 270
Index = 2
Left = 2715
Locked = -1 'True
TabIndex = 35
Text = "0"
Top = 2670
Width = 255
End
Begin VB.TextBox Text3
Height = 270
Index = 1
Left = 2715
Locked = -1 'True
TabIndex = 34
Text = "0"
Top = 2385
Width = 255
End
Begin VB.TextBox Text3
Height = 270
Index = 0
Left = 2715
Locked = -1 'True
TabIndex = 33
Text = "0"
Top = 2070
Width = 255
End
Begin VB.TextBox Text2
BackColor = &H00C0E0FF&
Height = 270
Index = 4
Left = 3030
Locked = -1 'True
TabIndex = 32
Text = "600"
Top = 3345
Width = 855
End
Begin VB.TextBox Text2
BackColor = &H00C0E0FF&
Height = 270
Index = 3
Left = 3030
Locked = -1 'True
TabIndex = 31
Text = "500"
Top = 2985
Width = 855
End
Begin VB.TextBox Text2
BackColor = &H00C0E0FF&
Height = 270
Index = 2
Left = 3030
Locked = -1 'True
TabIndex = 30
Text = "400"
Top = 2670
Width = 855
End
Begin VB.TextBox Text2
BackColor = &H00C0E0FF&
Height = 270
Index = 1
Left = 3030
Locked = -1 'True
TabIndex = 29
Text = "200"
Top = 2385
Width = 855
End
Begin VB.TextBox Text6
BackColor = &H00C0FFC0&
Height = 270
Index = 4
Left = 1200
Locked = -1 'True
TabIndex = 24
Top = 3360
Width = 1455
End
Begin VB.TextBox Text6
BackColor = &H00C0FFC0&
Height = 270
Index = 3
Left = 1200
Locked = -1 'True
TabIndex = 23
Top = 3000
Width = 1455
End
Begin VB.TextBox Text6
BackColor = &H00C0FFC0&
Height = 270
Index = 2
Left = 1200
Locked = -1 'True
TabIndex = 22
Top = 2670
Width = 1455
End
Begin VB.TextBox Text6
BackColor = &H00C0FFC0&
Height = 270
Index = 1
Left = 1200
Locked = -1 'True
TabIndex = 21
Top = 2400
Width = 1455
End
Begin VB.TextBox Text13
Height = 270
Left = 0
TabIndex = 20
Top = 4320
Width = 975
End
Begin VB.TextBox Text2
BackColor = &H00C0E0FF&
Height = 270
Index = 0
Left = 3030
Locked = -1 'True
TabIndex = 19
Text = "300"
Top = 2040
Width = 855
End
Begin VB.CommandButton Command3
Caption = "调入新页面(&N)"
Height = 375
Left = 2040
TabIndex = 16
Top = 4800
Width = 1335
End
Begin VB.TextBox Text1
BackColor = &H00C0E0FF&
ForeColor = &H00000000&
Height = 270
Left = 2520
TabIndex = 15
Top = 4155
Width = 1335
End
Begin VB.Timer Timer1
Interval = 1000
Left = 4200
Top = 3240
End
Begin VB.CommandButton Command2
Caption = "退出模拟器(&E)"
Height = 375
Left = 3480
TabIndex = 3
Top = 4800
Width = 1425
End
Begin VB.TextBox Text11
BackColor = &H00C0E0FF&
Height = 270
Left = 2520
TabIndex = 2
Top = 4455
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "进行访问(&R)"
Default = -1 'True
Height = 375
Left = 480
TabIndex = 1
Top = 4800
Width = 1425
End
Begin VB.TextBox Text6
BackColor = &H00C0FFC0&
Height = 270
Index = 0
Left = 1200
Locked = -1 'True
TabIndex = 0
Top = 2070
Width = 1455
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "状态"
ForeColor = &H00FF0000&
Height = 255
Left = 2670
TabIndex = 38
Top = 1800
Width = 495
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "2000"
ForeColor = &H00FF0000&
Height = 255
Left = 4995
TabIndex = 28
Top = 4155
Width = 495
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "总内存:"
ForeColor = &H00FF0000&
Height = 255
Left = 4230
TabIndex = 27
Top = 4155
Width = 735
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "剩余量:"
ForeColor = &H00FF0000&
Height = 255
Left = 4230
TabIndex = 26
Top = 4455
Width = 735
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Height = 255
Left = 4965
TabIndex = 25
Top = 4440
Width = 495
End
Begin VB.Line Line8
X1 = 1200
X2 = 3960
Y1 = 3645
Y2 = 3645
End
Begin VB.Line Line7
X1 = 1200
X2 = 3960
Y1 = 3300
Y2 = 3300
End
Begin VB.Line Line6
X1 = 1200
X2 = 3960
Y1 = 2955
Y2 = 2955
End
Begin VB.Line Line5
X1 = 1185
X2 = 3960
Y1 = 2640
Y2 = 2655
End
Begin VB.Line Line4
X1 = 1200
X2 = 3960
Y1 = 2340
Y2 = 2340
End
Begin VB.Line Line3
X1 = 1200
X2 = 3960
Y1 = 2040
Y2 = 2040
End
Begin VB.Label Label18
BackStyle = 0 'Transparent
Caption = "计时器(20)回跳"
ForeColor = &H00FF0000&
Height = 255
Left = 1200
TabIndex = 18
Top = 1800
Width = 1455
End
Begin VB.Label Label17
BackStyle = 0 'Transparent
Caption = "内存量"
ForeColor = &H00FF0000&
Height = 255
Left = 3075
TabIndex = 17
Top = 1800
Width = 720
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "调入新页面大小"
ForeColor = &H00FF0000&
Height = 255
Left = 1200
TabIndex = 14
Top = 4200
Width = 1335
End
Begin VB.Label Label3
BackColor = &H00FF0000&
BackStyle = 0 'Transparent
Caption = "访问页面(0~4)"
ForeColor = &H00FF0000&
Height = 255
Left = 1320
TabIndex = 13
Top = 4485
Width = 1335
End
Begin VB.Label Label16
BackStyle = 0 'Transparent
Caption = "Copyright(c) by 104-stdio"
Height = 255
Left = 1440
TabIndex = 12
Top = 60
Width = 2295
End
Begin VB.Label Label15
BackStyle = 0 'Transparent
Caption = "页面0"
Height = 255
Left = 645
TabIndex = 11
Top = 2115
Width = 495
End
Begin VB.Label Label14
BackStyle = 0 'Transparent
Caption = "页面4"
Height = 255
Left = 645
TabIndex = 10
Top = 3390
Width = 495
End
Begin VB.Label Label13
BackStyle = 0 'Transparent
Caption = "页面3"
Height = 255
Left = 645
TabIndex = 9
Top = 3060
Width = 495
End
Begin VB.Label Label12
BackStyle = 0 'Transparent
Caption = "页面2"
Height = 255
Left = 645
TabIndex = 8
Top = 2760
Width = 495
End
Begin VB.Label Label11
BackStyle = 0 'Transparent
Caption = "页面1"
Height = 255
Left = 645
TabIndex = 7
Top = 2445
Width = 495
End
Begin VB.Label Label10
BackColor = &H00C0FFC0&
Height = 255
Left = 4950
TabIndex = 6
Top = 3825
Width = 615
End
Begin VB.Label Label9
BackStyle = 0 'Transparent
Caption = "作业页:"
ForeColor = &H00FF0000&
Height = 255
Left = 4230
TabIndex = 5
Top = 3855
Width = 735
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "虚拟内存"
ForeColor = &H00FF0000&
Height = 735
Left = 2520
TabIndex = 4
Top = 780
Width = 255
End
Begin VB.Line Line2
BorderColor = &H80000001&
BorderWidth = 3
X1 = 3960
X2 = 3960
Y1 = 510
Y2 = 3990
End
Begin VB.Line Line1
BorderColor = &H80000001&
BorderWidth = 3
X1 = 1155
X2 = 1155
Y1 = 480
Y2 = 3960
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sum As Integer
Public a, b, c, d, e As Integer
Public s As Integer
Private Sub Command1_Click()
If Text11.Text <> "" And Val(Text11.Text) >= 0 And Val(Text11.Text) < 5 Then
Text3(Val(Text11.Text)).Text = 1
Else
MsgBox "请输入要进行访问的作业序列号!"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
s = sum
If Text1.Text > s Then
For i = 0 To 4
If Val(Text3(i).Text) = 0 Then
s = s + Text2(i).Text
If s >= Val(Text1.Text) Then
Text2(i).Text = Val(Text1.Text)
sum = s - Text1.Text
Label8.Caption = sum
GoTo a:
Else
GoTo b:
End If
Else
MsgBox "即使拿回现在运行的空间也不足也!"
End If
b: Next i
End If
a:
End Sub
Private Sub Form_Activate()
Text11.SetFocus
Label8.Caption = 0
End Sub
Private Sub Form_Load()
sum = 0
s = 0
End Sub
Private Sub Timer1_Timer()
a = a + 1
b = b + 1
c = c + 1
d = d + 1
e = e + 1
Text6(4).Text = a
Text6(3).Text = b
Text6(2).Text = c
Text6(1).Text = d
Text6(0).Text = e
If a = 20 Then
a = 0
b = 0
c = 0
d = 0
e = 0
For i = 0 To 4
Text3(i).Text = 0
Next i
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -