https://github.com/deutranium/system-calls
Implementing text reversal for files comparatively bigger than RAM using only System Calls in C | Operating Systems and Networks - Monsoon'21
https://github.com/deutranium/system-calls
c operating-systems system-calls
Last synced: 6 months ago
JSON representation
Implementing text reversal for files comparatively bigger than RAM using only System Calls in C | Operating Systems and Networks - Monsoon'21
- Host: GitHub
- URL: https://github.com/deutranium/system-calls
- Owner: deutranium
- Created: 2021-08-24T19:06:06.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-03T00:30:19.000Z (about 4 years ago)
- Last Synced: 2025-02-09T18:49:24.464Z (8 months ago)
- Topics: c, operating-systems, system-calls
- Language: C
- Homepage:
- Size: 113 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# System Calls in C
[](https://forthebadge.com) [](https://forthebadge.com)
**Course:** Operating Systems and Networks (Monsoon'21)
*View the assignment PDF [here](OS_Assignment_1.pdf)!*
## Task:
Reverse the file provided **using only system calls** in C. The use of _printf_, _scanf_ etc. is not permitted. This should be accompanied by the percentage of file reversed being constantly updating in the same line on the console. \
**Relevant commands:** read, write, lseek, stat, fflush, perror## Key features:
- Works perfectly files significantly larger than the RAM size - doesn't load the entire file into RAM in one go
- Compatible with both absolute and relative paths## Instructions
- Clone the repo on your local machine and navigate to this directory
- Ensure that you have clang version >=12.0.5 or gcc version >=11.2 for compilation
- Run `gcc filename` to compile `filename` (`q1.c` or `q2.c`)and generate the required `.out` executable file which can be run with the required arguments**For Q1**
- If your executable file is known as `a.out`, run the following command:
``` bash
./a.out path/input_file.txt
```
You will find the output file with the name `1_input_file.txt` in `Assignment/1_input_file.txt` which contains the text reversed from the input file**For Q2**
- If your executable file is known as `a.out`, run the following command:
``` bash
./a.out path/input_file.txt num_partitions nth_partition
```
Here, the output file `2_input_file.txt` will be stored in `Assignment/2_input_file.txt` and contains the reversal of the text from `nth_partition` partition if we divide the input file text into `num_partition` partitions## Assumptions
#### Question 1:
- Path argument for input file has less than 200 characters#### Question 2:
- Number of parts and part to be reversed are both single digit numbers