You should implement four threads in Java. The execution should be in this order: Thread 2, Thread 3 and finally Thread 1. Thread 0 Used to call other threads You have to use join() method Thread 1 Should be implemented using extends Thread Thread class (extends Thread) You have to use for loop Priority Max Thread 2  Should be implemented using Runnable interface You have to use for loop You have to use sleep() method (one second interval inside the loop) Priority Normal Thread 3 Should be implemented using extends Thread Thread class (extends Thread) You have to use for loop You have to use sleep() method (4 seconds interval before the previous thread) Thread Priority 7 The output should be as following:  1  Thread 2 (University number) 2  Thread 2 (University number) 3  Thread 2 (University number) 4  Thread 2 (University number) 1  Thread 3 (University number, Thread Priority) 2  Thread 3 (University number, Thread Priority) 3  Thread 3 (University number, Thread Priority) 4  Thread 3 (University number, Thread Priority) 1  Thread 1 (University number, Thread Priority) 2  Thread 1 (University number, Thread Priority) 3  Thread 1 (University number, Thread Priority)

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter11: Operating Systems
Section: Chapter Questions
Problem 14VE
icon
Related questions
Question

URGENT URGENT URGENT !!!

You should implement four threads in Java. The execution should be in this order: Thread 2, Thread 3 and finally Thread 1.

Thread 0

    • Used to call other threads
    • You have to use join() method

Thread 1

    • Should be implemented using extends Thread
    • Thread class (extends Thread)
    • You have to use for loop
    • Priority Max

Thread 2 

    • Should be implemented using Runnable interface
    • You have to use for loop
    • You have to use sleep() method (one second interval inside the loop)
    • Priority Normal

Thread 3

Should be implemented using extends Thread

    • Thread class (extends Thread)
    • You have to use for loop
    • You have to use sleep() method (4 seconds interval before the previous thread)
    • Thread Priority 7

The output should be as following:

 1  Thread 2 (University number)

2  Thread 2 (University number)

3  Thread 2 (University number)

4  Thread 2 (University number)

1  Thread 3 (University number, Thread Priority)

2  Thread 3 (University number, Thread Priority)

3  Thread 3 (University number, Thread Priority)

4  Thread 3 (University number, Thread Priority)

1  Thread 1 (University number, Thread Priority)

2  Thread 1 (University number, Thread Priority)

3  Thread 1 (University number, Thread Priority)

Note: You should replace “University number” with your university number. Also, you should replace Thread Priority with that thread priority using the suitable method to get it, for example:

 Failure to do the aforementioned will results on deducting marks.

1 Thread 3 (435101927, 7)

2  Thread 3 (435101927, 7)

3  Thread 3 (435101927, 7)

4  Thread 3 (435101927, 7)

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Avoiding deadlock
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning