Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Summary : The functions work on multiple queues, and structure each queue as a doubly linked, circular list.

Summary:

This assignment will need routines written that perform standard queuing functions. The functions work on multiple queues, and structure each queue as a doubly linked, circular list.

Data Structure:

A queue consists of a head-pointer and a set of q-elements.

A q-element is a structure, consisting of a previous and next pointer, and a payload consisting of 1 integer. The header is a pointer to the first element of the queue. The head pointer is "null" if the q is empty.

Functions:

The functions that need implementing are:

  1. item = NewItem(); // returns a pointer to a new q-element
  2. InitQueue( &head) // creates a empty queue, pointed to by the variable head.
  3. AddQueue(&head, item) // adds a queue item, pointed to by "item", to the queue pointed
  4. to by head.
  5. item = DelQueue(&head) // deletes an item from head and returns a pointer to the deleted
  6. item
  7. RotateQ(&head) // Moves the header pointer to the next element in the queue. This is
  8. equivalent to AddQ(&head, DeleteQ(&head)), but is simpler to use and more efficient to implement.

Note: All the routines work on pointers. They do not copy q-elements. Also they to not allocate/deallocate space (except NewItem()). You may choose to implement

a FreeItem(item) function.

Summary:

Using the queuing routines (not all will be used) this project will implement the ability to run multiple functions as threads, using non-preemptive scheduling.

Step 1: TCB and context:

The queue items defined in your q.h file has to changed, to be of type TCB_t. The TCB_t and an initialization routine are provided in a header file tcb.h

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question