icelava.net

INSERT neural.pulsation INTO public_brain FROM flesh_processor WHERE neural.retention < 0.1
Welcome to icelava.net Sign in | Help
in Search

Need you to test something out for me

Last post 03-19-2005, 21:16 by Gibby. 8 replies.
Sort Posts: Previous Next
  •  02-20-2005, 4:49 923

    Need you to test something out for me

    Can you create a console .exe .NET program and put in an infinite while loop and run the program.While the program is running,can you check how much CPU's resources was being used and get back to me?I have a console application that is supposed to run 24/7,but it's a resource hog.So i'm tryin to find ways to fix it.
  •  02-20-2005, 12:25 924 in reply to 923

    Re: Need you to test something out for me

    I had previously been looking for ways to throttle and limit the CPU usage as well but have not found a good way. What you can do is to lower the priority of the running thread so it does not take precedence over more important processes and threads.
  •  02-20-2005, 21:26 925 in reply to 924

    Re: Need you to test something out for me

     icelava wrote:
    I had previously been looking for ways to throttle and limit the CPU usage as well but have not found a good way. What you can do is to lower the priority of the running thread so it does not take precedence over more important processes and threads.


    Is there a way to set the priority programtically?I'm surprised that a .net console application that does nothing,but runs an infinite 'while' loop would take up 100% CPU resources,not a good thing,i should say.
  •  02-20-2005, 22:16 926 in reply to 925

    Re: Need you to test something out for me

    Yes you can make use of the Thread.Priority property.

    Yes an endless loop, even when empty, does make the CPU do work (deciding if the condition is true or not).
  •  02-21-2005, 1:02 927 in reply to 926

    Re: Need you to test something out for me

    I find it weird that a simple test condition can occupy up to 100% of the CPU's resources.Btw,if the thread is running an infinite loop,will it run infinitely or stop at some point?My program which was supposed to run 24/7 gets stopped due to some unknown reason after about 1 day of running.Basically,the code in the infinite loop check a table for data every 5 minutes,if there is data.The program will do some processing and then clear the table.Then it checks the table again every 5 minutes.
  •  02-22-2005, 18:44 928 in reply to 927

    Re: Need you to test something out for me

     Gibby wrote:
    I find it weird that a simple test condition can occupy up to 100% of the CPU's resources.
    As much as I don't like it, an infinite loop does tell the CPU to do some work.
    Basically,the code in the infinite loop check a table for data every 5 minutes,if there is data.The program will do some processing and then clear the table.Then it checks the table again every 5 minutes.
    You are better off developing a one-run sequence program that does this check and using Task Scheduler to launch it every 5 minutes.
  •  02-23-2005, 23:45 929 in reply to 928

    Re: Need you to test something out for me

     icelava wrote:
    You are better off developing a one-run sequence program that does this check and using Task Scheduler to launch it every 5 minutes.


    The only problem with the one run sequence is that if the program takes longer than 5 minutes to execute it's stuff.Then after 5 minutes is up,the task scheduler will open up another instance of that program as the current one is still doing some processing.With 2 instances accessing the same database,data corruption could occur,plus the interval can't be staggered more than 5 minutes as it needs to check the database within small time period intervals,so 5 minutes is the max between each checking.
  •  03-17-2005, 1:32 936 in reply to 929

    Re: Need you to test something out for me

    You can make the program a singleton, so only an instance may run at any point of time. I do not have the code handy now but you can check if another instance is already running, and exit if so.
  •  03-19-2005, 21:16 941 in reply to 936

    Re: Need you to test something out for me

     icelava wrote:
    You can make the program a singleton, so only an instance may run at any point of time. I do not have the code handy now but you can check if another instance is already running, and exit if so.


    Never mind,i've handed that project to someone else,it's her problem now.
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems