.Net application almost stalls the system

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alag20
    New Member
    • Apr 2007
    • 84

    .Net application almost stalls the system

    Hi,
    I am making a c# application which seems to be stalling the system. When I check the system properties in task manager, it shows that I am hardly using any memory or cpu. Still when I run this app, then the whole computer slows down termendouly and I am not able to do anything else.

    Can someone please advise why something like this might be occuring?
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    What happens when you run the app on your development machine in debug - do you have the same problem?

    Dr B

    Comment

    • jamesd0142
      Contributor
      • Sep 2007
      • 471

      #3
      Sounds to me like you have a some sort of never ending loop/process running

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Originally posted by jamesd0142
        Sounds to me like you have a some sort of never ending loop/process running
        That's what I was thinking too.

        Comment

        • alag20
          New Member
          • Apr 2007
          • 84

          #5
          Originally posted by DrBunchman
          That's what I was thinking too.
          Well the application does finish and exits in approx 5 - 6 mins so the application is working through the process, but its other applications which seems to be hanging or playing as if dead and no system resources availlable when the cpu is 98% idle and more than 2/3 memory [as I have 2 gb ram] is availble for use!

          Comment

          • DrBunchman
            Recognized Expert Contributor
            • Jan 2008
            • 979

            #6
            What's the app actually doing?

            Comment

            • alag20
              New Member
              • Apr 2007
              • 84

              #7
              Originally posted by DrBunchman
              What's the app actually doing?
              Well it patches a binary file. But this file is not being used anywhere or in anyway!

              Comment

              • Plater
                Recognized Expert Expert
                • Apr 2007
                • 7872

                #8
                Do you use any COM objects or do any DLL calls?
                Or is it all .NET functions?

                If you have a loop that process a large binary file, even though the CPU/memory are fine, you are probably bogging down the harddrive. That is not easy to track with taskmanager. If the binary file is large, chances are it's fragmented, and if you frequently download/copy/delete large files, your drive is probably fragmented heavily. That increases seek times. It can be devastating on 5400rpm drive.

                If you want this program to be "running in the background" you should consider slowing down its I/O access in some manor so that other harddrive calls (like paging system) can be made.

                Comment

                • alag20
                  New Member
                  • Apr 2007
                  • 84

                  #9
                  Originally posted by Plater
                  Do you use any COM objects or do any DLL calls?
                  Or is it all .NET functions?

                  If you have a loop that process a large binary file, even though the CPU/memory are fine, you are probably bogging down the harddrive. That is not easy to track with taskmanager. If the binary file is large, chances are it's fragmented, and if you frequently download/copy/delete large files, your drive is probably fragmented heavily. That increases seek times. It can be devastating on 5400rpm drive.

                  If you want this program to be "running in the background" you should consider slowing down its I/O access in some manor so that other harddrive calls (like paging system) can be made.
                  Hi Plater,
                  Thanks for your help. How can I slow down I/O access from .Net. The uncompression is written in 32bit C application which i call from .Net!

                  Comment

                  • Plater
                    Recognized Expert Expert
                    • Apr 2007
                    • 7872

                    #10
                    I thought so.
                    Does it do it "all at once" like you make the call and it does it's thing. Or do you loop through with helper calls? If there's a little of involvement on your side you can just put in thread sleeps to slow it down and give other threads priority, but the win32 might like "lock" the device(harddriv e) somewhat, unsure.

                    Is it just an "unzip" type decompression? .NET can do the simple decompression stuff.

                    Comment

                    • alag20
                      New Member
                      • Apr 2007
                      • 84

                      #11
                      Originally posted by alag20
                      Hi Plater,
                      Thanks for your help. How can I slow down I/O access from .Net. The uncompression is written in 32bit C application which i call from .Net!
                      Also it seems to be better in Debug / Release mode from VS2005

                      Comment

                      • alag20
                        New Member
                        • Apr 2007
                        • 84

                        #12
                        Originally posted by Plater
                        I thought so.
                        Does it do it "all at once" like you make the call and it does it's thing. Or do you loop through with helper calls? If there's a little of involvement on your side you can just put in thread sleeps to slow it down and give other threads priority, but the win32 might like "lock" the device(harddriv e) somewhat, unsure.

                        Is it just an "unzip" type decompression? .NET can do the simple decompression stuff.
                        It is binary difference file uncompression and .Net cant do it on its own without various algorithms etc. I just call the it as Process.Start() with params. Then I wait in .Net to check if the thread has completed. Here [on .Net side] I have a thread.sleep for .net thread to go and check the application every few seconds to see if it has completed.

                        Comment

                        • Plater
                          Recognized Expert Expert
                          • Apr 2007
                          • 7872

                          #13
                          So you already had a thread sleep and it was still locking up the system?

                          Comment

                          • alag20
                            New Member
                            • Apr 2007
                            • 84

                            #14
                            Originally posted by Plater
                            So you already had a thread sleep and it was still locking up the system?
                            Yes it still seems to hog when I execute it. It is alot better if I run it from Visual Studio [pointing to the directory and then debugging under debug / release mode]

                            Comment

                            • Plater
                              Recognized Expert Expert
                              • Apr 2007
                              • 7872

                              #15
                              Very weird.
                              Is the code that executes the sleep (as well as other stuff) run on the same thread as the gui?
                              That's really all I can think of for debug making it better, the threads are run a little differently in debug mode.

                              Comment

                              Working...