linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* (no subject)
@ 2001-03-06 23:55 Ying Chen
  2001-03-07  0:07 ` threads J . A . Magallon
  2001-03-07  0:40 ` your mail Don Dugger
  0 siblings, 2 replies; 6+ messages in thread
From: Ying Chen @ 2001-03-06 23:55 UTC (permalink / raw)
  To: linux-kernel

Hi,

I have two questions on Linux pthread related issues. Would anyone be able 
to help?

1. Does any one have some suggestions (pointers) on good kernel Linux thread 
libraries?
2. We ran multi-threaded application using Linux pthread library on 2-way 
SMP and UP intel platforms (with both 2.2 and 2.4 kernels). We see 
significant increase in context switching when moving from UP to SMP, and 
high CPU usage with no performance gain in turns of actual work being done 
when moving to SMP, despite the fact the benchmark we are running is 
CPU-bound. The kernel profiler indicates that the a lot of kernel CPU ticks 
went to scheduling and signaling overheads. Has anyone seen something like 
this before with pthread applications running on SMP platforms? Any 
suggestions or pointers on this subject?

Thanks a lot!

Ying



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: threads
  2001-03-06 23:55 Ying Chen
@ 2001-03-07  0:07 ` J . A . Magallon
  2001-03-07  0:40 ` your mail Don Dugger
  1 sibling, 0 replies; 6+ messages in thread
From: J . A . Magallon @ 2001-03-07  0:07 UTC (permalink / raw)
  To: Ying Chen; +Cc: linux-kernel


On 03.07 Ying Chen wrote:
> 2. We ran multi-threaded application using Linux pthread library on 2-way 
> SMP and UP intel platforms (with both 2.2 and 2.4 kernels). We see 
> significant increase in context switching when moving from UP to SMP, and 
> high CPU usage with no performance gain in turns of actual work being done 
> when moving to SMP, despite the fact the benchmark we are running is 
> CPU-bound. The kernel profiler indicates that the a lot of kernel CPU ticks 
> went to scheduling and signaling overheads. Has anyone seen something like 
> this before with pthread applications running on SMP platforms? Any 
> suggestions or pointers on this subject?
> 

Too much contention ? How frequently do you create and destroy threads ?
How much frequently do they access shared-writable-data ?
How do you protect them ?

It seems like your system spents more time creating and killing threads
that doing real work.

-- 
J.A. Magallon                                                      $> cd pub
mailto:jamagallon@able.es                                          $> more beer

Linux werewolf 2.4.2-ac13 #3 SMP Wed Mar 7 00:09:17 CET 2001 i686


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: your mail
  2001-03-06 23:55 Ying Chen
  2001-03-07  0:07 ` threads J . A . Magallon
@ 2001-03-07  0:40 ` Don Dugger
  1 sibling, 0 replies; 6+ messages in thread
From: Don Dugger @ 2001-03-07  0:40 UTC (permalink / raw)
  To: Ying Chen; +Cc: linux-kernel

Ying-

I'm a little confused here.  It's very hard to compare a UP application
vs. the same app. converted to use threads.  Unless the app. is
structured such that multiple threads can run at the same time then
no, you won't see any improvement by going to SMP, in fact a true
single threaded app. will frequently slow down when run on an SMP
kernel.

Have you watched a CPU meter while your benchmark runs?  Even something
basic like `top' should give you a feel for whether or not your
using all of the CPU's.


On Tue, Mar 06, 2001 at 03:55:55PM -0800, Ying Chen wrote:
> Hi,
> 
> I have two questions on Linux pthread related issues. Would anyone be able 
> to help?
> 
> ...
>
> 2. We ran multi-threaded application using Linux pthread library on 2-way 
> SMP and UP intel platforms (with both 2.2 and 2.4 kernels). We see 
> significant increase in context switching when moving from UP to SMP, and 
> high CPU usage with no performance gain in turns of actual work being done 
> when moving to SMP, despite the fact the benchmark we are running is 
> CPU-bound. The kernel profiler indicates that the a lot of kernel CPU ticks 
> went to scheduling and signaling overheads. Has anyone seen something like 
> this before with pthread applications running on SMP platforms? Any 
> suggestions or pointers on this subject?
> 
> Thanks a lot!
> 
> Ying
> 
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
n0ano@valinux.com
Ph: 303/938-9838

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: threads
  2000-11-10 15:03 threads M.Kiran Babu
  2000-11-10 15:39 ` threads Matti Aarnio
