
Go to the source code of this file.
| Data Structures | |
| struct | qentry | 
| Defines | |
| #define | NSEM 100 | 
| #define | NQENT | 
| #define | queuehead(q) (((q) >> 16) & 0xFFFF) | 
| #define | queuetail(q) ((q) & 0xFFFF) | 
| #define | isbadqueue(x) (queuehead(x)<0 || (queuehead(x) != (queuetail(x) - 1)) || queuetail(x)>=NQENT) | 
| #define | isempty(q) (queuetab[queuehead(q)].next >= NPROC) | 
| #define | nonempty(q) (queuetab[queuehead(q)].next < NPROC) | 
| #define | firstkey(q) (queuetab[queuetab[queuehead(q)].next].key) | 
| #define | lastkey(q) (queuetab[queuetab[queuetail(q)].prev].key) | 
| #define | firstid(q) (queuetab[queuehead(q)].next) | 
| Typedefs | |
| typedef unsigned long | queue | 
| Functions | |
| short | enqueue (short, queue) | 
| short | insert (short, queue, short) | 
| short | insertd (short, queue, short) | 
| short | remove (short) | 
| short | dequeue (queue) | 
| queue | newqueue (void) | 
| Variables | |
| struct qentry | queuetab [] | 
| queue | readylist | 
The process queue system allows a statically-allocated array to model sorted process queueing before more complex operating system services, like dynamic memory allocation, are up and running.
These process queues assume several important invariants: 1) A fixed number of process queues in the system, known at compile time, 2) A process queue can contain only processes and their associated key values, and thus queue length is at most NPROC, the total number of processes, and 3) A process can be in at most one queue at a time.
Ordering of processes within a given queue depends upon the sorting functions called when maintaining that particular system queue.
Definition in file queue.h.
Definition at line 65 of file queue.h.
Referenced by clockintr(), test_deltaQueue(), test_procQueue(), and wakeup().
| #define isbadqueue | ( | x | ) | (queuehead(x)<0 || (queuehead(x) != (queuetail(x) - 1)) || queuetail(x)>=NQENT) | 
| #define nonempty | ( | q | ) | (queuetab[queuehead(q)].next < NPROC) | 
Definition at line 64 of file queue.h.
Referenced by clockintr(), freesem(), nulluser(), and wakeup().
| #define NQENT | 
| #define queuehead | ( | q | ) | (((q) >> 16) & 0xFFFF) | 
| #define queuetail | ( | q | ) | ((q) & 0xFFFF) | 
| short dequeue | ( | queue | q | ) | 
Remove and return the first process on a list
| q | queue from which process should be removed | 
Definition at line 57 of file queue.c.
References EMPTY, isbadqueue, qentry::next, NPROC, qentry::prev, queuehead, queuetab, and SYSERR.
Referenced by freesem(), resched(), signal(), signaln(), test_deltaQueue(), test_procQueue(), and wakeup().
| short enqueue | ( | short | pid, | |
| queue | q | |||
| ) | 
Insert a process at the tail of a queue
| pid | process ID to enqueue | |
| q | queue to which the process should be added | 
Definition at line 21 of file queue.c.
References isbadpid, isbadqueue, qentry::next, qentry::prev, queuetab, queuetail, and SYSERR.
Referenced by wait().
| short insert | ( | short | pid, | |
| queue | q, | |||
| short | key | |||
| ) | 
Insert a process into a queue in descending key order.
| pid | process id to insert | |
| q | queue in which process should be inserted | |
| key | sorting key (priority, for example) | 
Definition at line 20 of file insert.c.
References isbadpid, isbadqueue, qentry::key, qentry::next, memblock::next, OK, qentry::prev, queuehead, queuetab, queuetail, and SYSERR.
Referenced by ready(), resched(), and test_procQueue().
| short insertd | ( | short | pid, | |
| queue | q, | |||
| short | key | |||
| ) | 
Insert a process in delta queue in ascending order
| pid | process id to insert | |
| q | queue in which process should be inserted | |
| key | delta key | 
Definition at line 20 of file insertd.c.
References isbadpid, isbadqueue, qentry::key, qentry::next, memblock::next, OK, qentry::prev, queuehead, queuetab, queuetail, and SYSERR.
Referenced by sleep(), and test_deltaQueue().
| queue newqueue | ( | void | ) | 
Initialize a new queue in the global process queue table
Definition at line 79 of file queue.c.
References EMPTY, qentry::next, nextqueue, qentry::prev, and queuetab.
Referenced by sysinit().
| short remove | ( | short | pid | ) | 
Remove a process from anywhere in a queue
| pid | process ID to remove | 
Definition at line 43 of file queue.c.
References isbadpid, qentry::next, qentry::prev, queuetab, and SYSERR.
Definition at line 41 of file initialize.c.
Referenced by nulluser(), ready(), resched(), and sysinit().
 1.5.5
 1.5.5