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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started