@ 2000-11-10 16:05 ` Reto Baettig
  1 sibling, 0 replies; 6+ messages in thread
From: Reto Baettig @ 2000-11-10 16:05 UTC (permalink / raw)
  To: M.Kiran Babu; +Cc: linux-kernel

lock_kernel is a special case and will not block when you call it in
order to create a new kernel thread. Look at the implementation of
lock_kernel if you have any doubts (this is true for the 2.2 kernels. I
don't know it by heart for the 2.4 kernel). 

	Reto

"M.Kiran Babu" wrote:
> 
>  sir,
> i got some doubts in kernel
> programming. i am using linux 6.1 version. i want to use threads in
> kernel.is it possible to use pthreads in kernel. there is one more
> function kernel_thread. can i use
> that function. if i use that function how to get synchonization. inmany
> files it was used. but everywhere lock_kernel() and unlock_kernel()
> functions are being used. if we use that commands the whole kernel gets
> locked. is there any other mechanisms. or can i use that methods only. if
> i can use these methods what is the syntax of kernel_thread function. the
> arguments that are passing to these function are 3. i dont know what are
> those three. please  tell me.
> 
> 
> 
> 
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> Please read the FAQ at http://www.tux.org/lkml/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: threads
  2000-11-10 15:03 threads M.Kiran Babu
@ 2000-11-10 15:39 ` Matti Aarnio
  2000-11-10 16:05 ` threads Reto Baettig
  1 sibling, 0 replies; 6+ messages in thread
From: Matti Aarnio @ 2000-11-10 15:39 UTC (permalink / raw)
  To: M.Kiran Babu; +Cc: linux-kernel

On Fri, Nov 10, 2000 at 08:33:29PM +0530, M.Kiran Babu wrote:
>  sir,
> i got some doubts in kernel
> programming. i am using linux 6.1 version. i want to use threads in

	Linux kernel versions are now running up to 2.4.0*, what is
	that 6.1 ?  Some distribution ?  Which ?
	Which kernel version you are referring into ?

> kernel.is it possible to use pthreads in kernel. there is one more
                               ^^^^^^^^^^^^^^^^^^   NO.
> function kernel_thread.
> can i use that function.

	#include <asm/processor.h>

	extern pid_t kernel_thread(int (*fn)(void *), void * arg,
				   unsigned long flags);

> if i use that function how to get synchonization.

	With mutexes, waitqueues, or spinlocks.
	All kernel facilities.

> inmany files it was used. but everywhere lock_kernel() and unlock_kernel()
> functions are being used. if we use that commands the whole kernel gets
> locked.

	Really ?  Who says you need to   lock_kernel()  for starting
	a kernel thread ?

> is there any other mechanisms. or can i use that methods only.
> if i can use these methods what is the syntax of kernel_thread function.
> the arguments that are passing to these function are 3.
> i dont know what are those three. please tell me.

	Pick 2.4.0 sources, open them up.

	Then do:  "make psdocs" or "make pdfdocs" or "make htmldocs"
	and you get up documents from within the system into your
	source location Documentation/DocBook/  subdirectory.

	You propably want to study  kernel-hacking,  kernel-locking,
	and  kernel-api   documents.

	(Your system needs to have DocBook, related SGML tools, and
	 (for PS/PDF) (La)TeX subsystem.)

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* threads
@ 2000-11-10 15:03 M.Kiran Babu
  2000-11-10 15:39 ` threads Matti Aarnio
  2000-11-10 16:05 ` threads Reto Baettig
  0 siblings, 2 replies; 6+ messages in thread
From: M.Kiran Babu @ 2000-11-10 15:03 UTC (permalink / raw)
  To: linux-kernel


 sir,
i got some doubts in kernel
programming. i am using linux 6.1 version. i want to use threads in
kernel.is it possible to use pthreads in kernel. there is one more
function kernel_thread. can i use
that function. if i use that function how to get synchonization. inmany
files it was used. but everywhere lock_kernel() and unlock_kernel()
functions are being used. if we use that commands the whole kernel gets
locked. is there any other mechanisms. or can i use that methods only. if
i can use these methods what is the syntax of kernel_thread function. the
arguments that are passing to these function are 3. i dont know what are
those three. please  tell me.
				




                                               
                        
               




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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-03-07  0:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-06 23:55 Ying Chen
2001-03-07  0:07 ` threads J . A . Magallon
2001-03-07  0:40 ` your mail Don Dugger
  -- strict thread matches above, loose matches on Subject: below --
2000-11-10 15:03 threads M.Kiran Babu
2000-11-10 15:39 ` threads Matti Aarnio
2000-11-10 16:05 ` threads Reto Baettig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).