static char data[4096] attribute((aligned(4096))) = {'a'}; void writer(int index) { std::string fname = "data" + std::to_string(index); int data_fd = ::open(fname.c_str(), O_RDWR | O_CREAT | O_APPEND, 0645); for (int32_t i = 0; i < 1000000; i++) { ::write(data_fd, data, 4096); } close(data_fd); } int main() { std::vectorstd::thread threads; for(int i = 0; i < 64; i++) { std::thread worker(writer, i); threads.push_back(std::move(worker)); } for (int i = 0; i < 64; i++) { threads[i].join(); } return 0; }