473,569 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

In a multithreaded application,sho uld 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,sho uld 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_se tscope(&tattr,P THREAD_SCOPE_SY STEM);
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 2119
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.programmin g.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,sho uld 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_se tscope(&tattr,P THREAD_SCOPE_SY STEM);
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,sho uld 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_se tscope(&tattr,P THREAD_SCOPE_SY STEM);
>
>
> 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
10975
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 7.2 running kernel 2.4.7 with SMP. The box has dual processors. Some of the options I've found are gprof - standard GNU profiler that comes...
3
3114
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 there. There is performance degradation. The usual performance of the application on MP machine is better than that of uni processor machine....
2
2730
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. 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...
7
2261
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 application is "sleeping", and it is not loaded in the memory. Then, after very first request to the app, it is compiled (aspx files), loaded into memory, and...
3
1571
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 this all happens at same time Works great
3
2587
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 array, that contains information that is shared among threads. Any idea, why the lines accessing this global array now take about 50x longer in the...
6
3469
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 able to get a simple multi-threaded example working. I have been used the SqlDataAdapter and DataSet classes extensively to access databases in a...
3
2012
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 same time or does the processor always make shure that one of them has to wait till the other finishes? or may it be that a static func can be...
1
1977
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 being released properly. The code is also called often and I'm not sure if I should be creating the object each time, or reusing it. I've tried...
0
7697
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7968
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6283
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.