{"id":17355921,"url":"https://github.com/johnnieshere/virtual-memory-management","last_synced_at":"2026-04-28T20:33:15.678Z","repository":{"id":250568560,"uuid":"832574660","full_name":"JohnniesHere/Virtual-Memory-Management","owner":"JohnniesHere","description":"This project simulates a processor's access to memory using a paging mechanism. It involves the implementation of functions to handle memory management, page faults, and page swapping.","archived":false,"fork":false,"pushed_at":"2024-07-27T19:19:12.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T19:11:23.584Z","etag":null,"topics":["linux","memory-management","memory-paging"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JohnniesHere.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-23T09:47:42.000Z","updated_at":"2024-07-28T12:29:09.000Z","dependencies_parsed_at":"2024-07-28T14:48:17.253Z","dependency_job_id":"04552af8-2149-4ae7-a9a2-b17702a601c1","html_url":"https://github.com/JohnniesHere/Virtual-Memory-Management","commit_stats":null,"previous_names":["johnnieshere/virtual-memory-management"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2FVirtual-Memory-Management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2FVirtual-Memory-Management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2FVirtual-Memory-Management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2FVirtual-Memory-Management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnniesHere","download_url":"https://codeload.github.com/JohnniesHere/Virtual-Memory-Management/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245866726,"owners_count":20685490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["linux","memory-management","memory-paging"],"created_at":"2024-10-15T17:47:21.286Z","updated_at":"2026-04-28T20:33:10.656Z","avatar_url":"https://github.com/JohnniesHere.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Memory Paging Simulation\n\nAuthorize: Jonathan Elgarisi\n\n## Memory Paging Simulation Program\nThis project simulates a processor's access to memory using a paging mechanism. It involves the implementation of functions to handle memory management, page faults, and page swapping.\n\n## Features\n- Simulate memory paging mechanism with a page table.\n- Manage main memory and swap file.\n- Handle page faults and page replacements.\n- Perform memory load and store operations.\n- Print memory, swap, and page table states.\n\n## How to Run\nTo compile the program, use the following command:\n\n```bash\ngcc -Wall mem_sim.c main.c -o memory_simulator\n```\n\nAlternatively, you can use the provided `run_me.sh` script to compile and run the program:\n\n```bash\n./run_me.sh\n```\n\n## How to Use\nAfter successfully compiling the program, you can run it using the following command:\n\n```bash\n./memory_simulator\n```\n\nThe program will simulate the paging mechanism and provide the following functions for memory operations:\n\n### Initialization\nInitialize the system with the executable and swap file names, and sizes for text, data, and BSS/heap/stack sections:\n\n```c\nstruct sim_database* init_system(char exe_file_name[], char swap_file_name[], int text_size, int data_size, int bss_heap_stack_size);\n```\n\n## Functions\n\n### Load\nLoad a value from a specific address:\n\n```c\nchar load(struct sim_database* mem_sim, int address);\n```\n\n### Store\nStore a value at a specific address:\n\n```c\nvoid store(struct sim_database* mem_sim, int address, char value);\n```\n\n### Print Memory\nPrint the content of the main memory:\n\n```c\nvoid print_memory(struct sim_database* mem_sim);\n```\n\n### Print Swap\nPrint the content of the swap file:\n\n```c\nvoid print_swap(struct sim_database* mem_sim);\n```\n\n### Print Page Table\nPrint the page table:\n\n```c\nvoid print_page_table(struct sim_database* mem_sim);\n```\n\n### Clear System\nClear the system by closing files and freeing allocated memory:\n\n```c\nvoid clear_system(struct sim_database* mem_sim);\n```\n\n## Input\nThe program takes the following inputs during initialization:\n- `exe_file_name`: Name of the executable file containing the program. This file is expected to contain the binary code of the program, which will be loaded into memory.\n- `swap_file_name`: Name of the swap file. This file will be used to store pages that are swapped out of main memory.\n- `text_size`: Size of the text section in bytes. This is the size of the compiled code section of the program.\n- `data_size`: Size of the data section in bytes. This includes initialized global and static variables.\n- `bss_heap_stack_size`: Combined size of the BSS, heap, and stack sections in bytes. The BSS section contains uninitialized global and static variables, while the heap and stack are used for dynamic memory allocation and function call management, respectively.\n\n## Output\nThe program outputs the results of memory operations and prints the states of the main memory, swap file, and page table. It provides error messages if any issues occur.\n\n## Files\n- `mem_sim.c`: The main code containing the implementation of the memory paging simulation.\n- `mem_sim.h`: The header file with the definitions and function signatures.\n- `exec_file`: A file simulating an executable file for testing purposes.\n- `main.c`: Contains comprehensive tests for the memory paging simulation.\n- `run_me.sh`: A script to compile and run the program.\n- `README.txt`: The text file you are currently reading.\n\n## License\nMIT - https://choosealicense.com/licenses/mit/\n\nBy following this README, you can compile and run the memory paging simulation program, which demonstrates how a processor manages memory using a paging mechanism, handles page faults, and swaps pages between main memory and a swap file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnieshere%2Fvirtual-memory-management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnnieshere%2Fvirtual-memory-management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnieshere%2Fvirtual-memory-management/lists"}