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.

A thread disturbs too much another.

Hi,

I am making a multithreaded application. I have a thread for the GUI
and another for a calcul. The thread for the calcul need a lot of CPU
and it is heavy. My problem is when I run the two threads, the thread
for the calcul disturbs a lot the GUI thread. I would like that my GUI
thread run fluently and my thread for the calcul be in background
without disturb the GUI thread. I tried to modify the priorities to
lowest for the calculation thread and highest for the GUI thread but
the problem is still the same. I tried too to put the parameter
isBackground to true for the calculation thread but doesn't work. How
can I manage my threads for that my calculation thread donesn't
disturb my GUI thread.

Thanks

Fabien
Nov 17 '05 #1
3 1251
Fabien,

If you have the calculation on another thread, then it really doesn't
have to do with too many threads. The issue here is that your background
thread is probably taking up too many resources, to the point where the
whole machine is slowed down.

Is there a way you can break up the task into smaller chunks, and
dispose of any resources at the end of processing the chunk? For example,
if you are processing one million records in a table, maybe you can download
one thousand at a time, instead of the total one million (which would put a
strain on the system).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
Hi,

I am making a multithreaded application. I have a thread for the GUI
and another for a calcul. The thread for the calcul need a lot of CPU
and it is heavy. My problem is when I run the two threads, the thread
for the calcul disturbs a lot the GUI thread. I would like that my GUI
thread run fluently and my thread for the calcul be in background
without disturb the GUI thread. I tried to modify the priorities to
lowest for the calculation thread and highest for the GUI thread but
the problem is still the same. I tried too to put the parameter
isBackground to true for the calculation thread but doesn't work. How
can I manage my threads for that my calculation thread donesn't
disturb my GUI thread.

Thanks

Fabien

Nov 17 '05 #2

"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
Hi,

I am making a multithreaded application. I have a thread for the GUI
and another for a calcul. The thread for the calcul need a lot of CPU
and it is heavy. My problem is when I run the two threads, the thread
for the calcul disturbs a lot the GUI thread. I would like that my GUI
thread run fluently and my thread for the calcul be in background
without disturb the GUI thread. I tried to modify the priorities to
lowest for the calculation thread and highest for the GUI thread but
the problem is still the same. I tried too to put the parameter
isBackground to true for the calculation thread but doesn't work. How
can I manage my threads for that my calculation thread donesn't
disturb my GUI thread.

Thanks

Fabien


You realy need a dual CPU machine for this. If you have a long running
thread that only consumes CPU resources, and you only have a single CPU box,
it will always disturb the other threads.
One possible solution is to insert short sleeps while calculating, say a
sleep of 20ms per 100ms, if possible.

Willy.
Nov 17 '05 #3
But I think I can run that on only one machine. Because I tried to do
two separate applications and run the both at the same time and when I
change the priority of the main process to a value greater than the
calculation process all work right. The problem is that here I used to
different applications (two different processes) and I would like
integrate all in only one aplication.

Fabien

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message news:<O$**************@tk2msftngp13.phx.gbl>...
"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
Hi,

I am making a multithreaded application. I have a thread for the GUI
and another for a calcul. The thread for the calcul need a lot of CPU
and it is heavy. My problem is when I run the two threads, the thread
for the calcul disturbs a lot the GUI thread. I would like that my GUI
thread run fluently and my thread for the calcul be in background
without disturb the GUI thread. I tried to modify the priorities to
lowest for the calculation thread and highest for the GUI thread but
the problem is still the same. I tried too to put the parameter
isBackground to true for the calculation thread but doesn't work. How
can I manage my threads for that my calculation thread donesn't
disturb my GUI thread.

Thanks

Fabien


You realy need a dual CPU machine for this. If you have a long running
thread that only consumes CPU resources, and you only have a single CPU box,
it will always disturb the other threads.
One possible solution is to insert short sleeps while calculating, say a
sleep of 20ms per 100ms, if possible.

Willy.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
8
by: Cider123 | last post by:
I ran into a situation where my Window Service had to process 100,000+ files, when I first noticed I needed to tweak various routines. Everything runs fine, but here's what I ran into: In the...
4
by: Alexander | last post by:
Hi, I have written a program that takes on some operations much more time than I expected. As I have seen users clicking wildly on the screen to make something happen, I want to follow the...
4
by: Matthew Groch | last post by:
Hi all, I've got a server that handles a relatively high number of concurrent transactions (on the magnitude of 1000's per second). Client applications establish socket connections with the...
9
by: Víctor | last post by:
Hello, I'm filling a array of System.Diagnostic.Process by using GetProcesses() method. Due to a retard on this method, I do the call using a function and it passing like a delegate to one...
20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone...
2
by: juky | last post by:
Hi all, I have a loop in the thread checking for a particular service status, whenever the status changes to "stopped" a RaiseEvent is generated by thread and another function runs. At the same...
10
by: Paul E Collins | last post by:
I want to fill an ImageList with bitmaps for a ListView from another thread, because it's a time-consuming process. I expect the ListViewItems' images to "load" one by one, as in a Web browser. ...
18
by: =?Utf-8?B?VGhlU2lsdmVySGFtbWVy?= | last post by:
Because C# has no native SSH class, I am using SharpSSH. Sometimes, for reasons I do not know, a Connect call will totally lock up the thread and never return. I am sure it has something to do...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.