Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / October 2003

Tip: Looking for answers? Try searching our database.

Mutiple CPU problem in Threads.Count

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shashank Welankar - 15 Oct 2003 15:06 GMT
Hi,

"System.Diagnostics.Process.GetCurrentProcess().Thread.Count"

This does not work on the machine with mutiple CPU? Any hints from MS guys?

Shashank
Peter Koen - 15 Oct 2003 15:20 GMT
> Hi,
>
[quoted text clipped - 4 lines]
>
> Shashank

That Threads property is for the count of SystemThreads. These are not the
managed threads that you have in your application. It's possible that more
than one managed thread is running on a system thread. many threading
operations use the managed thread pool so it's no wonder that this thread
count is a different one than the number of threads you have in your
application.

On multiprocessor computers, the scheduler can move individual threads to
different processors, thus balancing the CPU load. Therefore the
ThreadCount may vary during execution. SystemThreads are created and
destroyed by the Framework as it needs them.

Signature

best regards

Peter Koen
-----------------------------------
MCAD, CAI/R, CAI/S, CASE/RS, CAT/RS
http://www.kema.at

Shashank Welankar - 16 Oct 2003 07:21 GMT
I should be more specific. I mean the app crashes on the line:

Dim op As System.Diagnostics.Process =
System.Diagnostics.Process.GetCurrentProcess()

//BUG line below

MsgBox(op.Threads.Count)

> > Hi,
> >
[quoted text clipped - 24 lines]
> MCAD, CAI/R, CAI/S, CASE/RS, CAT/RS
> http://www.kema.at
Dave - 16 Oct 2003 10:26 GMT
You haven't provided enough information for anyone to ascertain what the
problem might be. Is there an exception thrown? What does it say. Is there
anything in the event log? What output are you expecting that you are not
getting?

> I should be more specific. I mean the app crashes on the line:
>
[quoted text clipped - 33 lines]
> > MCAD, CAI/R, CAI/S, CASE/RS, CAT/RS
> > http://www.kema.at
Michael Giagnocavo [MVP] - 16 Oct 2003 18:09 GMT
In the dotnet.framework group he posted a full exception / stack trace.
-mike
MVP

> You haven't provided enough information for anyone to ascertain what the
> problem might be. Is there an exception thrown? What does it say. Is there
[quoted text clipped - 42 lines]
> > > MCAD, CAI/R, CAI/S, CASE/RS, CAT/RS
> > > http://www.kema.at
Shashank Welankar - 17 Oct 2003 07:02 GMT
This is the error we get...Its a windows application

Its on .NET version 1.1.4322.573, Windows 2000 Server machine

Hardware is

2 x 1GHz CPU
1GB RAM
2 x 18 GB HD
Windows 2000 server sp4 with current HotFixes >>MSSQL 2000 SP3a with
current HotFixes

System.InvalidOperationException: Couldn''t get process information from
remote machine. ---> System.ArgumentOutOfRangeException: Ticks must be
between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
Parameter name: ticks
  at System.DateTime..ctor(Int64 ticks)
  at System.DateTime.Subtract(TimeSpan value)
  at System.Diagnostics.NtProcessManager.GetThreadInfo(PERF_OBJECT_TYPE
type, IntPtr instancePtr, PERF_COUNTER_DEFINITION[] counters)
  at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library, Int32 processIndex, Int32 threadIndex, IntPtr dataBlockPtr)
  at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
  --- End of inner exception stack trace ---
  at
System.Diagnostics.NtProcessManager.GetProcessInfos(PerformanceCounterLi
b
library)
  at System.Diagnostics.NtProcessManager.GetProcessInfos(String
machineName, Boolean isRemoteMachine)
  at System.Diagnostics.ProcessManager.GetProcessInfos(String
machineName)
  at System.Diagnostics.Process.EnsureState(State state)
  at System.Diagnostics.Process.get_Threads()

This is the code

    Dim op As System.Diagnostics.Process =
System.Diagnostics.Process.GetCurrentProcess()
           MsgBox(op.Threads.Count)

Thanks,
Shashank

> You haven't provided enough information for anyone to ascertain what the
> problem might be. Is there an exception thrown? What does it say. Is there
[quoted text clipped - 42 lines]
> > > MCAD, CAI/R, CAI/S, CASE/RS, CAT/RS
> > > http://www.kema.at
Willy Denoyette [MVP] - 15 Oct 2003 17:16 GMT
What do you mean with 'does not work', please be more specific.

Willy.

> Hi,
>
[quoted text clipped - 3 lines]
>
> Shashank

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.