C# - Multithreading On A Multi Core Machines Not Maxing CPU?

Jul 14, 2009

I am working on maintaining someone else's code that is using multithreading, via two methods:

1: ThreadPool.QueueUserWorkItem(New WaitCallback(AddressOf ReadData), objUpdateItem)

2: Dim aThread As New Thread(AddressOf LoadCache) aThread.Start()

However, on a dual core machine, I am only getting 50% CPU utlilization, and on a dual core with hyperthreadin enabled machine, I am only getting 25% CPU utilization. Obviously threading is extremely complicated, but this behaviour would seem to indicate that I am not understanding some simple fundamental fact?

[code]...

And this is occurring in a recursive function, so the QueueUserWorkItem can be executing multiple times, which in turn then executes exactly one new thread via the aThread.Start

Hopefully that gives a decent idea of how things are happening. under this scenario, should this not theoretically pin both cores, rather than maxing out at 100% on one core, while the other core is essentially idle?

View 6 Replies


ADVERTISEMENT

Thread Affinity In Multi-core System?

Nov 29, 2011

I was going to hijack another, related, thread to ask this, but I figured it derserved its own thread.The question I have is whether or not anybody has done sufficient testing to show whether a mutlithreaded program running on a multi-core system will spread the threads across all available cores, or whether it has some affinity for the core used by the main process (UI thread, or whatever it may be)? The reason I ask is because I remember a discussion over in General Computing where somebody showed that, for at least one case, all the threads were splitting time on a single core of a multi-core processor. I am wondering if that is the typical behavior, or an isolated case?

View 23 Replies

.net - Multi-core Processor Pegged Even When All Threads Are Just Sleeping?

Mar 3, 2010

I'm simulating some threading in a Windows Service, and the Thread.Start routine for each of my threads points directly to the following:

Private WithEvents CheckForOrdersTimer As System.Threading.Timer
Private Sub timerCheckForContracts_Tick(ByVal stateInfo As Object)
' Ticks every 5 seconds, then spawns threads until we're at our max
Do

[code]....

the threads aren't even doing anything yet, but with more than two threads running at the same time, my processor (Core 2 Duo 2.4 w/ 4GB) gets pegged and Windows gets really sluggish. According to what I've read, Thread.Sleep shouldn't be consuming any resources at all while it waits, but it may as well be running in a tight timing loop.

EDIT: Per the requests, I've expanded the amount of code I'm using. I was initially doing some database work before spawning each thread, but I've removed it and the processor maximization still occurs with just the code here (and, of course, the OnStart method for the Windows Service.

View 4 Replies

Multi-core Processor Pegged Even When All Threads Are Just Sleeping?

Mar 5, 2012

I'm simulating some threading in a Windows Service, and the Thread.Start routine for each of my threads points directly to the following:

Private WithEvents CheckForOrdersTimer As System.Threading.Timer
Private Sub timerCheckForContracts_Tick(ByVal stateInfo As Object)
' Ticks every 5 seconds, then spawns threads until we're at our max

[code].....

View 3 Replies

Make A Code That Sends One Application Or Program In 1 Core And Other Application In Other Core?

Jan 29, 2010

I'm using VB 2008, and I have a dual core computer.Is it possible to make a code that sends one application or program in 1 core, and other application in the other core?

View 1 Replies

Connect Client Machines With Sql Server Machines?

Dec 7, 2011

How to connect client machines with sql server machines ?Vb.Net as front end.

View 8 Replies

Using More Than One Of Cpu Core?

Feb 9, 2011

i have intel core quad cpu but my program cant use more than one of cores(it use 25% of cpu power but i want use 50% and more).

affinity is "<All Processors>" and all of cores are selected.

is there any way can use more than 50% of cpu power.

View 6 Replies

Set A Certain Thread To Run On The 2nd Core?

Dec 21, 2009

how i can set a certain thread to run on the 2nd core for eg...

View 8 Replies

For Loop CPU 25% Single Core

Oct 15, 2010

For loop CPU 25% single core

View 6 Replies

Possible To Split Up Threads (currently 6) So That 3 Run On Each Core?

Oct 18, 2011

I have a VB.NET app that spawns several threads for performing XML parsing/database interaction. Only one of my cores (only have 2 currently) is being used right now.I've looked at Task Parallelism in .NET 4 but I need to be able to start a task at different times (not all at once).Is it possible to split up the threads (currently 6) so that 3 run on each core? Also, if I don't want to limit my threads to 6, how can I check CPU/memory programmatically to find out if I can start another thread.

View 2 Replies

Use The Core Audio API In VB 2010?

May 20, 2012

I've been trying, without any luck whatsoever, to figure out how to use the Core Audio API in VB 2010. I started by downloading a wrapper dll located here: [URL]

[Code]...

View 2 Replies

VS 2008 Multi-threding - Adding Multi-threading Facilities - Cross-thread Operation Not Valid

Feb 10, 2010

I'm adding multi-threading facilities for the first time. I have a function that is wrapped to be run in a separated thread. This function retrieves data (text) from a combobox and it works for sure without multi-threading.

