Number of processes running

I have a c program with say n number of for loops. How many processes and child processes will be running for this program and how?

Answers


The C language itself does not support multi-processed program. You should depend on API's provided by your OS to implement a multi-processed version. You can use fork function under Linux and CreateProcess in Windows environment and corresponding platform dependent API's can give you details on how to use these functions. Good luck!


A for loop does not fork a new process. N number of for loop should run in a single process.


If you doesn't make fork you will have only one process. So show your code if you use fork.


edit : Just for loops won't make any new processes, and the for loops will be executed in one process only. If you want to make a new process in Linux use fork().

If I remember well,

Using N for loops with each loop iterating M times will make something like M^N Processes, which will in turn make another sea of M^N processes since fork() creates identical processes etc... etc... . The system might turn to be very slow, and if the MAX_PROCESS is exceeded, fork() will not make any new processes.

The First process will create M^N Child Processes. Those children each one of them will also create M^N Child process etc... etc..

what you trying to achieve ?


Need Your Help

Something wrong when I select UITableViewCell?

ios uitableview cell

When I select a UITableViewCell the background become gray, the the gray height is strange. Some of the cell is strange like it.I set seperator line style to none. And I add labels to the front and...

Hidden button above div

c# html css button z-index

My goal is to hide a transparent button above a div element. When a user clicks the button, properties of the underlying div should be changed using code in a C# click event, not client-based code....