473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

limite the use of CPU by threads.

i want to know how to limite the use of CPU by threads using C++. can
you help me please?

May 16 '06 #1
6 1538
VirtualDev wrote:
i want to know how to limite the use of CPU by threads using C++. can
you help me please?


You need to ask this in a news group specific to your compiler
and operating system. Since you don't even mention what CPU
you are using, it's pretty difficult to even begin to guess what
news group that might be. Try groups.google.com and do some
searching for your platform.

Here we only talk about the standard C++ language, and that
does not include any notion of a thread, never mind doing any
sort of limiting the CPU in a thread.
Socks

May 16 '06 #2
VirtualDev wrote:
i want to know how to limite the use of CPU by threads using C++. can
you help me please?


You are asking how to set the scheduler priority of threads.

You need to use Google to find a forum dedicated to your threading library.
This forum is only qualified to discuss the C++ language itself, which
doesn't come with a portable thread solution.

Further, both the need to have threads and the need to schedule their
priorities are signs of a poor design. Entry-level programmers often use
threads instead of building an event-driven architecture. So you might
think about simplifying your design, too.

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
May 16 '06 #3
thanks a lot.

May 17 '06 #4
Puppet_Sock wrote:
VirtualDev wrote:
i want to know how to limite the use of CPU by threads using C++. can
you help me please?


You need to ask this in a news group specific to your compiler
and operating system. Since you don't even mention what CPU
you are using, it's pretty difficult to even begin to guess what
news group that might be. Try groups.google.com and do some
searching for your platform.

Here we only talk about the standard C++ language, and that
does not include any notion of a thread, never mind doing any
sort of limiting the CPU in a thread.
Socks


Can someone please explain to me this standard C/C++ vs. platform
dependent issue. Considering threads, the C run-time library includes a
function __beginthread. Under Windows (pardon me for saying) this is in
a file libcmt.lib. If I link with that library or call functions from it
(e.g. the aforementioned beginthread), does that mean my source won't
port to linux?

Then how do i know what is and what isn't a part of standard C/C++, that
is, which functions i mustn't call if i want to retain portability?

Dumb question, i know, but the "this is not a standard c++ topic" kind
of replies seem to exuberate here.
May 17 '06 #5
damjan wrote:
[..]
Can someone please explain to me this standard C/C++ vs. platform
dependent issue. Considering threads, the C run-time library includes
a function __beginthread.
Here is your explanation: the C run-time library only includes that
function on _your_ *particular* platform. It doesn't on many others.
That's what it means "platform-dependent".
Under Windows (pardon me for saying) this
is in a file libcmt.lib. If I link with that library or call
functions from it (e.g. the aforementioned beginthread), does that
mean my source won't port to linux?
It might. Or it might not. You need to ask in a Linux newsgroup.
Then how do i know what is and what isn't a part of standard C/C++,
that is, which functions i mustn't call if i want to retain
portability?
RTFM. If it does not specify which functions are ANSI (ISO) standard
library functions, then get a better M.
Dumb question, i know, but the "this is not a standard c++ topic" kind
of replies seem to exuberate here.


Unfortunately. Many first-time posters simply do not understand that the
library they are using consists of two parts: the standard part and the
platform-specific part. They often confuse the two. The same with the
language. There is the standard part and there are extensions. Every
compiler provides some. We in comp.lang.c++ only discuss standard parts
of both the langauge and the library. For compiler-specific extensions
there are compiler-specific newsgroups. For platform-specific library
portions there are platform newsgroups. Easy? I say. But seems far too
complicated for some posters.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 17 '06 #6

Phlip wrote:
VirtualDev wrote:
i want to know how to limite the use of CPU by threads using C++. can
you help me please?
You are asking how to set the scheduler priority of threads.

You need to use Google to find a forum dedicated to your threading library.
This forum is only qualified to discuss the C++ language itself, which
doesn't come with a portable thread solution.

Further, both the need to have threads and the need to schedule their
priorities are signs of a poor design.


Are you saying that use of threads is poor design?
Are you saying that setting priority of a thread is a sign of poor
design?

Entry-level programmers often use threads instead of building an event-driven architecture. So you might
think about simplifying your design, too.


Are you saying that a system using threads is an alternative to an
event driven system?

regards
Andy Little

May 18 '06 #7

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

Similar topics

3
by: Ronan Viernes | last post by:
Hi, I have created a python script (see below) to count the maximum number of threads per process (by starting new threads continuously until it breaks). ###### #testThread.py import...
0
by: Al Tobey | last post by:
I was building perl 5.8.2 on RedHat Enterprise Linux 3.0 (AS) today and noticed that it included in it's ccflags "-DTHREADS_HAVE_PIDS." I am building with -Dusethreads. With newer Linux...
0
by: kovac | last post by:
Hi NG With the Directory class of Vb. NET I can accessed Active Directory without restriction. If I make a query for the properties of a container (for example, MEMBERS), I get back only 1000...
6
by: m | last post by:
Hello, I have an application that processes thousands of files each day. The filenames and various related file information is retrieved, related filenames are associate and placed in a linked...
10
by: [Yosi] | last post by:
I would like to know how threads behavior in .NET . When an application create 4 threads for example start all of them, the OS task manager will execute all 4 thread in deterministic order manes,...
3
by: mjheitland | last post by:
Hi, I like to know how many threads are used by a Threading.Timer object. When I create a Threading.Timer object calling a short running method every 5 seconds I expected to have one additional...
10
by: Darian | last post by:
Is there a way to find all the thread names that are running in a project? For example, if I have 5 threads T1, T2, T3, T4, T5...and T2, T4, and T5 are running...I want to be able to know that...
1
by: Albano Alves | last post by:
Boas! Estou desenvolver um gestor documental para funcionar numa intranet. Uma das acções é o upload de ficheiros para o servidor. Existe alguma forma de ilimitar o tamanho dos ficheiros no...
2
by: shahalashamo | last post by:
in order to upload image to database,i put a fileUpload control in the InsertItemTemplate of the formView,the code as follows: <asp:FileUpload ID="FileUploadKeyImage"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
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
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...
0
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,...
0
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
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
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,...

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.