www.pudn.com > j1.rar > Form1.frm
VERSION 5.00
Begin VB.Form Form1
BackColor = &H80000018&
Caption = "Form1"
ClientHeight = 8910
ClientLeft = 60
ClientTop = 345
ClientWidth = 10140
LinkTopic = "Form1"
ScaleHeight = 8910
ScaleWidth = 10140
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "退出"
Height = 375
Left = 8640
TabIndex = 141
Top = 8280
Width = 735
End
Begin VB.CommandButton cmdUpdate
Caption = "刷新"
Height = 375
Left = 8520
TabIndex = 130
Top = 5160
Width = 855
End
Begin VB.TextBox TxtResult
Height = 2535
Left = 8520
MultiLine = -1 'True
TabIndex = 127
Top = 2160
Width = 1455
End
Begin VB.CheckBox Check1
Height = 300
Index = 9
Left = 7560
TabIndex = 126
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 8
Left = 6960
TabIndex = 125
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 7
Left = 6240
TabIndex = 124
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 6
Left = 5520
TabIndex = 123
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 5
Left = 4920
TabIndex = 122
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 4
Left = 4200
TabIndex = 121
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 3
Left = 3480
TabIndex = 120
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 2
Left = 2760
TabIndex = 119
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 1
Left = 2040
TabIndex = 118
Top = 7680
Width = 300
End
Begin VB.CheckBox Check1
Height = 300
Index = 0
Left = 1320
TabIndex = 117
Top = 7680
Width = 300
End
Begin VB.CommandButton cmdShow
Caption = " 演示"
Height = 375
Left = 8280
TabIndex = 116
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 400
Index = 99
Left = 7440
TabIndex = 115
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 98
Left = 7440
TabIndex = 114
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 97
Left = 7440
TabIndex = 113
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 96
Left = 7440
TabIndex = 112
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 95
Left = 7440
TabIndex = 111
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 94
Left = 7440
TabIndex = 110
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 93
Left = 7440
TabIndex = 109
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 92
Left = 7440
TabIndex = 108
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 91
Left = 7440
TabIndex = 107
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 90
Left = 7440
TabIndex = 106
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 89
Left = 6840
TabIndex = 105
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 88
Left = 6840
TabIndex = 104
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 87
Left = 6840
TabIndex = 103
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 86
Left = 6840
TabIndex = 102
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 85
Left = 6840
TabIndex = 101
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 84
Left = 6840
TabIndex = 100
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 83
Left = 6840
TabIndex = 99
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 82
Left = 6840
TabIndex = 98
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 81
Left = 6840
TabIndex = 97
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 80
Left = 6840
TabIndex = 96
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 79
Left = 6120
TabIndex = 95
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 78
Left = 6120
TabIndex = 94
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 77
Left = 6120
TabIndex = 93
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 76
Left = 6120
TabIndex = 92
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 75
Left = 6120
TabIndex = 91
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 74
Left = 6120
TabIndex = 90
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 73
Left = 6120
TabIndex = 89
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 72
Left = 6120
TabIndex = 88
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 71
Left = 6120
TabIndex = 87
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 70
Left = 6120
TabIndex = 86
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 69
Left = 5400
TabIndex = 85
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 68
Left = 5400
TabIndex = 84
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 67
Left = 5400
TabIndex = 83
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 66
Left = 5400
TabIndex = 82
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 65
Left = 5400
TabIndex = 81
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 64
Left = 5400
TabIndex = 80
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 63
Left = 5400
TabIndex = 79
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 62
Left = 5400
TabIndex = 78
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 61
Left = 5400
TabIndex = 77
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 60
Left = 5400
TabIndex = 76
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 59
Left = 4800
TabIndex = 75
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 58
Left = 4800
TabIndex = 74
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 57
Left = 4800
TabIndex = 73
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 56
Left = 4800
TabIndex = 72
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 55
Left = 4800
TabIndex = 71
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 54
Left = 4800
TabIndex = 70
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 53
Left = 4800
TabIndex = 69
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 52
Left = 4800
TabIndex = 68
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 51
Left = 4800
TabIndex = 67
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 50
Left = 4800
TabIndex = 66
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 49
Left = 4080
TabIndex = 65
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 48
Left = 4080
TabIndex = 64
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 47
Left = 4080
TabIndex = 63
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 46
Left = 4080
TabIndex = 62
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 45
Left = 4080
TabIndex = 61
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 44
Left = 4080
TabIndex = 60
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 43
Left = 4080
TabIndex = 59
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 42
Left = 4080
TabIndex = 58
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 41
Left = 4080
TabIndex = 57
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 40
Left = 4080
TabIndex = 56
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 39
Left = 3360
TabIndex = 55
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 38
Left = 3360
TabIndex = 54
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 37
Left = 3360
TabIndex = 53
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 36
Left = 3360
TabIndex = 52
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 35
Left = 3360
TabIndex = 51
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 34
Left = 3360
TabIndex = 50
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 33
Left = 3360
TabIndex = 49
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 32
Left = 3360
TabIndex = 48
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 31
Left = 3360
TabIndex = 47
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 30
Left = 3360
TabIndex = 46
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 29
Left = 2640
TabIndex = 45
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 28
Left = 2640
TabIndex = 44
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 27
Left = 2640
TabIndex = 43
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 26
Left = 2640
TabIndex = 42
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 25
Left = 2640
TabIndex = 41
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 24
Left = 2640
TabIndex = 40
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 23
Left = 2640
TabIndex = 39
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 22
Left = 2640
TabIndex = 38
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 21
Left = 2640
TabIndex = 37
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 20
Left = 2640
TabIndex = 36
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 19
Left = 1920
TabIndex = 35
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 18
Left = 1920
TabIndex = 34
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 17
Left = 1920
TabIndex = 33
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 16
Left = 1920
TabIndex = 32
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 15
Left = 1920
TabIndex = 31
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 14
Left = 1920
TabIndex = 30
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 13
Left = 1920
TabIndex = 29
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 12
Left = 1920
TabIndex = 28
Top = 3165
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 11
Left = 1920
TabIndex = 27
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 10
Left = 1920
TabIndex = 26
Top = 2040
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 9
Left = 1200
TabIndex = 25
Top = 7080
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 8
Left = 1200
TabIndex = 24
Top = 6525
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 7
Left = 1200
TabIndex = 23
Top = 5955
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 6
Left = 1200
TabIndex = 22
Top = 5400
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 5
Left = 1200
TabIndex = 21
Top = 4845
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 4
Left = 1200
TabIndex = 20
Top = 4275
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 3
Left = 1200
TabIndex = 19
Top = 3720
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 2
Left = 1200
TabIndex = 18
Top = 3165
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 0
Left = 1200
TabIndex = 17
Top = 1320
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 1
Left = 1200
TabIndex = 16
Top = 2595
Width = 400
End
Begin VB.TextBox Text1
Height = 400
Index = 0
Left = 1200
TabIndex = 15
Top = 2040
Width = 400
End
Begin VB.ComboBox Combo1
Height = 315
ItemData = "Form1.frx":0000
Left = 5640
List = "Form1.frx":000A
TabIndex = 4
Top = 360
Width = 1455
End
Begin VB.TextBox Txtych
Height = 375
Left = 3960
TabIndex = 3
Top = 360
Width = 735
End
Begin VB.TextBox TxtBlock
Height = 375
Left = 2130
TabIndex = 1
Top = 360
Width = 735
End
Begin VB.TextBox TxtPage
Height = 400
Index = 1
Left = 1920
TabIndex = 6
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 2
Left = 2610
TabIndex = 7
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 3
Left = 3300
TabIndex = 8
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 4
Left = 3990
TabIndex = 9
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 5
Left = 4680
TabIndex = 10
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 6
Left = 5370
TabIndex = 11
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 7
Left = 6060
TabIndex = 12
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 8
Left = 6750
TabIndex = 13
Top = 1320
Width = 400
End
Begin VB.TextBox TxtPage
Height = 400
Index = 9
Left = 7440
TabIndex = 14
Top = 1320
Width = 400
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "10"
Height = 195
Left = 7560
TabIndex = 140
Top = 1080
Width = 180
End
Begin VB.Label Label14
AutoSize = -1 'True
Caption = "9"
Height = 195
Left = 6855
TabIndex = 139
Top = 1080
Width = 90
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "8"
Height = 195
Left = 6135
TabIndex = 138
Top = 1080
Width = 90
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "7"
Height = 195
Left = 5430
TabIndex = 137
Top = 1080
Width = 90
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "6"
Height = 195
Left = 4800
TabIndex = 136
Top = 1080
Width = 90
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "5"
Height = 195
Left = 4080
TabIndex = 135
Top = 1080
Width = 90
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "4"
Height = 195
Left = 3480
TabIndex = 134
Top = 1080
Width = 90
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "3"
Height = 195
Left = 2760
TabIndex = 133
Top = 1080
Width = 90
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "2"
Height = 195
Left = 2040
TabIndex = 132
Top = 1080
Width = 90
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "1"
Height = 195
Left = 1320
TabIndex = 131
Top = 1080
Width = 90
End
Begin VB.Label Label5
AutoSize = -1 'True
BackColor = &H80000018&
Caption = "输入页面流"
Height = 195
Left = 0
TabIndex = 129
Top = 1320
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
BackColor = &H80000018&
Caption = "运行结果"
Height = 195
Left = 8640
TabIndex = 128
Top = 1920
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackColor = &H80000018&
Caption = "算法"
Height = 195
Left = 4920
TabIndex = 5
Top = 480
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
BackColor = &H80000018&
Caption = "页面流长度"
Height = 195
Left = 2940
TabIndex = 2
Top = 480
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
BackColor = &H80000018&
Caption = " 块数"
Height = 195
Left = 1320
TabIndex = 0
Top = 480
Width = 405
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdShow_Click()
Dim jsh As Integer
Dim flag As Boolean
b = Val(TxtBlock.Text)
Text1(0).Text = TxtPage(0).Text
'内存页面不满时操作
a = 1
While (a <= b + jsh - 1) '如果命中一次向后多运行一个页面
For j = 0 To a - 1 '看是否命中
If TxtPage(a).Text = Text1((a - 1) * 10 + j).Text Then
Check1(a).Value = 1
jsh = jsh + 1
flag = True
For k = 0 To 9
Text1(a * 10 + k).Text = Text1((a - 1) * 10 + k).Text
Next k
End If
Next j
If Not flag Then ' 不命中时
For g = 0 To 9
Text1(a * 10 + g).Text = Text1((a - 1) * 10 + g).Text
Next g
Text1(a * 10 + a - jsh).Text = TxtPage(a).Text
End If
flag = False
a = a + 1
Wend
c = Val(Txtych.Text)
'内存页面用完时的操作
For a = b + jsh To c - 1
For i = 0 To b - 1 '看是否命中
If TxtPage(a).Text = Text1((a - 1) * 10 + i).Text Then
Check1(a).Value = 1
jsh = jsh + 1
flag = True
For k = 0 To b - 1
Text1(a * 10 + k) = Text1((a - 1) * 10 + k)
Next k
Exit For
End If
Next i
If Not flag Then
If Trim(Combo1.Text) = "Optimal" Then Call Optimal Else Call FIFO
End If
flag = False
Next a
'显示结果
m = (c - jsh) / c: n = jsh / c
TxtResult.Text = TxtResult.Text & ";" & Combo1.Text & "的缺页率: " & c - jsh & "/" & c & " 命中率:" & jsh & "/" & c
cmdShow.Enabled = False
End Sub
Private Sub cmdUpdate_Click() '刷新
For i = 0 To 99
Text1(i).Text = ""
Text1(i).BackColor = &H80000005
Next i
For i = 0 To 9
Check1(i).Value = 0
Next i
TxtResult.Text = ""
cmdShow.Enabled = True
End Sub
Private Sub Command1_Click()
Unload Me
End Sub