• Top Posts

    What is a Thread? What is Multithreading C# ?

    • Thread is a set of instructions that can be executed, which will enable our program to perform concurrent processing. Concurrent processing helps us do more than one operation at a time. By default, C# has only one thread. But the other threads can be created to execute the code in parallel with the original thread.
    • Thread has a life cycle. It starts whenever a thread class is created and is terminated after the execution. System.Threading is the namespace which needs to be included to create threads and use its members.
    • Threads are created by extending the Thread Class. Start() method is used to begin thread execution.

          /CallThread is the target method//
          ThreadStart methodThread = new ThreadStart(CallThread);
          Thread childThread = new Thread(methodThread);
           childThread.Start();
    • C# can execute more than one task at a time. This is done by handling different processes by different threads. This is called MultiThreading.
    • There are several thread methods that are used to handle the multi-threaded operations:
    • Start, Sleep, Abort, Suspend, Resume and Join.
    • Most of these methods are self-explanatory.

    No comments

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728