Some assitance please

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];
 
M

Michael Mair

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.

Your request looks like a homework question; have a look at
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:


Translated to C, this means you want AEE to be an
"array 6 of sometype" where sometype is a structure with exactly
three members, IIC, InterruptHandler, and WaitingQueue.
You _can_ do all of this with one declaration,
struct {
....
} AEE[6];
but it usually is a better idea to procede systematically.

#define AEE_SIZE 6
typedef struct {
....
} TExpectedEvent;

TExpectedEvent AEE[AEE_SIZE];

As soon as we know more about the members, we can fill the structure.
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.


Okay, so we need to represent unsigned integers in the range from 0
through 59. Nothing is said about how the interval is to be represented,
so we have some leeway there.
As we are at it with the structures, let us use one
typedef struct {
TIicBound Lower;
TIicBound Upper;
} TIicInterval;
We are still free to choose what type we do want to use.
For the time being, let us stick with an unsigned type, say
unsigned short or unsigned char.
typedef unsigned short TIicBound;

For extra brownie points, give the user access macros -- if
the user sticks to them, you can change the member names or
even the type of TIicInterval (e.g. to an array 2 of TIicBound)

#define GET_IIC_LOWER(iic) ((iic).Lower)
#define SET_IIC_LOWER(iic, l) ....
and so on.

This gives us the struct member IIC as
TIicInterval IIC;
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:


Unfortunately, you omitted this information.
Note that "pointer to a function returning int" is not a really
sufficient type description. Without the list of parameter types
for such a function, you effectively deny yourself the benefits
of type checking.
Without clarification, the above description is useless.
Note: Declaring a function pointer type for functions returning
double and receiving no arguments, looks like this:
typedef double (*TFcnPtr)(void);
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)();


See my comments above.
This can be nasty if you have functions with prototypes in scope.
struct AEEEntry
{
int IIC;
InterruptHander IHA;

Please post actual code; this won't compile.
struct WaitingQueue *PWQ
}AEE[Size];

Well, I think I gave you enough help to get you started.


Cheers
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top