Question: I need to create a method in java called do_create(TaskCB task) that is part of public class ThreadCB. The purpose of this method is to

I need to create a method in java called do_create(TaskCB task) that is part of public class ThreadCB. The purpose of this method is to create a thread. First it needs to check if a task is null, if yes then it will call the dispatcher located in do_dispatch() and return null. Then it needs to check if the thread already has the maximum number of threads (MaxThreadsPerTask), use task.getThreadCount(). If yes then call the dispatcher and return null, if no then create the thread. Set up the thread priority and status using setPriority() of thread and getPriority() of task. Set up status SetStatus() to ThreadReady. Associate the task with the thread setTask(task). Associate teh thread with the task addThread(thread). If this fails call dispatcher and return null. Append new thread to readyqueue. Call dispatcher and return thread.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!