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

Threading: Thread takes dominance, & the rest wait until it's finnished.

DTeCH
23
Hello guys,


I have a problem... I've seen it a few times before, but have never gotten an answer when I asked online.


My problem is, when ever I make a multi-threaded program for downloading files from usenet, ONE thread would take authority over all the rest, even though it was created with the same priority as all the rest, & is an instance of the same class, yet it's not the first thread, nor the last, but somewhere in between.

For visual aid, imagine 10 progress bars, each individually doing their thing... all is well, & working flawlessly, but once in a while, one thread would cruise from 1% to 100% done - while all the rest hang at whatever their percentage was when this rogue thread started at 0%, & does not move until the rogue thread hits 100%, & is getting another bit of work from the download queue.

At this point, all the other threads flow together updating their progress value all at once as expected until the rogue begins downloading again. All other threads does a little work until the rogue starts at 0% again. All others freezes until rogue gets to 100%, & is grabbing a bit of work from the queue again. The time that the other threads gets to run together is about 1 second... while the rogue is getting another bit of work from the queue, but when it begins it's work, nothing else can run until it hits 100%, & is getting more from the queue.


As far as code is concerned, it's the usual multi-instance class that does the exact same thing per instance, except each instance is updating to separate progress bars.

Program is started, & based on user's previous choice, reads the amount the user last chose, & begins creating the threads in a simple loop, & exits when the number is reached.

The threads are now active, & can be seen when each thread shows 0% because the user has not chosen anything to download yet.

Each thread has the same priority, & nothing is special about any of them... they are all the same, & identical in operation, yet one goes haywire sometimes.

I will post a video link soon to show this behavior.

This thread remains rogue until the program is restarted, no matter how many things is downloaded, or how long it runs. Any one of the other threads becomes rogue at program start up, but sometimes, all is well also... with everything running fine as expected.

This is really bugging me nowadays because i cannot see what is causing it. It's a simple thread creation loop, & all is identical... so why does one thread (random thread... any "one" from 1st created, to last created) becomes rogue?

Is it possible that there's a threading bug in the .NET Framework?


ps: I have seen this behavior in other programs as well... not just my own.
Aug 23 '12 #1
0 1244

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

Similar topics

21
by: Jure Sah | last post by:
Hello, I have been promising an object orientated ASM IDE for a while now. Trying to make the best of what is already here, I have made a compiler, that will parse XML code and output ASM files....
4
by: JKop | last post by:
Take the following: int GiveMeInt(void) { return 734; } int main(void) {
11
by: Geagleeye | last post by:
Hi, Im a rookie in vba, and therefor got a problem. i do have folwing records F G --------------- 2 3 2 5 6 7
49
by: Atul Chaturvedi | last post by:
If we use ASP.NET 2.0 Login Control, we are unable to click on Login and Reset Buttons on Safari running on Apple Mac OS X Version 10.3.2 . How can i resolve the problem.
22
by: Sandman | last post by:
So, I have this content management system I've developed myself. The system has a solid community part where members can register and then participate in forums, write weblogs and a ton of other...
10
by: Gotts | last post by:
Hi, I have a script which based on an id passed to the page is retrieving a filename and path from the database of a file and then outputting the file for download. I specifically did it this way...
1
by: seadog | last post by:
Hi, I am having a problem displaying data in a textbox array. What I am trying to do is have 5 number enter 5 textboxes, starting from the first and working there way to the bottom textbox. What...
3
by: Stuart | last post by:
I am in the process of teaching myself socket programming. I am "playing around" with some simple echo server-client programs for m the book TCP/IP Sockets in C. The Server program is: ...
2
by: bnashenas1984 | last post by:
Hi everyone I have a script which lets users upload their own thumbnail. The users photo gets resized to 50 x 50 pixels when the upload is finnished. But the problem is that when the user...
24
by: Martin Lang | last post by:
Hey, I am working on a database that will be used for declaration on products (food and stuff). Following tables are of interest - a table containing different ingredients (IDIngredient,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.