Hi friends
What is Multithreading C#. why we use multithreading. Explain it with example.
Thank you.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SenthilkumarPosted Apr 7, 2012, 2:26 AM
Multithreading:
C# allows to run more than one thread parallel in an operating system. Which effectively uses the operating system to execute more threads concurrently.
For example, the operating system allows to work multitasking. The word document, notepad, calculator and etc.. can run concurrently. At the same time the multithreading ensures the multiple word document can be opened concurrently. It means it can work as separate thread.
For example,
The thread first and second can execute concurrently. Both threads executes the same method and at the same time it can be locked.
You can go through this MSDN for know about threading, semephore, mutex, synchronization:
http://msdn.microsoft.com/en-us/library/system.threading.aspx
Lot of example program in
http://www.fincher.org/tips/Languages/csharpThreads.shtml
There are some other links about multithreading:
http://www.yoda.arachsys.com/csharp/threads/
http://www.c-sharpcorner.com/UploadFile/mgold/MultithreadingIntro10062005000439AM/MultithreadingIntro.aspx
http://www.codeproject.com/Articles/8694/Multithreading-Concepts-in-C
Satyapriya NayakPosted Apr 6, 2012, 3:20 AM
Please refer Our recommended articles
http://www.c-sharpcorner.com/uploadfile/rohatash/multithreading-in-C-Sharp/default.aspx
Thanks
Kunal NaikPosted Apr 6, 2012, 1:39 AM
Refer below article from this site,
http://www.c-sharpcorner.com/UploadFile/mgold/MultithreadingIntro10062005000439AM/MultithreadingIntro.aspx
MuthuMari MPosted Apr 6, 2012, 1:19 AM
C# supports parallel execution of code through multithreading. A thread is an independent execution path, able to run
simultaneously with other threads.
Pls refer the attached document for more detials.
Thanks.
Jignesh TrivediPosted Apr 6, 2012, 1:04 AM
windows operating system works under the hood.Windows is a preemptive multitasking operating system. The system CPU can do only one thing at a time, but to give the illusion that multiple processes are running simultaneously the operating system splits the CPU time between the various running processes.
Preemptive means that the operating system determines how long task will when executes.
.net there is System.Threading.Thread name space with use of this name space we can achive multithreading.
public class TestClass{
public static void MyTest(){
...
}
}
ThreadStart start = new ThreadStart( TestClass.MyTest ) ;
Thread thread1 = new Thread(start) ;
thread1.Start() ;
hope this help.