LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Optimum number of processes for process (https://www.linuxquestions.org/questions/linux-newbie-8/optimum-number-of-processes-for-process-764289/)

chamila1986 10-24-2009 10:55 PM

Optimum number of processes for process
 
Optimum number of processes for procesor

In Linux based os are there a optimum number of process for a processor that gives 'maximum performance' for system(or process range depend on cpu speed,cache etc...)??????
By 'maximum performance' I mean better performance? Please can someone clarify me this out.

paulsm4 10-24-2009 10:58 PM

Yes. The ideal number of processes is "46".

chamila1986 10-24-2009 11:10 PM

Sir paulsm4,
Isn't it not changed according to the no of cores in cpu(like duel core,multi core etc) and the cash and memory sizes....?????????????????????

paulsm4 10-24-2009 11:37 PM

Hi -

There is no such thing as "an optimimum number of processes". There is no such thing as an "optimum number of processes per CPU" (in a multi-core or multiprocessor system). In fact, there is considerable debate about what "optimum" even means.

For example, "optimum" could be any of:
Quote:

1. Utilization: how much is the CPU actually being used, and how much is idle?

2. Throughput: how fast is work being processed?

3. Responsiveness: how fast does the system *appear* to be working (e.g. to a user)?
These articles gives you a good overview how you might go about evaluating "performance":

http://www.tomshardware.com/reviews/...-cpu,2280.html

http://www.cmdln.org/2009/01/28/cpu-...ysis-in-linux/

'Hope that helps .. PSM

chamila1986 10-25-2009 12:03 AM

Sir,
Lets take an example.Suppose i have a calculation, that takes much time. So i allocate that task to set of processes and do the calculation. I need to do the calculation in minimum time.

I want to determine what is the best no of processes that need to do my calculation as soon as possible. To this scenario i need to keep cpu as much as busy and determine the best no of processes(Since context switching for processes may be increase the execution time).

so in multi core environment what is the best no of processes suit to do this(can u give me a rough value(are there any standard value))

/****I do not need to use user level thread approach...***/

paulsm4 10-25-2009 02:26 AM

Hi -

1. If you have one CPU, and the CPU spends 100% of it's time working on your calculation, then you have "100% utilization". In this case, that's a Good Thing - that's the ideal, best you can do.

2. If you have two CPU's, but your calculation doesn't lend itself to "parallelization" ... then one CPU is 100% utilized (like the above case) ... but the other CPU is 100% idle (because there's nothing for the second processor to do - this particular task can't be split into two, concurrent pieces). Your overall system utilization is only 50% - not so good.

3. Remember - you can't do any more work than you have processors.

If you have one work item ... but it can't be split into two pieces ... then a second CPU gains you nothing.

If you have two CPUs - and your work item CAN be split into two pieces - then both CPUs can be fully utilized (2 CPU x 100% utilization), and the job gets done in half the time. Yay!

If you have two CPUs - and your work can be split into FOUR pieces - you've gained nothing. Because you've still only got two CPU's, and they're both doing everything they can, as fast as they can (that's what "utilization" means - whether or not a system *is* doing as much work as it has *capacity* to do).

You CANNOT do more work than you have CPUs.

4. Finally, anything that either CPU does that's *NOT* part of your calculation ... means that it's going to take LONGER to perform your calculation.

So if you have more processes - then the CPUs are going to spend time servicing the processes (instead of doing your calculation).

All time spent on "system overhead" ... is time spent NOT doing your work ... which means your work is going to take longer.

More processes ... means more overhead ... which means less work.

So the ideal for two CPUs is work that can run in parallel on two processes (or two threads - in Linux, they're the same thing). The ideal for four CPUs is to be able to "parallelize" to four tasks. And so on.

'Hope that helps .. PSM


All times are GMT -5. The time now is 03:03 AM.