Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2009 16:08:08 +0100
From:      Ulf Lilleengen <ulf.lilleengen@gmail.com>
To:        Mehmet Ali Aksoy =?iso-8859-1?B?VNxZU9xa?= <aksoy.for.research@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Threads and SMP kernel scheduling
Message-ID:  <20090108150807.GA1264@carrot.pvv.ntnu.no>
In-Reply-To: <14ded62c0901080123u7268055epb3e17d84aa757051@mail.gmail.com>
References:  <14ded62c0901080123u7268055epb3e17d84aa757051@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 08, 2009 at 04:23:08AM -0500, Mehmet Ali Aksoy TÜYSÜZ wrote:
> Hi all,
> 
> After I had a bit googling I got confused.
> 
> My questions are simple and they are as follows :
> 
> 1-) "Are pthreads (or threads in general) of one process scheduled to
> different cores on multi-core systems running Linux or BSD?"
> 
The standard threading library in FreeBSD will use a 1:1 mapping between
userland threads(pthreads) and kernel threads. This means that each thread
may run on a different core than other threads.

> 2-) What if there are multiple processes which have multiple threads? Does
> it change the answer of (1)?
No, the same mapping applies. Although threads of one process may preferably
run on the same core, each thread of a process may run on any of the cores
available.

> 
> I found some answers but they are not sharp. Somebody says "can be
> scheduled" but "can be" is not a precise answer (in my opinion.)
Well, it means that there are more factors deciding where a thread is put. If
you look at a factor such as affinity, one thread may preferable be scheduled
to the same core since the cache may contain data relevant to the thread.

> 
> Thanks everybody in advance.
> 
Hope everything is at least a bit clearer.

-- 
Ulf Lilleengen



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090108150807.GA1264>