Created
November 22, 2022 07:58
-
-
Save lquenti/4d8674535dcd20a6cb1173c566caf111 to your computer and use it in GitHub Desktop.
test if FS is concurrent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<sys/types.h> | |
#include<sys/stat.h> | |
#include<fcntl.h> | |
#include<unistd.h> | |
#include<stdio.h> | |
// 100mB | |
#define N 104857600 | |
char *buf[N] = {0}; | |
int main(int argc, char **argv) { | |
int fd = open(argv[1], O_CREAT | O_TRUNC | O_RDWR, 0644); | |
// let it time to start up | |
sleep(1); | |
printf("before write") | |
write(fd, buf, N); | |
close(fd); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
./my_file "./file1.txt" & | |
./my_file "./file2.txt" & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment