This topic contains a solution. Click here to go to the answer

Author Question: Suppose there are three Runnable tasks, task1, task2, task3. How do you run them in a thread pool ... (Read 65 times)

kodithompson

  • Hero Member
  • *****
  • Posts: 566
Suppose there are three Runnable tasks, task1, task2, task3. How do you run them in a thread pool with 2 fixed threads?
◦ ExecutorService executor = Executors.newFixedThreadPool(1); executor.execute(task1); executor.execute(task2); executor.execute(task3);
◦ ExecutorService executor = Executors.newFixedThreadPool(2); executor.execute(task1); executor.execute(task2); executor.execute(task3);
◦ ExecutorService executor = Executors.newFixedThreadPool(3); executor.execute(task1); executor.execute(task2); executor.execute(task3);
◦ new Thread(task1).start(); new Thread(task2).start(); new Thread(task3).start();


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by kodithompson on May 6, 2020

Jbrasil

  • Sr. Member
  • ****
  • Posts: 337
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 50% of students answer this correctly




kodithompson

  • Member
  • Posts: 566
Reply 2 on: May 6, 2020
Great answer, keep it coming :)


scikid

  • Member
  • Posts: 300
Reply 3 on: Yesterday
Excellent

 

Did you know?

To prove that stomach ulcers were caused by bacteria and not by stress, a researcher consumed an entire laboratory beaker full of bacterial culture. After this, he did indeed develop stomach ulcers, and won the Nobel Prize for his discovery.

Did you know?

The average adult has about 21 square feet of skin.

Did you know?

On average, the stomach produces 2 L of hydrochloric acid per day.

Did you know?

The cure for trichomoniasis is easy as long as the patient does not drink alcoholic beverages for 24 hours. Just a single dose of medication is needed to rid the body of the disease. However, without proper precautions, an individual may contract the disease repeatedly. In fact, most people develop trichomoniasis again within three months of their last treatment.

Did you know?

The familiar sounds of your heart are made by the heart's valves as they open and close.

For a complete list of videos, visit our video library