When I call it as multi-threaded, I get the following error when I try to retrieve the data from the cmobobox: Cross-thread operation not valid: Control 'cmb1stBL' accessed from a thread other than the thread it was created on.

It looks like a restriction of thread-safety... I assume that the child thread cannot read from his parent, to make sure that he doesn't change his parent data. So how can I read the data from the combobox? Should I read the comoboxbox data before calling the child thread?

View 4 Replies

Accessing Multiple Sites Multi-threading Or Multi Browsers?

May 14, 2011

I have a need to build an app that will access about 10 websites and pass data to them, etc.I've read about something called multi-threading when searching Google. I've also seen people say that they use multiple browsers.Which route is better to use? I figure if you have to do some sort of multi-threading that you would access a single browser?

View 2 Replies

.net - Null Reference Exception DNN Core 5.6.3

Jul 26, 2011

My site has been running fine for sometime now until recently I see in the event viewer a null reference exception in the DNN core:

DotNetNuke.Common.Globals.GetStatus() in

F:BuildsMaintenanceWorkingDirectoryLibraryCommonGlobals.vb:line
1125 at DotNetNuke.Common.Initialize.InitializeApp(HttpApplication
app) in

[code]....

the line 1125 is:

_Status = UpgradeStatus.None

Which is a property of the Globals class and an Enum Also when this happens it doesnt just do it once then sort its self it does it roughly every minute for an hour or so.I made sure all dataprovider.instances are either in a using or a try catch finally or self closing(if the reader is not used)?

View 2 Replies

Calcualte CPU Usage For An X-Core Machine?

Aug 2, 2010

Trying to make a badly archictected system work. In doing so we have ourselves in a postion of shelling mulitple instances of a program and managing the running processes. On startup the shelled program is CPU intensive and we need to limit the rate that we initiate the instances based on the CPU load. How do you calculate the CPU load of a multicore system?

View 1 Replies

Change Priority And Core Using For Each Process?

Feb 24, 2009

How can i change a process using only 1 core instead of 2 cores? Also, how can I set different prioritys to each process?As it does not save the settings which i put to each process in taskmanager on restart, i decided to make a program so i could simply click a button so it would change the settings for each process i want.For example:With a simple button click it changes msnmsgr.exe priority to low and makes it use only the 1st core.

View 2 Replies

Get Core And Memory Clocks Of Gpu Using Win32_VideoController?

Feb 8, 2012

How can i get the core and memory clocks of the gpu using the Win32_VideoController?

View 1 Replies

VS 2010 Adding System.Core?

Feb 5, 2010

Somehow the reference to System.Core got removed from one of my projects, which I think is causing some issues. If I try to re-add it to my references I get a message saying "A reference to 'System.Core' could not be added. This component is already automatically referenced by the build system". I think I need this reference because it is there when I start a new project by default

View 1 Replies

Where Is Microsoft.Office.Core.NewFile

Apr 20, 2012

I'm getting the error below trying to open a new workbook in Excel:

Imports Microsoft.Office.Core
...
Dim myExcel As New Excel.Application

[code].....

View 1 Replies

Collect Information From Core Temp And Use It As A Variable Within VB?

Dec 25, 2011

collect information from core temp ( how to gain information about the CPU directly from the motherboard or windows E.G temperature CPU name ) and use it as a variable within VB.

View 3 Replies

Timers Under Windows 7 Dual Core Processors ?

Aug 27, 2010

After I upgraded from Windows Xp to Windows 7 on any dual core cpu machine my programs that use a simple timer function run incorrectly. The program works with the exact same hardware under Windows Xp and Windows Server 2003. I am using Visual Studio 2005 to write .NET Visual Basic programs that use 2 timers to count down. The first timer, timer1, is set to a value say 150000 ms (150 seconds). The second timer, timer2, is set to 1000ms (1 second). Both timers are enabled one right after the other from a button click event and begin. The timer2 routine running every second updates a label counting down the seconds. When timer1 fires it disables itself and exits. Timer2 also checks to see if timer1 is still running if it is not it will stop. Under Windows Xp and Windows Server 2003 the resulting count in the label is 0 when timer2 detects timer1 has finished. Under Windows 7 when timer1 stops timer2 is not at 0 it is 3 for 150 seconds and gets larger the more timer1 is increased. It appears to me timer2 is not being fired every 1000ms as it was under Windows Xp.

I have included the Visual Basic code below. If you want to test it just run Visual Studio and create a new project. Put the buttons, numericupdown, and labels in your form and past my code into the correct buttons. I have used these type of timer events for years without any problems unit Windows 7. Windows 7 on a single core Pentium 4 with hyperthreading turned on works fine. Windows 7 on a dual core E6500 fails, Windows Server 2003 works.

Public Class Form1

Dim I As Integer

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[CODE]...

View 2 Replies

VS 2010 Referenced Component System.Core Could Not Be Found?

Mar 24, 2011

