lkml.org 
[lkml]   [1999]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Threads in linux, contd
On Thu, 2 Sep 1999, Vladimir Dergachev wrote:

> Can someone more knowledgable than me tell of the current status of
> threads in Linux on SMP and some history ?
> In particular:
> * can two threads from the same process run on two different cpus ?

Simple answer: yes.
Fuller answer: there is no such thing as "two threads from the same
process". Under Linux, a thread is a process is a thread.

Threads commonly share VM and open files, but they may share more or
less, depending upon the application.

Just as processes may run concurrently on different CPUs, so may threads,
them beingf one and the same.

> * what happens in event of cache thrashing ? Is there any code to
> optimize for this situation ? (have no idea)

Explain? There is code to keep the processes on the same CPU in
some circumstances, but cache-thrashing is largely an application
effect.

If you have you hogs, battering away at the same buffer, then the
bus could well get swamped.

> * are threaded programs guaranteed not to run slower on SMP in
> comparasion to UP systems ?

You get no timing/scheduling guarantees - this is not an RTOS. You
would be hard pushed to construct an example, but it's not impossible.

> * was this situation always this way (i.e. 2.0.*, 2.2.* and 2.3.*)

Yes.

> * is there any way for a process to request that it's threads should
> run on the same cpu ?

Processes don't have threads. They _are_ threads. (As far as the
kernel is concerned - if your application or threads library likes
to pretend that one process/thread/task is in charge, then it is more
than welcome to do so.)

That aside, there are patches which allow processes to request that
they run on only a certain set of CPUs. You could use them, though
really, it's the kernel's job to ensure that the application doesn't
have to do things like this.

Matthew.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.069 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site