The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 337 Weeks Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
public class SortingExample
{
public static final int SIZE = 10;
public static void main(String[] args) {
Integer[] listOne = {7, 12, 19, 3, 18, 4, 2, 6, 15, 11};
Integer[] listTwo = {16, 1, 5, 9, 13, 20, 17, 8, 10, 14};
Object[] finalList = new Object[listOne.length + listTwo.length];
// create two threads:
Thread sortingThreadOne = new Thread(new SortingThread(listOne));
Thread sortingThreadTwo = new Thread(new SortingThread(listTwo));
sortingThreadOne.start();
sortingThreadTwo.start();
try {
sortingThreadOne.join();
sortingThreadTwo.join();
}
catch (InterruptedException ie) { }
// now merge the lists into a single list
Thread mergeThread = new Thread(new MergeThread(listOne, listTwo, finalList));
mergeThread.start();
try {
mergeThread.join();
}
catch (InterruptedException ie) { }
// now print out the list
for (int i = 0; i < finalList.length; i++)
System.out.println(finalList[i]);
}
}
1.Implement the TaskThreadDemo.java thread example.
2.Implement the bounded buffer producer-consumer problem using multithreaded. Modify the producer that the data come from a random number generator.
3.Implement the Socket Communication program using multithreaded so that the server services each client request in a separate thread.
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly