ok, thanks. i thnk i understand, although it seems that if the os doesn't assign one process per core then the extra processes are an arbitrary number of which which will effectively deterimine how much overall cpu time the app gets. i.e. if you have 4 cores, 4 processes but they're not distributed evenly it might as well have been 3 processes, 4 processes, 5 processes or 6 processes depending on how much cpu time you want.<br>
<br>i want to write a webserver, though, and i was thinking the webserver would probably be i/o bound and not cpu bound (even if it gets lots of traffic), so perhaps there's no reason to write it multi-core/multi-processor...?<br>
<br><br><div class="gmail_quote">On Sun, Apr 27, 2008 at 11:32 PM, Justin Tulloss <<a href="mailto:jmtulloss@gmail.com" target="_blank">jmtulloss@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The scheduler doesn't really work like that. A process doesn't get<br>
assigned to a single core and then run to completion. The OS is<br>
actually switching between running processes every few milliseconds.<br>
If you start 2 processes, 1 may start on one processor and one may<br>
start on another, but after their timeslice is up, they may very well<br>
switch. For performance reasons, the OS will try to run a process on<br>
the same core that it was running on, but it's not necessary or<br>
guaranteed.<br>
<br>
The reason you would start 4 processes for 4 cores is that that's the<br>
maximum number of processes you can possibly have running at one time.<br>
However, everything else on your system is sharing in on that time.<br>
You might find that you get more CPU time if you double the number of<br>
processes, making it 2 per core.<br>
<font color="#888888"><br>
Justin<br>
</font><div><div></div><div><br></div></div></blockquote></div><br>