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 57 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
Wow, this really help


zacnyjessica

  • Member
  • Posts: 345
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

People with high total cholesterol have about two times the risk for heart disease as people with ideal levels.

Did you know?

Women are 50% to 75% more likely than men to experience an adverse drug reaction.

Did you know?

Hippocrates noted that blood separates into four differently colored liquids when removed from the body and examined: a pure red liquid mixed with white liquid material with a yellow-colored froth at the top and a black substance that settles underneath; he named these the four humors (for blood, phlegm, yellow bile, and black bile).

Did you know?

After 5 years of being diagnosed with rheumatoid arthritis, one every three patients will no longer be able to work.

Did you know?

The first war in which wide-scale use of anesthetics occurred was the Civil War, and 80% of all wounds were in the extremities.

For a complete list of videos, visit our video library