473,406 Members | 2,954 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,406 software developers and data experts.

Help on creating a program that runs continuosly in c#

Hello,

I am trying to write a program that will fetch the amount of memory used by a process on a pc and write it to a text file. I have done this with the help of the
System.Diagnostics library, the problem is that I want the program to execute continuously (it should not stop). What is the best way that this can be done ?.

I have already tried the following

1) Infinite for loop (not efficient as it consumes all the cpu)

2) Writing the functionality as a windows service (again not efficient as the service starts, executes the code once and since it does not have anything else to do , it just stands there and does nothing)

Any code examples would be of great help ..

Cheers
Jaic
Jul 24 '08 #1
1 911
Plater
7,872 Expert 4TB
Put Thread.Sleep()s in your infinite loop and it will not eat CPU cycles.
You could also conside using the system.threading.timer object?
Jul 24 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Ken Varn | last post by:
I have a named mutex object that is accessed by both an asp.net application and a Windows executable .net application. The Windows executable runs under the administrator logon, while the asp.net...
13
by: Mike | last post by:
Normally scheduling a job is a very elementary operation but for some hidden reason I've been unable to schedule a job which runs on a 28 day cycle, even though I have at least 16 other jobs...
2
by: | last post by:
I'm trying to create a VB .asp project in Visual Studio .NET. When I try to create the project it tells me it is unable to create: \\www.drwhome.com\wwwroot$\WebApplication1 This is on a an...
8
by: vicky | last post by:
Hello,I met a question when I wrote the program.I want the program can transmit the data frame continuosly through the RS232 when the communication has been interrupted.But I don't know how to...
4
by: Millhouse50 | last post by:
I am wondering how I can create like a dynamic hyperlink using C#. I am working with asp.net 2.0 and iis5 on windows 2000 server. I am creating a file in a program that I have which needs to be...
12
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed...
1
by: shivkumarvk | last post by:
i want to build such a program that should listen to perticular port and reads data from that port continuosly. please help me to build this
3
by: FariborzNouri | last post by:
Need help with HEC-RAS Hello I am trying to run a COM application known as HEC-RAS from an unmanaged C++ program in Visual Studio. Classes have been added to the project by adding new MFC classes...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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.