| void acuire_user() { | |
| while ((open("lockfile", O_CREATE | O_WRONLY)) < 0) ; | |
| } | |
| void release_user() { | |
| unlink("lockfile"); | |
| } | |
| int main(int argc, char* argv[]){ | |
| int fd=open("file.txt",O_CREATE|O_WRONLY); | |
| for (int i = 0; i < NUM_FORKS; i++){ | |
| int pid = fork(); | |
| if (pid == 0){ | |
| acuire_user(); | |
| char* write_data = "OS Lab4 - G29"; | |
| int max_length = 13; | |
| write(fd,write_data,max_length); | |
| write(fd,"\n",1); | |
| release_user(); | |
| exit(); | |
| } | |
| } | |
| while (wait() != -1); | |
| close(fd); | |
| getsyscallcount(); | |
| exit(); | |
| } | |
Xet Storage Details
- Size:
- 772 Bytes
- Xet hash:
- 89ba0f76106538a888d3fee4f06af86bcac4727bbc68b1e57ec7bd21b5531d60
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.