Create a process that uses cpu % without do anything

This is a discussion on Create a process that uses cpu % without do anything within the Windows Programming forums, part of the Platform Specific Boards category; I have a process that uses the 100% of my cpu.. that makes it really hot. I want to know ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    161

    Create a process that uses cpu % without do anything

    I have a process that uses the 100% of my cpu.. that makes it really hot. I want to know if it is possible to create another process (in C) with the same thread priority that uses the CPU without do anything, I mean something that try to use the 100% of the cpu without use it for real... something like the "idle cycle system" i see in my taskmanager...

    so if i run that "magic" program the other process will use the 50% of the cpu (that mean less hot!!)

    Mh I know that the problem can be not so clear and my bad english is not helpful

    thanx for your attention
    This forum is the best one I've ever seen. Great ppl, great coders

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,651
    Nothing you can do unless you have the source code, in which case you can place strategic "Sleep()" calls in the code.

    Or buy a proper CPU cooling kit

    gg

  3. #3
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    If you use this code:

    Code:
    while (true);
    That'll probably genereate less heat than more complex calculations.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    Is it using 100% doing useful work or is it using 100% just implementing a sleep-like function in the FAQ ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    the program is seti@home and it is doing useful work... I want to create the program I talked before for help people that use it on notebook where it's not so good to have allways a 100% process running
    This forum is the best one I've ever seen. Great ppl, great coders

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    Oh I see.

    You could try using task manager to set the priority of the program to a really low value.
    Or maybe write a program to do the same

    But unless you can drop it down to equal the windows idle process, then it will always use as much CPU time as it can, so long as nothing with a higher priority needs CPU time.

    Seti@home is incompatible with notebooks IMO (not just SETI, all distributed computing applications). The whole point of power saving modes is to do as little work as possible given the limited resources of the system. To then blow all that away by running background calculations kinda defeats the objective.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    Yes I agree with you but you know, I (try to) write seti@home plugins and there are a lor of people that asked me for this one

    I think I will stop the development of this one

    thanx everyone
    This forum is the best one I've ever seen. Great ppl, great coders

  8. #8
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You can use SuspendThread() to start and stop it periodically and therefore slow it down. Be careful as SuspendThread() can lead to deadlocks.

  9. #9
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    mhhh interesting !!! i will work on it
    This forum is the best one I've ever seen. Great ppl, great coders

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Portable method of accessing CPU time for given process
    By saeculum in forum Linux Programming
    Replies: 3
    Last Post: 03-13-2009, 03:44 PM
  2. how to get process info ( to extract process thread id )
    By umen242 in forum C++ Programming
    Replies: 4
    Last Post: 02-12-2009, 12:08 PM
  3. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 01:14 PM
  4. Process sending file descriptors to another process
    By Yasir_Malik in forum C Programming
    Replies: 4
    Last Post: 04-07-2005, 07:36 PM
  5. process ring
    By gregulator in forum C++ Programming
    Replies: 0
    Last Post: 02-28-2005, 07:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21