Re: parallel computation
- From: "cr88192" <spamtrap@xxxxxxxxxx>
- Date: Mon, 22 Jan 2007 14:55:33 +1000
"Andrzejewski Lukasz" <spamtrap@xxxxxxxxxx> wrote in message
news:fc09f02f9625a5d4c325cf463fa618a2$1@xxxxxxxxxxxxxxxxxxx
Hi.
I have Pentium D processor and i want to lern how to program second core
from the lowest level. ( without system calls if it possible ). Does
anybody could tell me how to make simple program for example one core is
summing some numbers , second multiply them. ? :)
well, it depends on what you are doing.
in you are in an existing OS, say windows or linux, then making syscalls is
the only real option (say, via use of pthreads, CreateThread, ...).
if doing a custom OS, or in DOS, ... it may make sense to fammiliarize
oneself with the intel docs. multiprocessor initialization is described in
Vol 3 (older), or Vol 3A (newer), and in both cases is described in chapter
7 (then again, if you don't know this already, then maybe it would be a bit
soon for trying to take this route).
if you want to implement custom multithreading on a single processor/core,
then this is much easier.
the most common teqnique is this (assuming one is either in DOS or a custom
OS kernel):
we set up an ISR, say, linked to the system clock (this may do other useful
things as well, like updating the kernel timer, ...).
on an interupt entry/return we:
push all the registers and other state to the stack;
change to a different stack;
do basic ISR stuff;
pop the registers and other state;
iret into the new thread/process.
IMO, it makes sense to have the entry and exit stack states being completely
symetric, so then the interrupt entry and exit points look just the same (no
real funky handling, apart from swapping out the stack in the process). it
is basically the same for processes, albeit process switching also implies
swapping out the page tables (CR4).
it may also make sense to swap over to a custom kernel stack as well for
doing kernel stuff (rather than using the userspace stack), but this is by
no means a requirement.
an alternative approach is to use the TSS mechanism, but this is generally
advised against (for good number of reasons).
Lukas
..
.
- References:
- parallel computation
- From: Andrzejewski Lukasz
- parallel computation
- Prev by Date: Re: parallel computation
- Next by Date: Get the FAQs
- Previous by thread: Re: parallel computation
- Next by thread: Re: parallel computation
- Index(es):
Relevant Pages
|