-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathVIRTUAL-MEMORY.c
102 lines (91 loc) · 1.98 KB
/
VIRTUAL-MEMORY.c
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
100
101
102
#include <stdio.h>
// Start of script
// Creating virtual memory SWAP files
// I need a more efficient method, this is just pseudocode for now as well
// Methods
response = bool(true);
ramSize = 8000000000; // Change this according to your OSCONFIG.yml file
// Functions
// Create a 2 Gigabyte swap file
int swaptwoGB(void) {
x = int(0);
while (x != 2000000000) {
file.append(0) to file("/SWAPFILE.bin");
x == x + 1;
if response == true {
response == false;
} else if response == false {
response == true;
}
if (x == 2000000000) {
printf("A 2 gigabyte SWAP file has been created\n");
break;
}
}
}
// Create a 1 Gigabyte SWAP file
int swaponeGB(void) {
x = int(0)
while (x != 1000000000) {
file.append(0) to file("/SWAPFILE.bin");
x == x + 1;
if response == true {
response == false;
} else if response == false {
response == true;
}
if (x == 2000000000) {
printf("A 2 gigabyte SWAP file has been created\n");
break;
}
}
}
// Create a custom size SWAP file
int customSWAP(void) {
scanf.csw("Please specify the size of the SWAP file in bytes. Make sure the SWAP file is less than 1/4 of your RAM size\n");
if (csw / 4 > ramSize) {
printf("The specified size is too large\n");
break;
} else {
x = int(0)
while (x != csw) {
file.append(0) to file("/SWAPFILE.bin");
x == x + 1;
if response == true {
response == false;
} else if response == false {
response == true;
}
if (x == csw) {
printf("A " + int(csw) + " byte SWAP file has been created!\n");
break;
}
}
}
// Main method
int main(void) {
// return swaptwoGB();
// return swaponeGB();
return customSWAP();
break;
}
// Start program
return main()
do wait for response;
if response == false {
wait 30;
if response == false {
return 0;
break;
}
}
break;
return 0;
exit;
/*
File info
File type: C source file (*.c *.h)
File version: 1 (2022, Friday, January 14th at 4:54 pm)
Line count (including blank lines and compiler line): 103
*/
// End of script