473,395 Members | 1,527 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,395 software developers and data experts.

CPU usage program

Hi everybody,

Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?

Thanks,
Sethu

Oct 8 '07 #1
12 3084
se*****@gmail.com wrote:
Hi everybody,

Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?
int main(void)
{
volatile unsigned long i = 0;
for (;;) i++;
return 0;
}

Oct 8 '07 #2
se*****@gmail.com wrote:
Hi everybody,

Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?

The OS will try to stop such an application for consuming CPU cycles, so
either you need to write a *rootkit*, or fool the OS billing system.
Both methods, require *off-topic* code, which can be used by any
*clueless* script kid, to attack computer systems.
The <se*****@gmail.comaccount, may already be tracked by US
authorities, so I suggest you go under ground... before getting into
trouble. :)
--
Tor <torust [at] online [dot] no>
Oct 8 '07 #3
Tor Rustad <to********@hotmail.comwrites:
se*****@gmail.com wrote:
>Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?

The OS will try to stop such an application for consuming CPU cycles,
so either you need to write a *rootkit*, or fool the OS billing system.
[...]

<OT>
Windows prevents any process from consuming more than 50% of the CPU?
Really? How do I enable this?
</OT>

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Oct 8 '07 #4
In article <11*********************@22g2000hsm.googlegroups.c om>,
se*****@gmail.com <se*****@gmail.comwrote:
>Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?
Either have fewer than two CPUs (increasingly tricky these days), or
write a multi-threaded program.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Oct 8 '07 #5
Keith Thompson said:

<snip>
Windows prevents any process from consuming more than 50% of the CPU?
Yes. It achieves this by using 51% of the CPU itself.

<g,d&r>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Oct 8 '07 #6
Keith Thompson wrote On 10/08/07 16:33,:
Tor Rustad <to********@hotmail.comwrites:
>>se*****@gmail.com wrote:
>>>Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?

The OS will try to stop such an application for consuming CPU cycles,
so either you need to write a *rootkit*, or fool the OS billing system.

[...]

<OT>
Windows prevents any process from consuming more than 50% of the CPU?
Really? How do I enable this?
</OT>
<OT>

Press the Windows "flag" key, press U, press U again.
(YMMV on non-English installations.)

</OT>

--
Er*********@sun.com
Oct 8 '07 #7
On 8 Oct 2007 20:24:04 GMT,
Richard Tobin <ri*****@cogsci.ed.ac.ukwrote:
In article <11*********************@22g2000hsm.googlegroups.c om>,
se*****@gmail.com <se*****@gmail.comwrote:
>>Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?

Either have fewer than two CPUs (increasingly tricky these days), or
write a multi-threaded program.
Or run more than one copy of the same program.

Martien
--
|
Martien Verbruggen | Freudian slip: when you say one thing but
| mean your mother.
|
Oct 8 '07 #8
On Mon, 08 Oct 2007 17:21:52 -0400, in comp.lang.c , Eric Sosman
<Er*********@sun.comwrote:
Press the Windows "flag" key, press U, press U again.
(YMMV on non-English installations.)
Amusingly, Windows-U on my XP box invokes the Screen Magnifier and
attempts to read the menus to me...
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Oct 8 '07 #9
Keith Thompson wrote:
Tor Rustad <to********@hotmail.comwrites:
>se*****@gmail.com wrote:
>>Can anyone give me a simple program which would consumes more CPU
usage (more than 50%) in windows?
The OS will try to stop such an application for consuming CPU cycles,
so either you need to write a *rootkit*, or fool the OS billing system.
[...]

<OT>
Windows prevents any process from consuming more than 50% of the CPU?
Really? How do I enable this?
</OT>
Keith, very off-topic! *shocked*

Try: remove the buggy kernel mode code, and see SetPriorityClass() and
SetThreadPriority() WIN32 API for ideas. :-P

For Linux, BSD, Solaris, AIX, HPUX and Windows, user land programs can
consume more than >50% CPU. BUT, those OS'es try to avoid this, by
scheduling time interrupts, which bill the running process/thread. When
it's quota is up, the kernel scheduler typically put the running user
mode process/thread to sleep. I'm not sure what the actual limit is on
Windows, but it's there.

