Professional Documents
Culture Documents
04 Task Performance 1
04 Task Performance 1
Task
Performance
Thread Priority
Objectives:
Software Requirement:
Procedures:
Instructions:
1. Create a program that displays the processes of different threads. The program should only have one (1)
Windows form named frmTrackThread.
2. Create a class named MyThreadClass. Then, declare two (2) static methods named Thread1 and
Thread2.
3. Create a loop that loops two (2) times in Thread1. Suspend the current thread for 0.5 seconds. Add the
following code inside the loop.
Thread thread = Thread.CurrentThread;
Console.WriteLine("Name of Thread: " + thread.Name + " = " + loopCount);
4. In Thread2, create a loop that loops six (6) times and suspends the current thread for 1.5 seconds. Same as in
Step 3, add the following code inside the loop.
5. In the frmTrackThread class, create four (4) threads named threadA, threadB, threadC, and
threadD. The program’s output should be displayed in a console to track the process of each thread.
7. Use the Join() method to stop a calling thread until the thread terminates.
Code: