I wrote a program in codeblocks and the code is shown below.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
int Param, i, j, k;
if(argc != 2){
fprintf(stderr, "An integer parameter is required \n");
return -1;
}
Param = atoi(argv[1]);
if(Param<0){
fprintf(stderr, "An integer >= 0 is required \n");
}
printf("first \n");
for(i = 0; i < 1500; i++)
for(j = 0; j < 1500; j++)
for(k = 0; k < 1500; k++);
printf("second \n");
for(i = 0; i < 1500; i++)
for(j = 0; j < 1500; j++)
for(k = 0; k < 1500; k++);
printf("Done \n");
return 0;
}
In the program, I didn't use any multithread function and libraries like windows.h or thread.h. But when I opened the task manager to observe the threads it used, I was surprised that the program was using 2 threads. I have no idea why this can happen. Is there something added into the program I wrote while compiler is compiling my program? Please help me to find out the mystery.
This is the picture about the question.