CMSC 412 Sample Final
Produce(int dest, int count, char **msgs)
{
int i;
char header[MSG_SIZE];
header[0] = (char) count;
MQ_send(dest, header);
for (i=0; i < count; i++) {
MQ_send(dest, msgs[i], MSG_SIZE);
}
}
Consume(int src, int *count, char **msgs)
{
int i;
char header[MSG_SIZE];
MQ_receive(src, header, MSG_SIZE);
*count = (int) header[0];
for (i=0; i < *count; i++) {
MQ_send(src, msgs[i], MSG_SIZE);
}
}
Process |
Burst Time |
Priority |
P1 |
10 |
1 |
P2 |
2 |
3 |
P3 |
1 |
4 |
P4 |
5 |
2 |
Process |
FCFS |
Priority |
RR |
P1 |
|||
P2 |
|||
P3 |
|||
P4 |