Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Review needed] Swap file creator #18

Open
seanpm2001 opened this issue Jan 15, 2022 · 0 comments
Open

[Review needed] Swap file creator #18

seanpm2001 opened this issue Jan 15, 2022 · 0 comments
Labels
C For issues on the topic of C source code. File system For issues on the topic of file systems. help wanted Extra attention is needed Issue For WacOS project issues that are raised. Memory management For issues on the topic of memory management. question Further information is requested Review needed For issues that need review. SWAP Maker For issues related to the SWAP Maker component. SWAP Memory For issues on the topic of SWAP Memory.

Comments

@seanpm2001
Copy link
Owner


[Review needed] Swap file creator

I created a new component of the system today, which is a SWAP file creator. It isn't functional yet, but I have already run into a design problem:

Modern SWAP files are very large. For reference, my laptops SWAP file is 2 gigabytes (2 trillion bytes) the SWAP file maker I made is designed to take up less memory in its source code, but build a SWAP file byte by byte, running a command for every blank byte added to the SWAP file located at SWAPFILE.bin (which I will change to .swp in the future) I can't just upload a SWAP file to GitHub, as 1. It would be too large and 2. Not every SWAP file for every installation is the same size.

This is a fragment of the 3rd variation of the C code for reference. It is not functional yet and is mostly pseudocode (you might need to view the full file to get all the context)

// 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;
			}
	}
}

The full source code can be viewed here or here

I have been told by family members that this sounds like a virus. I don't know enough about it to agree, but I feel like doing this could damage/destroy a storage device easily. I wonder if there is a better way of doing this. Does anyone know?


File version: 1 (2022, Friday, January 14th at 7:37 pm)


@seanpm2001 seanpm2001 added help wanted Extra attention is needed question Further information is requested Issue For WacOS project issues that are raised. C For issues on the topic of C source code. File system For issues on the topic of file systems. Memory management For issues on the topic of memory management. Review needed For issues that need review. SWAP Maker For issues related to the SWAP Maker component. SWAP Memory For issues on the topic of SWAP Memory. labels Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C For issues on the topic of C source code. File system For issues on the topic of file systems. help wanted Extra attention is needed Issue For WacOS project issues that are raised. Memory management For issues on the topic of memory management. question Further information is requested Review needed For issues that need review. SWAP Maker For issues related to the SWAP Maker component. SWAP Memory For issues on the topic of SWAP Memory.
Projects
None yet
Development

No branches or pull requests

1 participant