See e.g. "Modern Operating Systems" 2.ed, p.796, Tanenbaum.

--
Tor <torust [at] online [dot] no>
Oct 8 '07 #10
In article <fP*********************@telenor.com>,
Tor Rustad <to********@hotmail.comwrote:
>For Linux, BSD, Solaris, AIX, HPUX and Windows, user land programs can
consume more than >50% CPU. BUT, those OS'es try to avoid this
General purpose operating systems try to allocate time fairly between
processes. If there are no other processes wanting the CPU, there is
no reason for the OS to stop a process from using 100%.

Most systems have a mechanism to give a process a higher or lower
priority if requested ("nice" in traditional unix).

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Oct 8 '07 #11
Richard Tobin wrote:
In article <fP*********************@telenor.com>,
Tor Rustad <to********@hotmail.comwrote:
>For Linux, BSD, Solaris, AIX, HPUX and Windows, user land programs can
consume more than >50% CPU. BUT, those OS'es try to avoid this

General purpose operating systems try to allocate time fairly between
processes. If there are no other processes wanting the CPU, there is
no reason for the OS to stop a process from using 100%.

No process in user mode, will normally be able to gain 100%, except for
a *very* short time. Kernel will interrupt it, and do the scheduling and
it's internal work.

However, most likely OP was sitting with a dual core CPU... :)

--
Tor <torust [at] online [dot] no>
Oct 8 '07 #12
Mark McIntyre wrote:
On Mon, 08 Oct 2007 17:21:52 -0400, in comp.lang.c , Eric Sosman
<Er*********@sun.comwrote:
> Press the Windows "flag" key, press U, press U again.
(YMMV on non-English installations.)

Amusingly, Windows-U on my XP box invokes the Screen Magnifier and
attempts to read the menus to me...
Try doing it in sequence, as Eric Sosman suggested.
Oct 14 '07 #13

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

Similar topics

1
by: Murat Tasan | last post by:
hi, i have a java application that can be fairly memory intensive. so, when i run the program, i use the -Xmx option to prevent out of memory errors. in particular, i have been using -Xmx512m,...
17
by: Eternally | last post by:
Hey folks, I'm writing a simple C++ application which runs continuously. I'm running the program from the command line in Cygwin from XP, and it's cross-compatible with Linux. While running...
2
by: Jarvis | last post by:
I've made a testing program to test the memory usage of some Data Forms. I create a MDI parent form with one single MDI child form, which is a Data Form generated by .NET Data Form Wizard. To...
2
by: Dennis McCrohan | last post by:
Hi- I'm wondering if anyone has run across any program for C++ development that will help track the memory usage of different objects (class instances) within a program. I find it's easy enough...
5
by: John Smith | last post by:
I am writing a program which should keep running if not interrupted. While testing the program, I noticed that when the program was first run, the cpu usage (on WinXP) was between 0 to 2 %. In the...
4
by: Davy | last post by:
Hi all, I am writing programs of algorithms using C++ and C. When I run the programs, I found the programs take 100 percent of the CPU usage and I cannot run any other program. How to control...
8
by: Grant Richard | last post by:
Using the TcpListener and TcpClient I created a program that just sends and receives a short string - over and over again. The program is fine until it gets to around 1500 to 1800 messages. At...
5
by: Grant Mills | last post by:
Is there anyway to reduce the amount of memory a VB.net program allocates? Just a simple windows form, with one button and a label, and all the button does is change the text in the label (it's...
3
by: Rob Harris | last post by:
When I run my program memory usage under Task Manager's Processes tab indicates about 9 megs. And as I do things with the program memory usage witll top out at about 12 Megs. However, if I...
3
by: Sirisha | last post by:
I am using the following code to get the CPU usage PerformanceCounter myCounter; myCounter = new PerformanceCounter(); myCounter.CategoryName = "Processor"; myCounter.CounterName = "%...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.