Results 1 to 4 of 4

Thread: Threading in c# .net

  1. #1
    Join Date
    Jan 2011
    Posts
    42

    Threading in c# .net

    I am desktop application developer. I am currently working on c#. Nowadays I am working on a live project for one local company. Yesterday I come across one scenario where there is need to run multiple processes simultaneously just like keeping an process to running state but in background and performing other operations on front end. Is there any way to achieve same thing in case of programming in C#.net.

  2. #2
    Join Date
    May 2009
    Posts
    637

    Re: Threading in c# .net

    Yes! I have a solution for keeping number of processes in background in running state. C# supports parallel execution of code through multithreading. When any process starts on a system it is treated as parent thread or primary thread. This primary thread process may run along with no. of child threads during working. A thread is an independent execution path, able to run simultaneously with other threads. A C# client program starts in single thread created automatically by CLR. CLR assigns each thread its own memory stack so that local variables are kept separate. So it is possible to keep number of processes simultaneously by assigning each process to new individual thread.

  3. #3
    Join Date
    Apr 2009
    Posts
    569

    Re: Threading in c# .net

    Windows also follow the concept of threading to provide us the facility of multitasking. For using multitasking in your project you just need to add two namespaces in your solution which provides all the keywords and methods which you required to perform threading in your application. The namespaces that you need to add in your solutions are:-
    1. System
    2. System. Threading

    After inheriting both these namespaces you just need to create an object of thread class and after creating an object pass the method that you want to execute along that thread.

  4. #4
    Join Date
    May 2009
    Posts
    511

    Re: Threading in c# .net

    After starting the thread its "IsAlive" property returns true until the point where the thread ends. A thread ends when the delegate passed to the Thread’s constructor finishes executing. Once ended, a thread cannot start. But yes you can keep it as pending using Thread class sleep property. If more than one thread is working on a common or shared object than you have to use proper locking mechanism to avoid accident between two working threads. You can use conditional statements to check locking.

Similar Threads

  1. What is Hyper threading
    By Ameeryan in forum Overclocking & Computer Modification
    Replies: 2
    Last Post: 06-10-2009, 04:03 PM
  2. What is Threading in C# Programming ?
    By HAKAN in forum Software Development
    Replies: 2
    Last Post: 31-03-2009, 11:18 AM
  3. What is threading in JAVA?
    By Arsenio in forum Software Development
    Replies: 3
    Last Post: 02-03-2009, 08:29 PM
  4. VB.NET threading question
    By AmolP in forum Software Development
    Replies: 3
    Last Post: 14-02-2009, 06:03 PM
  5. Threading Unleashed
    By Cool_Rahul in forum Software Development
    Replies: 0
    Last Post: 19-12-2008, 01:39 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,256,926.78558 seconds with 17 queries