Skip to content

Instantly share code, notes, and snippets.

@lquenti
Created November 22, 2022 07:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lquenti/4d8674535dcd20a6cb1173c566caf111 to your computer and use it in GitHub Desktop.
Save lquenti/4d8674535dcd20a6cb1173c566caf111 to your computer and use it in GitHub Desktop.
test if FS is concurrent
#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);
}
#!/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