473,884 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multithreading multiple with processors

Do i need to use a special class if i need to code on computer with
multiple processors. I need to make sure that all of the CPU resources
are used to process the code. Is there a way to do this?
thank you,
Mars

*** Sent via Developersdex http://www.developersdex.com ***
Jun 27 '08 #1
2 1422
On 13 maio, 13:44, Victory <csh...@devdex. comwrote:
Do i need to use a special class if i need to code on computer with
multiple processors. I need to make sure that all of the CPU resources
are used to process the code. Is there a way to do this?
thank you,
Mars

*** Sent via Developersdexht tp://www.developersd ex.com***
Hi Mars,

Well, in my opinion, I think multi-processor environment are managed
by the OS.
One thing you´ve to do is, contruct an multithreading application...
avoiding any kind of knowledge about how to access each processor, the
OS do it for you.

[]´s
Breno.
Jun 27 '08 #2
On Tue, 13 May 2008 09:44:06 -0700, Victory <cs****@devdex. comwrote:
Do i need to use a special class if i need to code on computer with
multiple processors. I need to make sure that all of the CPU resources
are used to process the code. Is there a way to do this?
That depends on what you mean. If you have only one thread in your
application, then you will only use one CPU.

If you have multiple threads, you will use at most as many CPUs as you
have threads. The OS will ensure that, if a CPU is available and you have
a thread that's runnable (that is, it's not waiting on something), the
thread will run. So generally speaking, the answer is: just make sure you
have enough threads ready to run to keep all the CPUs busy.

In practice, it can get very complicated, depending on your application,
but then you haven't really offered any details to allow a better answer.
Hopefully the above is enough to get you started.

Pete
Jun 27 '08 #3

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

Similar topics

5
1562
by: Harold Howe | last post by:
Howdy, 1- Are property reads in effect volatile? Or is the compiler allowed to optimize property reads away? ie class foo { public int bar { get { return m_bar;}
47
3769
by: mihai | last post by:
What does the standard say about those two? Is any assurance that the use of STL is thread safe? Have a nice day, Mihai.
11
4278
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate threads of a multithreaded program using embedded SQL. Since the threads do not need to share transaction scopes, the sqleAttachToCtx family of APIs do not seem to be necessary. <quote> In the default implementation of threaded applications against...
4
2676
by: boo73uk | last post by:
Hi All, I'm going to rewrite a VB6 app to VB.net and I need some pointers. Basically this app spawns simultaneous,multiple, independant ActiveX.exe 'workers' which query a SQL Server database and BCP a load of data out. Now, what is the best way to approach this in .Net? Can .Net give me a better way of utilising the resources of the server? We're also getting some new hardware, 2 CPU Xeon rig with HT (hyper threading). Are there any...
2
2274
by: Pradnya Patil | last post by:
hi , I am trying to draw ' html div-tag ' on the screen which will resemble a rectangle through vb.net code. I want it to be drawn faster...so I introduced multithreading using Threadpool. I divided the complete drawing into 3 parts..1st will be done by main thread and other two are done in these procedures - <1LongTimeTask <2LongTimeTask2 I have invoked the threads using below method. **************
7
16317
by: Ray | last post by:
Hello, Greetings! I'm looking for a solid C++ multithreading book. Can you recommend one? I don't think I've seen a multithreading C++ book that everybody thinks is good (like Effective C++ or Exceptional C++, for example). Platform-specific (e.g.: Win32, POSIX) is OK, as long as it's good :) Thank you, Ray
20
2275
by: S.Mohideen | last post by:
Hi Folks, Python is praised about - me too. But at one instance it fails. It fails to behave as a true multi-threaded application. That means utilizing all the CPUs parallely in the SMP efficiently stays as a dream for a Python Programmer. Discussion threads say its due to GIL - global interpreter lock. But nobody has mentioned any alternative to that apart from suggestions like "Code it in C" and POSH (http://poshmodule.sf.net). Is...
16
15579
by: WATYF | last post by:
Hi there... I have a huge text file that needs to be processed. At the moment, I'm loading it into memory in small chunks (x amount of lines) and processing it that way. I'd like the process to be faster, so I'd like to try creating multiple threads, and having them load different chunks of the file at the same time and process it asynchronously. Is it possible to do something like that, and if so, what would be needed to do so?
2
2239
by: d33a | last post by:
Hello! Can somebody give me a hint? I am trying to obtain the CPU usage for 2 processors (or more ) with active multithreading. i tried all methods - using the API and using the performance counter and it doesn't work, the results are not like the one's in taskmanager. I tried getting the _Total or (200 minus Idle time). I will dispose the last try number 7 i guess. The code is:
0
9954
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10769
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10869
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10426
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9591
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7985
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4623
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 we have to send another system
3
3243
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.