1. Engineering
  2. Computer Science
  3. part 1 queueh firstid firstkey isempty lastkey nonempty queue structure...

Question: part 1 queueh firstid firstkey isempty lastkey nonempty queue structure...

Question details

Part 1 *queue.h- firstid, firstkey, isempty, lastkey, nonempty Queue structure declarations, constants, and inline functions /* Default # of queue entries: 1 per process plus 2 for ready list plus */ /*2 for sleep list plus 2 per semaphore #ifndef NQENT #define NQENT (NPROC + 4 + NSEM + NSEM) #endif #define EMPTY (-1)/* Null value for qnext or qprev index */ #define MAXKEY 0x7FFFFFFF /* Max key that can be stored in queue */ #define MIN KEY 0x80000000 /* Min key that can be stored in queue */ struct qentry/*One per process plus two per list/ int32 qkey:/Key on which the queue is ordered qid16 qnext;Index of next process or tail / qid16 qprev; * Index of previous process or head extern struct qentry queuetabll: Part 2 /* Inline queue manipulation functions* #define queuehead(q) (q) #define queuetail(q) ((q) + 1) #define firstid(q) (queuetab[queuehead (q)].qnext) #define lastid(q) (queuetab(queuetail(q)].qprev) #define isempty(q) (firstid(q) >-NPROC) #define nonempty(q) (firstid(q) < NPROC) #define firstkey(q) (queuetablfirstid(q)].qkey) #define lastkey(q) (queuetab[ lastid(q)].qkey) * Inline to check queue id assumes interrupts are disabled */ #define isbadqíd(x) (((int32)(x) < 0) I 1 (int32)(x) > NQENT-1)

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution