[Webinar] Streamline your web hosting managementRegister Today


Considering going multi-threaded

Posted on 2008-02-08
Medium Priority
Last Modified: 2013-12-17
So far I have not written a multi-threaded application in C# but really need to do so.  I am wondering how significant this will be when it comes saving data in ArrayLists?  I have heard the term "thread safe lists" but do not know what this means.  Can more than one thread perform operations on a list at the same time?

How about if a thread should crash or lock up.  Can another thread restart that thread?  Does multi threading make a program more stable?


Question by:newbieweb
  • 3
  • 2
LVL 37

Accepted Solution

gregoryyoung earned 1200 total points
ID: 20856117
If you have a locked up or crashed thread ... what it your current state? is it valid?

Generally you don't know the answers to these questions so you would have to terminate your application.

As for thread safe lists .. these can be done quite easily by using the Synchronized wrappers for the list and/or using manual syncrhonization for your accesses ...

Do you have any specific code that you are worried about making multi-threaded?

Author Comment

ID: 20856137
I have a large code base and doubt it would be wise to jump into anything.  But since there is a GUI there's the obvious attraction that the user would never need to wait before interacting with the controls.

How do threads interact with each other?  Maybe I could get one thread for the GUI and another thread for the behind the scenes processes.
LVL 37

Expert Comment

ID: 20856219
threads interact by sending each other signals in some way (maybe blocking each other or doing other things like raising events or even sending a message to the other thread). With a GUI yes it would make it more responsive but you also have to do alot of work with these types of threads as UI controls can only be touched from the main thread.
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.


Assisted Solution

J1H1W1 earned 800 total points
ID: 20856697
The background worker simplifies multi-threading.
LVL 37

Expert Comment

ID: 20856719
simplifies but not when you are talking about a large app with many tasks.

Expert Comment

ID: 20856937
You are correct.  I should not have stated my own opinion, which only invited an equally inept opinion.  From the help files:
The BackgroundWorker class allows you to run an operation on a separate, dedicated thread. Time-consuming operations like downloads and database transactions can cause your user interface (UI) to seem as though it has stopped responding while they are running. When you want a responsive UI and you are faced with long delays associated with such operations, the BackgroundWorker class provides a convenient solution.


Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…

640 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question