A
albert_reade
Hello I was wondering if someone could please help me understand what I
need to do in order to get this project to work. I just need some hints
or a push in the right direction to get this to work, thanks.
Design the Array of Expected Events, AEE, required by the interrupt
system. Each entry
i, 0 <= i < 6, in this array contains three fields, AEE.IIC,
AEE.InterruptHandler,
AEE.WaitingQueue. These elds are designed such that they can
accommodate the
following information:
a. AEE.IIC is used to identify the interrupt identification code of
the interrupt agents
that belong to the level i of interrupts. For this project the
interrupt identification
codes will be defined by a range of integers. This range of integers is
stored in
the AEE.IIC as an interval (i1; i2) where i1; i2 are positive
integers, i1 < i2. For
example, a potential situation could be: AEE[0].IIC = (0,20),
AEE[1].IIC = (21,23),
AEE[2].IIC = (24,34), AEE[3].IIC = (35,40), AEE[4].IIC = (40,44),
AEE[5].IIC =
(45,59). Assume that an interrupt at the level 0 having the interrupt
identification
code 10 would occur. Since 0 <= 10 <= 20, this agent is valid and would
activate the
Device Interrupt Handler AEE[0].InterruptHandler which in turn would
print:
Interrupt Level: 0
Agent interrupting at level 0: 10
Prime numbers generated: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29
Note that you must choose interrupt identification codes integers in
the ranges from
the range 0-59. However, all identification code ranges must be
disjoint.
b. AEE.InterruptHandler is the address of the "InterruptHandler".
This field will be
implemented as a pointer to a C-function (returning type integer). An
appropriate
declaration of this field might be:
c. AEE.WaitingQueue is a FIFO queue that stores processes waiting
interrupts on
this level to arrive. Since processes that issue system calls generate
exceptions,
that is, they suspend themselves for an event, the AEE[5].WaitingQueue
is null.
However, these processes are identified by their agent number in the
integer interval
specified in AEE[5].IIC. When a process suspends itself by a system
call it is sent
in the queue of processes waiting for some other event to occur. That
is, the events
for which processes suspend themselves are the occurrences of other
interrupts.
In order to simulate the handling of the FIFO queues organized in
AEE[0].WaitingQueue,
AEE[1].WaitingQueue, AEE[2].WaitingQueue, AEE[3].WaitingQueue,
AEE[4].WaitingQueue,
when a system call interrupt occurs the process is sent in the waiting
queue AEE[AgentNumber
% 5].WaitingQueue where % is the modulo-operator in the C language.
This means
that interrupt handler for the system call in addition to the printing
of its number
and prime numbers as specified above will perform an operation
enqueue(ProcId,
AEE[AgentNumber % 5].WaitingQueue). The interrupt handler treating
inter-
rupts that arrive on the interrupt levels i, 0 <= i <= 4, will remove
processes from
their own interrupt waiting queues and will show that by printing:
Interrupt Level: i
Agent interrupting al level i: j
No processes is waiting in the AEE. WaitingQueue
if their queues are empty, or
Interrupt Level: i
Agent interrupting al level i: j
Process ProcId was freed from the queue AEE.WaitingQueue
if the process "ProcId" is the first process waiting in that queue.
this is what I have started with
#include <stdio.h>
#define Size 6
typedef int (* InterruptHandler)();
struct AEEEntry
{
int IIC;
InterruptHander IHA;
struct WaitingQueue *PWQ
}AEE[Size];
need to do in order to get this project to work. I just need some hints
or a push in the right direction to get this to work, thanks.
Design the Array of Expected Events, AEE, required by the interrupt
system. Each entry
i, 0 <= i < 6, in this array contains three fields, AEE.IIC,
AEE.InterruptHandler,
AEE.WaitingQueue. These elds are designed such that they can
accommodate the
following information:
a. AEE.IIC is used to identify the interrupt identification code of
the interrupt agents
that belong to the level i of interrupts. For this project the
interrupt identification
codes will be defined by a range of integers. This range of integers is
stored in
the AEE.IIC as an interval (i1; i2) where i1; i2 are positive
integers, i1 < i2. For
example, a potential situation could be: AEE[0].IIC = (0,20),
AEE[1].IIC = (21,23),
AEE[2].IIC = (24,34), AEE[3].IIC = (35,40), AEE[4].IIC = (40,44),
AEE[5].IIC =
(45,59). Assume that an interrupt at the level 0 having the interrupt
identification
code 10 would occur. Since 0 <= 10 <= 20, this agent is valid and would
activate the
Device Interrupt Handler AEE[0].InterruptHandler which in turn would
print:
Interrupt Level: 0
Agent interrupting at level 0: 10
Prime numbers generated: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29
Note that you must choose interrupt identification codes integers in
the ranges from
the range 0-59. However, all identification code ranges must be
disjoint.
b. AEE.InterruptHandler is the address of the "InterruptHandler".
This field will be
implemented as a pointer to a C-function (returning type integer). An
appropriate
declaration of this field might be:
c. AEE.WaitingQueue is a FIFO queue that stores processes waiting
interrupts on
this level to arrive. Since processes that issue system calls generate
exceptions,
that is, they suspend themselves for an event, the AEE[5].WaitingQueue
is null.
However, these processes are identified by their agent number in the
integer interval
specified in AEE[5].IIC. When a process suspends itself by a system
call it is sent
in the queue of processes waiting for some other event to occur. That
is, the events
for which processes suspend themselves are the occurrences of other
interrupts.
In order to simulate the handling of the FIFO queues organized in
AEE[0].WaitingQueue,
AEE[1].WaitingQueue, AEE[2].WaitingQueue, AEE[3].WaitingQueue,
AEE[4].WaitingQueue,
when a system call interrupt occurs the process is sent in the waiting
queue AEE[AgentNumber
% 5].WaitingQueue where % is the modulo-operator in the C language.
This means
that interrupt handler for the system call in addition to the printing
of its number
and prime numbers as specified above will perform an operation
enqueue(ProcId,
AEE[AgentNumber % 5].WaitingQueue). The interrupt handler treating
inter-
rupts that arrive on the interrupt levels i, 0 <= i <= 4, will remove
processes from
their own interrupt waiting queues and will show that by printing:
Interrupt Level: i
Agent interrupting al level i: j
No processes is waiting in the AEE. WaitingQueue
if their queues are empty, or
Interrupt Level: i
Agent interrupting al level i: j
Process ProcId was freed from the queue AEE.WaitingQueue
if the process "ProcId" is the first process waiting in that queue.
this is what I have started with
#include <stdio.h>
#define Size 6
typedef int (* InterruptHandler)();
struct AEEEntry
{
int IIC;
InterruptHander IHA;
struct WaitingQueue *PWQ
}AEE[Size];