When my application loads in Visual Studio 2010 I see this warning. Everything runs ok in it as far as I'm aware but I'm completely ignorant in this area. Could that cause me a problem and is there a way to replace that component? There is also the other warning you see in the screenshot.

Quote:Warning1Namespace or type specified in the project-level Imports 'System.Linq' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

I did a search for the entire solution and it didn't turn up any Sysem.Linq anywhere. I looked at every Imports statement in my project and I don't have any Imports System.Linq anywhere unless it's somewhere where Visual Studio's quick find search doesn't see it.

View 4 Replies

Motherboards Do Expose Core Temperatures In WMI / ACPI Thermal Zone?

Jun 7, 2012

I'm currently working on a Visual Basic program that should be able to show CPU temperatures.To do this the cleanest way (in my opinion), I would like to use the Windows Management Interface (WMI) using
MSAcpi_ThermalZoneTemperature.Now, to my understanding, this requires that motherboard (MOBO) manufacture exposes these values to the WMI, which almost nobody actually do, but if they do, a "device" should show
up in the device manager called ACPI Thermal Zone under System Devices (let me know if I'm wrong).

As I would like to test my program and my current MOBO (Gigabyte GA-H67A-USB3-B3) doesn't seems to expose CPU temperatures to WMI (no

[Code]...

View 9 Replies

IDE :: Core Coding Experience Live Meeting The Visual Studio 2010 Team?

May 26, 2009

Code Coring Experience Live Meeting the Visual Studio Team Visual C# and Visual Basic languages continue to evolve towards feature parity, strive to simplify programming and deployment with the Microsoft Office APIs, and allow easy interop to dynamic languages. In the tools space, Visual Studio 2010 offers greater support for Test-Driven Development, where tests are written before product code as an iterative approach to software design. In this interactive session you will get a chance to connect with the two Program Managers DJ Park and Dustin Campbell as they walk through the feature areas they feel will have the greatest impact to you and your development teams.

[Code]...

View 1 Replies

Multi Web Services So Multi Singleton

May 14, 2011

i have one project with multiples web services so i created various singleton class thinking in

performance. now i think create one singleton class and that have the instances of my webservices

[code...]

View 1 Replies

Multi-threading Or Multi Browsers?

May 14, 2011

I have a need to build an app that will access about 10 websites and pass data to them, etc.I've read about something called multi-threading when searching Google. I've also seen people say that they use multiple browsers.Which route is better to use? I figure if you have to do some sort of multi-threading that you would access a single browser?Not sure which way I should approach this app.

View 2 Replies

App Not Working On SOME XP Machines

Aug 19, 2011

I have developed an application is VS2010 ( VB app using .NET4 ) ... the application runs fine under Windows 7 and on (3) XP machines we have here. Had one user looking for support on an XP machine ... when he started the app nothing happened. No errors or anything, just nothing happened. Had him install the latest .NET4 framework and everything was fine.

Just had another support issue ... user with the same complaint ... had him install latest .NET4 ... but this time did not fix the issue ... still nothing happens when he clicks to start the app ... no errors ... just nothing happens.

I can't check this because it runs on all our XP machines .... Is the only criteria that .NET4 be installed? I created an install that includes only the EXE from the BINRELEASE folder ... nothing else. Do I need anything else. Strange that it works on all our XP machines.

View 15 Replies

Compile - Cannot Run .exe On Some Machines

Jun 21, 2010

I have a small form program that is basically an interface for installing different software packages so that we can distribute a CD with our products that our customers can just pop in the drive, autorun, and click the button to install what they need. The problem that I am running into is unlike when I had built this same program in VB6, the program rewritten in VB.net will not run on some machines, and shows me an error: .net Framework initialization error. required version of .net framework v2.0.50727.

I realize that it is asking for that version of .net framework in order to run, but what I would really like to know is if there is a way to make my exe non-dependant on this so that it will run on any machine. Requiring my customers to install .net framework in order to access an interface designed just to idiotproof the installation of some setup files and provide easy access to a few pdf's really would just defeat the purpose.

View 4 Replies

How To Switch Machines

May 28, 2012

I have two machines, on the first of which I have developed my application to a point of satisfactory stability. Now I want to move everything to my second machine.Both computers have the same level of XP and NET Framework code, and both have Visual Studio 2010 at the same level.I copied my application's project folder onto the second machine, but the second machine's VS 10 can't load the project because it can't find a couple of Interop files (e.g., AxMSComCtl2). All of files are present in the project folder and also in its.bin subfolder. The only observable difference between the two machines is the presence, on the first machine, of some Assemblies stored under my user name there. Copying the Assemblies to the second machine didn't help (I hadn't thought it would).Is my application permanently "imprinted" on my first computer, or is there a simple way of resusitating its clone?

View 10 Replies

Running On Other Machines?

Feb 25, 2012

My name is Jack, I developed a program and I wanted to run it on a clients PC. I used deifferent framework and that didn't work but when I used 3.5 client, it said it had stopped working and I know my client has .net framework 4 and when I did it with 4.0 client it didnt say it had stopped working it just didn't show up but the notification icon showed up for 2 seconds.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved