Interrupt Service Routine Scheduling
Jarvic 2000 has
just recently upgraded the microprocessor on
their artificial heart to a Intel Pentium 4. They have added two new sensors
to their electro-mechanical heart: temperature and low-battery.
Each sensor generates periodic interrupts and requires a fixed
amount of processing time by the CPU.
They have hired you, a world-renowned CSE306 graduate, to analyze
the worst-case interrupt task completion times.
Using the interrupt specifications below,
complete the timing chart and determine the worst-case delay
(completion time) for each of the tasks. It is your responsibility
to ensure the safety of hundreds of future patients!
Assume that the time to switch between interrupts is
negligable.
Assume that requests are buffered. If multiple tasks occur while
the CPU is busy, they will be sequentially processed when the
task is scheduled until either:
(1) the CPU is interrupted with a higher priority interrupt or
(2) until there are no more tasks to process.
Enter 999 to indicate a task that will eventually have
worst-case delay of infinity.
Recall that a similar example problem was discussed in class
during Lecture 15 .
It is helpful to work out the solutions using a
timing worksheet
Specify all numbers in decimal
Task
Pri.
Run Time
Dead- line
Event Freq.
Event Period
CPU Load
BP 1 1 ms 3 ms 10 ms
OX 2 20 ms 50 Hz 20%
PH 3 2 ms 20 ms 40 Hz
VAG 4 1 ms 25 ms 20%
TEMP 5 2 ms 30 ms 50 ms
LoBAT 6 50 ms 25 ms 12%
Task BP: CPU Utilization (%)
(2 pts)
Task BP: Event Frequency (Hz)
(2 pts)
Task PH: Event Period (ms)
(2 pts)
Task VAG: Frequency (Hz)
(2 pts)
Total amount of time the CPU is run by any process during first 20 ms (ms)
(2 pts)
Total CPU Utilization (%)
(2 pts)
Assume that all tasks are preemptive except
TEMP, which is non-preemptive.
Calculate the worst-cast task completion delays
Task BP Worst case delay (ms)
(2 pts)
Task OX: Worst case delay (ms)
(2 pts)
Task PH: Worst case delay (ms)
(2 pts)
Task VAG: Worst case delay (ms)
(2 pts)
Task TEMP: Worst case delay (ms)
(2 pts)
Task LoBAT: Worst case delay (ms)
(2 pts)
Hardware and Software Interrupts
The BIOS (Basic I/O System), vBIOS (Video BIOS), and DOS provide a number
of useful functions available through interrupt vectors. To use these
commands, the opcode INT n is used to trigger the software interrupt.
Using your lab manual, textbook, or lecture notes; determine what values
are necessary to perform the following actions. Specify all
numbers in hex.
Hardware Interrupt vector number called when a character is
received from the serial port on IRQ3
INT (hex)
(2 pts)
Hardware Interrupt vector number called when a SCSI controller
on IRQ13 interrupts the system.
INT (hex)
(2 pts)
BIOS call to check to see if keyboard input is available.
Sets ZeroFlag=1 if nothing is available.
AH = (hex)
( 2 pts )
INT (hex)
(2 pt)
DOS call to read system date (day of week, year, month,
day of the month)
AH = (hex)
( 2 pts )
INT (hex)
(2 pts)
DOS call to open a file (preferred method)
AH = (hex)
( 2 pt )
INT (hex)
(1 pt)
Timer/Speaker Interrupt
The speaker on the PC is controlled by the 8253 timer.
To play a frequency, you must determine the value of a count
then write that number to port 42h on the I/O bus using 2 8-bit
moves. For each of the following frequencies, determine the
first and second byte that you need to write to the timer.
Specify all numbers in hex .
512 Hz
(1 pt)
(1 pt)
2304 Hz
(1 pt)
(1 pt)
1792 Hz
(1 pt)
(1 pt)
Analog Position Sensor
IBM designers used resistive/capacitive time constants to implement
a low-cost joystick interface on the PC.
The position of the joystick is determined by polling the status register
at port 201h of the I/O bus.
Due to manufacturing variations of joystick hardware
and differing clock speeds of PC systems, calibration is necessary
to determine how time is related to position.
Suppose that, during calibration, it is found that
a loop performs 41 IN operations before the Y-Bit changes
and 63 IN operations before the X-Bit changes when the joystick
is in the lower-left position. Likewise, 381 and 427
IN operations (repectively) are performed before
the Y-bits and X-bits change when the stick is in the upper-right position.
For each of the following normalized positions, determine
how many IN cycles would have been performed before the bit changed.
Specify all numbers in decimal .
Upper-Left Position:
Xcount = (2 pts)
Ycount = (2 pts)
Center Position:
Xcount = (2 pts)
Ycount = (2 pts)
Lower-Left quarter position (25%, 25%):
Xcount = (2 pts)
Ycount = (2 pts)
Plotting points in graphics mode
Suppose you wish to plot points in 320x200 graphics mode
using the default palette (i.e, the first 32 pre-defined colors).
Assuming that ES=VidGRSEG=A000h and that you are in graphics mode,
determine DI and AL such that you will plot the following dots
by executing
Specify all numbers in decimal
Blue dot at top row, right-most column of screen
DI = (2 pts)
AL = (1 pt)
Bright-Red dot at the bottom-left corner of the screen
DI = (1 pts)
AL = (1 pt)
Cyan dot at Row=20, Column=10
DI = (1 pts)
AL = (1 pt)
Repeating String Commands
Consider the following code with repeating string commands.
Determine the values of OutArray upon completion of this program.
Specify the answers in units of four bytes (i.e., The answer to
the first question is the value of the first four bytes of OutArray).
Every answer should have exactly four ASCII characters.
InArray db '1234ABCDEFFEDCBA01234567'
OutArray db '000000000000000000000000'
..
mov ax,ds
mov es,ax
cld
mov al, '8'
mov ah, '2'
mov si, offset InArray + 10
mov di, offset OutArray + 0
stosb
movsb
stosb
movsb
mov cx,2
rep stosw
mov cx,2
rep movsw
mov di,offset Inarray
mov al,'4'
mov cx,24
repne scasb
add OutArray[12],cl
mov al,'6'
repne scasb
add OutArray[15],cl
std
mov di,offset OutArray + 19
mov si,offset Inarray + 11
mov cx,4
rep movsb
cld
mov si,offset InArray
mov di,offset InArray + 17
mov cx,10
mov bx,10
repe cmpsb
sub bx,cx
add OutArray[23],bl
OutArray[0..3] =
(2 pts)
OutArray[4..7] =
(2 pts)
OutArray[8..11] =
(2 pts)
OutArray[12..15] =
(2 pts)
OutArray[16..19] =
(2 pts)
OutArray[20..23] =
(2 pts)
Once you have completed this homework assignment, press: