473,503 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

In a multithreaded application,should processors be equal to no of threads?

Hi All,
thanks for reading this post.
just wanted to know about the ratio of threads and processors.
i am working on c++ on AIX5.2 platform.
my c++ program are multithreaded programs.
In a multithreaded application,should no of processors be equal to no
of threads ?
if we set the thread_scope to system( meaning 1 kernel thread to 1
user thread), does that mean that processors should be equal or more
than the threads?
suppose if we set,
rc = pthread_attr_setscope(&tattr,PTHREAD_SCOPE_SYSTEM) ;
And if i have 4 processors and 7 threads running simultaneously in my
applications.
will that work? or will it cause coredump ? will other threads wait for

CPU.
how is the ratio mapped?
how will the scheduler behave in this case?
please help me in resolving my issues.
thanks in advance to all the experts for their opinion.
Regards
Nagaraj Hayyal.

Nov 7 '05 #1
3 2110
On Mon, 07 Nov 2005 06:01:56 -0800, nrhayyal wrote:
Hi All,
thanks for reading this post.
just wanted to know about the ratio of threads and processors.
[..]


You're totally OT here, sorry. Try comp.programming.threads. Or the
newsgroup for your OS.

Just so you know, C++ does not care about processors and its execution
model _presumes_ no threading. At this point, anyway.

V
Nov 7 '05 #2
Hello,

On Mon, 7 Nov 2005 14:01:56 UTC, "nrhayyal" <na************@satyam.com> wrote:
Hi All,
thanks for reading this post.
just wanted to know about the ratio of threads and processors.
i am working on c++ on AIX5.2 platform.
my c++ program are multithreaded programs.
In a multithreaded application,should no of processors be equal to no
of threads ?
Not unless you have extremely compute intensive tasks that will never
block or wait on anything.
if we set the thread_scope to system( meaning 1 kernel thread to 1
user thread), does that mean that processors should be equal or more
than the threads?
My last experience with AIX was 4.2. I can't help with this.
suppose if we set,
rc = pthread_attr_setscope(&tattr,PTHREAD_SCOPE_SYSTEM) ;
And if i have 4 processors and 7 threads running simultaneously in my
applications.
will that work? or will it cause coredump ? will other threads wait for
CPU.
Of course it could work.

It could coredump if you had incorrect programming.

Yes.
how is the ratio mapped?
Unknown. See your operating system's task sceduler documentation
and all of the parameters you have set for your system, and all
tasks in the system.
how will the scheduler behave in this case?
It is supposed to make the best effort with what hardwaare it has.
A single CPU can generally keep dozens, or more, extremely compute
intensive tasks working most of the time.
please help me in resolving my issues.
I have no idea what you are worried about. You seem to be
over optimizing the thread/process utilization of your system.
It is truely that busy?
thanks in advance to all the experts for their opinion.
Regards
Nagaraj Hayyal.


David
Nov 8 '05 #3
nagaraj_hayyal
2 New Member
Hello,

On Mon, 7 Nov 2005 14:01:56 UTC, "nrhayyal" <nagaraj_hayyal@satyam.com> wrote:
[color=blue]
> Hi All,
> thanks for reading this post.
> just wanted to know about the ratio of threads and processors.
> i am working on c++ on AIX5.2 platform.
> my c++ program are multithreaded programs.
>
>
> In a multithreaded application,should no of processors be equal to no
> of threads ?[/color]

Not unless you have extremely compute intensive tasks that will never
block or wait on anything.
[color=blue]
> if we set the thread_scope to system( meaning 1 kernel thread to 1
> user thread), does that mean that processors should be equal or more
> than the threads?[/color]

My last experience with AIX was 4.2. I can't help with this.
[color=blue]
> suppose if we set,
> rc = pthread_attr_setscope(&tattr,PTHREAD_SCOPE_SYSTEM) ;
>
>
> And if i have 4 processors and 7 threads running simultaneously in my
> applications.
> will that work? or will it cause coredump ? will other threads wait for
> CPU.[/color]

Of course it could work.

It could coredump if you had incorrect programming.

Yes.
[color=blue]
> how is the ratio mapped?[/color]

Unknown. See your operating system's task sceduler documentation
and all of the parameters you have set for your system, and all
tasks in the system.
[color=blue]
> how will the scheduler behave in this case?[/color]

It is supposed to make the best effort with what hardwaare it has.
A single CPU can generally keep dozens, or more, extremely compute
intensive tasks working most of the time.
[color=blue]
> please help me in resolving my issues.[/color]

I have no idea what you are worried about. You seem to be
over optimizing the thread/process utilization of your system.
It is truely that busy?
[color=blue]
> thanks in advance to all the experts for their opinion.
>
>
> Regards
> Nagaraj Hayyal.[/color]

David
thanks david,
this means its not the programming issue, instead its the OS issue which OS will Take care of that.
program can only instruct the OS, but cant force the OS on how to do the job.
i guess i am right in what i am saying.
........

Nagaraj
Nov 8 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
10969
by: Richard Wallace | last post by:
Hello all, I'm looking for some input on the best tools to use for profiling multithreaded C++ code developed on GNU/Linux and compiled using gcc-3.1. More specifically, the distro in use is RH...
3
3100
by: Amit Dedhia | last post by:
Hi I am developing a Dot net application (involving image processing) on a uni processor. It works well on my machine. I then take all my code on a multi processor, build and run the application...
2
2724
by: nagaraj_hayyal | last post by:
Hi All, thanks for reading this post. just wanted to know about the ratio of threads and processors. i am working on c++ on AIX5.2 platform. my c++ program are multithreaded programs. ...
7
2260
by: Pavils Jurjans | last post by:
Hello, I wanted to get some light in the subject. As I develop ASP.NET applications, it's necessary to understand how exactly the server- communication happens. It seems like initially...
3
1570
by: Chris Calzaretta | last post by:
Hello Working with system.threading.thread Ok I have an windows user control. It has 3 thread on it thread 1 uploaded files types a thread 2 upload files types b thread 3 upload files types c...
3
2580
by: groups | last post by:
Hi all, I've recently ported a rather large C application to run multithreaded. A few functions have seriously deteriorated in performance, in particular when accessing a rather large global...
6
3464
by: Stephen Carson | last post by:
I'm trying to build a Web Service that will kick off threads as logging requests come in. These threads will then log to the database. I have been able to make a simple Web Service. I have been...
3
1999
by: clqrq | last post by:
i have just a little question: guess i have a class with a static function and i have different threads running. do i have to expect the problem that 2 treads try to acces CA::static() at the...
1
1970
by: Dan Bass | last post by:
Using: .Net (happens to be VB but same with C#) 2.0 SQLXML4 SQL Server 2005 I've got a multithreaded .Net application that uses the SQLXmlBulkLoad call and I'm not convinced the COM object is...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.