Question
Q 5 Why are the three variables in scheduler.h declared 'extern'? What would happen if they were not declared 'extern'? What would happen if they
Q 5 Why are the three variables in scheduler.h declared 'extern'? What would happen if they were not declared 'extern'? What would happen if they were not declared without the 'extern' in any file?
Q 6 Describe the behavior of exit_error() function in scheduler.c. Why does exit_error() not use errno?
Q 7 Does it matter whether the call to sched_ops->wait_for_queue(queue) in sched_proc() actually does anything? How would it affect correctness if it just returned right away? How about performance?
Q 8 Explain how worker_proc() is able to call the appropriate implementation of wait_for_cpu() corresponding to the scheduling policy selected by the user on the command line. Start from main() and briefly explain each step along the way.
ndef __SCHED_IMPL__H__
#define __SCHED_IMPL__H__
struct thread_info {
/*...Fill this in...*/
};
struct sched_queue {
/*...Fill this in...*/
};
#endif /* __SCHED_IMPL__H__ */
#include "scheduler.h"
#include "sched_impl.h"
/* Fill in your scheduler implementation code below: */
static void init_thread_info(thread_info_t *info, sched_queue_t *queue)
{
/*...Code goes here...*/
}
static void destroy_thread_info(thread_info_t *info)
{
/*...Code goes here...*/
}
/*...More functions go here...*/
static void init_sched_queue(sched_queue_t *queue, int queue_size)
{
/*...Code goes here...*/
}
static void destroy_sched_queue(sched_queue_t *queue)
{
/*...Code goes here...*/
}
/*...More functions go here...*/
/* You need to statically initialize these structures: */
sched_impl_t sched_fifo = {
{ init_thread_info, destroy_thread_info /*, ...etc... */ },
{ init_sched_queue, destroy_sched_queue /*, ...etc... */ } },
sched_rr = {
{ init_thread_info, destroy_thread_info /*, ...etc... */ },
{ init_sched_queue, destroy_sched_queue /*, ...etc... */ } };
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