I just want to write a simple program in C++, which creates two threads and each of them fills vector by squares of integers (0, 1, 4, 9, ...). Here is my code:
The fill function will run so fast that the thread overhead is likely as long as the execuition.
Replace fill with something that takes a significant amount of time to execute. As a first pass, use std::this_thread::sleep_for
std::this_thread::sleep_for