(Solved) : Question Please Help Implement Schedimplh Re Ready Implement Core Scheduler Including Fifo Q42771742 . . .

Question: Please helpme implement sched_impl.h ———–

Now you’re ready toimplement the core of the scheduler, including the FIFO and RoundRobin scheduling algorithms. For this purpose, youshould only modify sched_impl.h and sched_impl.c.Please see scheduler.h for the descriptions of what functions youmust implement. You are free to put whatever you want in thethread_info and sched_queue structures. Note that the only way thatthe functions you implement are made available to the main programis through the sched_impl_t structures sched_fifo and sched_rr.See

`dummy_impl.c for a completed exampleof how to fill in a sched_impl_t.

———-sched_impl.h————

#ifndef   __SCHED_IMPL__H__
#define   __SCHED_IMPL__H__

struct thread_info {
   /*…Fill this in…*/
};

struct sched_queue {
   /*…Fill this in…*/
};

#endif /* __SCHED_IMPL__H__ */

————scheduler.h ——————-

#ifndef   __SCHEDULER__H__
#define   __SCHEDULER__H__

struct thread_info; /* To be defined in sched_impl.h */
typedef struct thread_info thread_info_t;

struct sched_queue; /* To be defined in sched_impl.h */
typedef struct sched_queue sched_queue_t;

/* A worker thread must be able to call the followingoperations.
* See scheduler.c:worker_proc() for an example of usage. */
typedef struct worker_thread_ops {
   /* Initialize a thread_info_t */
   void (*init_thread_info)   (thread_info_t *info, sched_queue_t *queue);
   /* Release the resources associated with athread_info_t */
   void (*destroy_thread_info) (thread_info_t*info);
   /* Block until the thread can enter the schedulerqueue. */
   void (*enter_sched_queue)   (thread_info_t*info);
   /* Remove the thread from the scheduler queue.*/
   void (*leave_sched_queue)   (thread_info_t*info);
   /* While on the scheduler queue, block until thread isscheduled. */
   void(*wait_for_cpu)       (thread_info_t *info);
   /* Voluntarily relinquish the CPU when this thread’stimeslice is
   * over (cooperative multithreading). */
   void(*release_cpu)        (thread_info_t *info);
} worker_thread_ops_t;

/* The scheduler thread must be able to call the followingoperations.
* See scheduler.c:sched_proc() for an example of usage. */
typedef struct sched_ops {
   /* Initialize a sched_queue_t */
  void           (*init_sched_queue)    (sched_queue_t *queue, intqueue_size);
   /* Release the resources associated with asched_queue_t */
  void           (*destroy_sched_queue) (sched_queue_t *queue);
   /* Allow a worker thread to execute. */
  void           (*wake_up_worker)      (thread_info_t*info);
   /* Block until the current worker thread relinquishesthe CPU. */
  void           (*wait_for_worker)     (sched_queue_t*queue);
   /* Select the next worker thread to execute.
   * Returns NULL if the scheduler queue is empty.*/
   thread_info_t *(*next_worker)        (sched_queue_t *queue);
   /* Block until at least one worker thread is in thescheduler queue. */
  void           (*wait_for_queue)      (sched_queue_t*queue);
} sched_ops_t;

/* A scheduler implementation consists of the above sets ofoperations. */
typedef struct sched_impl {
   worker_thread_ops_t worker_ops;
  sched_ops_t        sched_ops;
} sched_impl_t;

/* For this MP you will implement two differentschedulers.
* Hint: most of the operations will be the same in both. */
extern sched_impl_t sched_fifo, sched_rr; /* To be defined insched_impl.c */
extern sched_impl_t sched_dummy; /* Defined in dummy_impl.c */

int smp4_main(int argc, const char **argv);

#endif /* __SCHEDULER__H__ */

Expert Answer


Answer to Question: Please help me implement sched_impl.h ———– Now you’re ready to implement the core of the scheduler, inc…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us