Am Freitag, 2. März 2007 14:19 schrieb Albert Zeyer:
> I don't know if there is any possibility to define the CPU, on which a
> special thread should run on. Is there any?
>
This is little bit more difficult.
====================================================
on windows you can set the cpu affinity mask with windowsapi calls
getProcessAffinityMask()
setProcessAffinityMask()
getThreadAffinityMask()
setThreadAffinityMask()
=====================================================

on linux you can set this mask with glibc calls 
=====================================================
/* Set the CPU affinity for a task */
extern int sched_setaffinity (pid_t pid, size_t cpusetsize,
                              const cpu_set_t *cpuset);

/* Get the CPU affinity for a task */ extern int sched_getaffinity (pid_t pid, 
size_t cpusetsize, cpu_set_t *cpuset);
=====================================================

I think that this calls not covered in the fpc rtl, so the only way to use it 
convert the header files as described in the fpc documentation. (has anybody 
done this?) 

> Because usually, this is something your OS should handle because it
> knows best about all the other parallel processes. And it's perhaps not
> always the best solution for your application to split all your threads
> on perhaps the 4 CPUs of a quadcore, if there is another application
> which also needs lot of CPU power (I would thought, that in this case,
> it should be a lot faster, if your application uses 2 CPUs and the other
> application the other ones). But as I said, usually this is something
> your OS should take care about.
>
> Greetings,
> Albert
>
> Am Freitag, den 02.03.2007, 11:18 +0100 schrieb tanila:
> > I would like to know how many processors are on the system, because i
> > would like to use them paralell for a single task.
> >
> > The job could be done using 2, 4, etc threads simultaniously, to speed
> > it up with usage of all processors at the same time.
> >
> > To split up the task I have to know how many cpus are available for
> > usage.
> >
> > Is there a way to figure this out ?
> >
> > greetings
> > tanila
> >
> > Am Freitag, den 02.03.2007, 11:20 +0200 schrieb Graeme Geldenhuys:
> > > On 3/2/07, tanila <[EMAIL PROTECTED]> wrote:
> > > > I would like to make experiences with multithreadded application and
> > > > how to get benefits with more than one cpu.
> > >
> > > All you should need to do is create multiple threads in your system
> > > and the OS and CPU(s) will handle the rest.  No need to do something
> > > special in you application.
> > >
> > > > Another question:
> > > > Are this magic doual/quad-core cups real multiprocessor-systems like
> > > > a mainboard with two or more processors ?
> > >
> > > Yes they are like the old style mainboards with two or more physical
> > > processors on the motherboard.  HyperThreading on the other hand is a
> > > Intel sales gimic which fakes a second processor (software processor).
> >
> > _________________________________________________________________
> >      To unsubscribe: mail [EMAIL PROTECTED] with
> >                 "unsubscribe" as the Subject
> >    archives at http://www.lazarus.freepascal.org/mailarchives

-- 
Best Regards/Gruss Siggi

Attachment: pgpZuUN4OtNle.pgp
Description: PGP signature

Reply via email to