-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemoryManagement.html
99 lines (79 loc) · 3.29 KB
/
memoryManagement.html
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Memory Management</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>
<style>
body {
width: 50%;
margin: auto
}
h1 {
text-transform: uppercase
}
div {
background: blanchedalmond;
margin:4px;
padding:4px;
border:black 2px solid;
font-family: 'Times New Roman', Times, serif;
font-size: xx-large;
color: blue;
}
span {
color: black;
}
</style>
<body>
<h1 style="color:rgb(19, 17, 17);">MEMORY MANAGEMENT</h1>
<div id= "data">
<h3>A. Bits in logical address<span id="a"></span></h3>
<h3>B. Bits in physical address<span id="b"></span></h3>
<h3>C. No: of pages<span id="c"></span></h3>
<h3>D. No: of frames<span id="d"></span></h3>
<h3>E. No: of bits used for frame number<span id="e"></span></h3>
<h3>F. No: of bits used for page number<span id="f"></span></h3>
<h3>G. No: of bits used for Offset<span id="g"></span></h3>
<h3>H. No: of entries in page table<span id="h"></span></h3>
<h3>I. No: of bits in each page entry<span id="i"></span></h3>
<h3>J. Size of page table<span id="j"></span></h3>
</div>
<script>
var PA = prompt("Enter physical memory size");
var LA = prompt("Enter logical memory size");
var pageSize = prompt("Enter page size");
var bitsInPa = calBits(PA);
var bitsInLa = calBits(LA);
var pages = LA/pageSize;
var frames = PA/pageSize;
var bitsforPage = calBits(pages);
var bitsforFrame = calBits(frames);
var bitsforOffset = bitsInPa - bitsforFrame;
var entriesInPage = pages;
var pageTableSize = entriesInPage*bitsforFrame;
document.getElementById("a").innerHTML="\t"+bitsInLa;
document.getElementById("b").innerHTML="\t"+bitsInPa;
document.getElementById("c").innerHTML="\t"+pages;
document.getElementById("d").innerHTML="\t"+frames;
document.getElementById("e").innerHTML="\t"+bitsforPage;
document.getElementById("f").innerHTML="\t"+bitsforFrame;
document.getElementById("g").innerHTML="\t"+bitsforOffset;
document.getElementById("h").innerHTML="\t"+entriesInPage;
document.getElementById("i").innerHTML="\t"+bitsforPage;
document.getElementById("j").innerHTML="\t"+pageTableSize;
////////// for calculating bits from size
function calBits(size){
let bit=0;
while(size>1){
bit++;
size = size/2;
}
return bit;
}
</script>
</body>
</html>