Create a thread in either a c or a java program and run it


This homework focuses on learning to create threads and use them.
1. Create a thread in either a C or a Java program and run it. The thread should read a keyboard value "x" and exit from the code, or it can also use an "ESC" to exit. That is, the thread should run until the keyboard exit character is entered. Print your source code and output to a single file and generate a file hw4NAME.pdf and submit it in the Blackboard. Put your compile and run options if any in the code as comments. The "NAME" indicates your last name.
2. Using the above thread program, now create 20 threads in your program and run them. No need to wait for the keyboard in each thread, just print "Hello" and its thread id in each thread on a single line and exit. Append your source code and output to the same file as listed above. Please make sure you have an empty page between your two programs. Add enough comments in your program to make it
readable.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a thread in either a c or a java program and run it
Reference No:- TGS01486968

Now Priced at $15 (50% Discount)

Recommended (96%)

Rated (4.8/5)