[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: newbie SMP questions



On Sun, February 21 1999, abel@bfr.co.il (Alexander L. Belikoff) wrote:
|
|Hello everybody -
|
|Given a chance to play with an SMP (dual AXP) machine, and having no
|prior SMP experience, I've got a couple questions:
|
|1. Are CPU shared at a timeslice level or at a program level? Ie. can
|   a program migrate from one CPU to another one or it'd stick to one
|   CPU?

"Timeslice" - the scheduler assigns processes to the CPU on a "first
come first served" basis.  (a process is switched out of context also
when it returns from a system call or when it waits on something, so I
suppose it's not exactly "timslice")

|
|2. Is the SMP support completely hidden from a user or it allows
|   starting a program on a certain CPU? In particular, I have a fairly 

As far as I understand it, there are talks on linux-kernel to add
support for user-level control of CPU-selection.  I don't see such a
feature mentioned in the docs of 2.1.*

|   numerically-intensive program which I used to run in one instance
|   on a machine. Now I'd like to take advantage of the 2nd CPU to
|   start another instance of the program, but I need to make sure they 
|   don't share same CPU.

The scheduler will take care of that (e.g. my Dual Pentium machine at
home runs two rc5des processes at about 190% performance (still
haven't got around to upgrade to 2.2, which should improve on that)

REMEMBER - From my experience, trying to be smarter than the scheduler
will usually result in worse performance since the user-level is far
from seeing the whole picture as well as the scheduler does (and even
the scheduler is guessing about some things).  Just write simple
programs and see how the system handles them.  Same goes for trying to
get too smart with nice(2).  (No, I haven't tried to be smarter than
the scheduler when it wasn't ncessary, but I've seen DOS-type
programmers muck with it without understanding what time-sharing OS is
all about, makes you wander why these people think they deserve to be
called "programmers" :-).

|3. What pointers to further SMP information could you recommend? NOTE, 
|   I did read the {SMP,smp}* files in the Documentation directory of
|   the kernel and they are not very helpful.

There is a kernel-smp mailing list.  I think I've seen some books
about SMP programming (usually applicable when you want to distribute
the work-load at run-time).  You might also want to take a look in
"Advanced Programming in the UNIX environment".  And of course, there
is the source, Luke.

What sort of crunching do you do there?

Cheers,

--Amos

--Amos Shapira                    | "Of course Australia was marked for
133 Shlomo Ben-Yosef st.          |  glory, for its people had been chosen
Jerusalem 93 805                  |  by the finest judges in England."
ISRAEL        amos@gezernet.co.il |                     -- Anonymous