473,471 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Some assitance please

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[i].IIC,
AEE[i].InterruptHandler,
AEE[i].WaitingQueue. These elds are designed such that they can
accommodate the
following information:

a. AEE[i].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[i].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[i].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[i].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[i]. WaitingQueue

if their queues are empty, or

Interrupt Level: i
Agent interrupting al level i: j
Process ProcId was freed from the queue AEE[i].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];

Mar 23 '06 #1
1 1760
al**********@yahoo.com schrieb:
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
<http://www.clc-wiki.net/wiki/Introduction_to_comp.lang.c>
especially 2.1 and 2.2

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[i].IIC,
AEE[i].InterruptHandler,
AEE[i].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[i].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[i].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[i].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[i].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[i]. WaitingQueue

if their queues are empty, or

Interrupt Level: i
Agent interrupting al level i: j
Process ProcId was freed from the queue AEE[i].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
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Mar 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Az Tech | last post by:
Hi people, (Sorry for the somewhat long post). I request some of the people on this group who have good experience using object-orientation in the field, to please give some good ideas for...
4
by: Joshua Goodstein | last post by:
Select d.* from ( select agent_addr, max(date_time) from eventlog where priority = 1 group by agent_addr) d, (select agent_addr, max(date_time) from eventlog where priority = 6 group by...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
193
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I...
4
by: Big Tony | last post by:
I'm going crazy trying to do something I think should be simple. Task: Windows service that will post a file to a WebServer automatically. I have created a form on the remote site. I can use IE...
5
by: thatsMaBoy | last post by:
Hi, I am attempting to display a simple Javascript alert when a webpage loads. It works on some pages but not on others. For example, the following code does not produce an alert: Code in...
10
by: sara | last post by:
Hi - I have a report that is 14 columnar sub-reports (Line up: Position- holders in each of our 14 locations - Manager, Assistant Manager, Receiving, Office, etc). I output directly to PDF...
4
by: Michael | last post by:
I have a repeater web control. Currently I want to change some row's color based on defined condition. Is there any code sample demonstrating how to accomplish it? Thanks.
4
by: muddasirmunir | last post by:
Well i want to make a simple website , for which i need some suggestion from you people. I have good idea about front page to make website but the tool not looking great so please suggest me some...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.