Processes and threads basic question
#include<stdio.h>
#include<conio.h>
void hello()
{ printf("\nHELLO\n");
}
int main()
{
hello();
hello();
hello();
hello();
getch();
return 0;
}
If I run this code on a compiler,how many processes and how many threads will be running on the compiler and which ones?
Does a duplicate function call consist another process or thread?
Does a main() function have any process associated with it?
swissknife007
Junior Poster in Training
74 posts since Oct 2008
Reputation Points: 13
Solved Threads: 0
Number one, The code doesn't run in a compiler. The code is compiled by the compiler so that it can run within an operating system environment.
How many threads? Just one, the main thread.
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
Number one, The code doesn't run in a compiler. The code is compiled by the compiler so that it can run within an operating system environment.
How many threads? Just one.
Thanks.....
Yes,I know compiler only compiles the code.
And what about processes?
swissknife007
Junior Poster in Training
74 posts since Oct 2008
Reputation Points: 13
Solved Threads: 0
And what about processes?
What about them?
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
[QUOTE=gerard4143;1661867]What about them?[[QUOTE]
How many processes will run ?
And which ones?
swissknife007
Junior Poster in Training
74 posts since Oct 2008
Reputation Points: 13
Solved Threads: 0
[QUOTE=swissknife007;1661875][QUOTE=gerard4143;1661867]What about them?[How many processes will run ?
And which ones?
I told you, in the code you posted, only one thread is running.
gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387