0% found this document useful (0 votes)
170 views6 pages

PES Assignment 3

The document discusses various software architectures: 1) Round Robin architecture checks devices one by one in a loop with no priorities or interrupts. 2) Round Robin with interrupts adds interrupt routines that are serviced before returning to the main loop. 3) Function Queue Scheduling uses a queue of function pointers that are executed in the main loop. 4) A Real-Time OS fully handles scheduling between interrupt routines and task code.

Uploaded by

Zia Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views6 pages

PES Assignment 3

The document discusses various software architectures: 1) Round Robin architecture checks devices one by one in a loop with no priorities or interrupts. 2) Round Robin with interrupts adds interrupt routines that are serviced before returning to the main loop. 3) Function Queue Scheduling uses a queue of function pointers that are executed in the main loop. 4) A Real-Time OS fully handles scheduling between interrupt routines and task code.

Uploaded by

Zia Ahmed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MOHAMMED ZIA AHMED KHAN

MECH-B 1604-17-736-070
PES - ASSIGNMENT 3
7(a) Explain Round-Robin architecture with an example.
A) Features of round-robin architecture:
1. Simplest architecture
2. No interrupts
3. The main loop checks each device one at a time,
4. and service whichever needs to be serviced.
5. The service order depends on the position in the loop.
6. No priorities
7. No shared data
8. No latency issues (other than waiting for other
9. devices to be serviced)

Round Robin Architecture:


void main (void)
{
while (TRUE)
{
if (!! I/O Device A needs service)
!! Service A
if (!! I/O Device B needs service)
!! Service B
if (!! I/O Device C needs service)
!! Service C
!! etc.
}
}

Pros and Cons of Round Robin:


Pros:
• Simple to use.
• No shared data.
• No interrupts.
MOHAMMED ZIA AHMED KHAN
MECH-B 1604-17-736-070
PES - ASSIGNMENT 3
Cons:

• The maximum delay is the maximum time to traverse the loop if all devices need to
be serviced
• Architecture fails if any one of the devices requires a shorter response time
• Most I/O needs fast response time (buttons, serial ports, etc.)
• Lengthy processing adversely affects even soft time deadlines
• Architecture is fragile to added functionality
• Adding one more device to the loop may break everything

Applications:
• Simple devices
• Watches
• Possibly microwave ovens
• Devices where operations are all user-initiated
• and process quickly
MOHAMMED ZIA AHMED KHAN
MECH-B 1604-17-736-070
PES - ASSIGNMENT 3
7(b) Compare all four software architectures with respect priorities, worst
response time for task code, the stability of response, and simplicity.
A)
PRIORITIES WORST CASE STABILITY OF SIMPLICITY
RESPONSE RESPONSE
FOR HIGHEST WHEN CODE
PRIORITY CHANGES
TASK CODE

ROUND ROBIN None ∑Ttask Poor Very Simple

ROUND ROBIN Prioritzed ∑Ttask + Good for Must deal with


WITH interrupt interrupts, shared data
∑Tinterrupt
INTERRUPTS routines, then poor for task (interrupt task)
task code @ some code
priority

RTC & Prioritzed Max(∑Ttask)+ Relatively Must deal with


FUNCTION interrupt routines ∑Tinterrupt good shared data &
QUEUE & then prioritized must write/ get
SCHEDULLING task code scheduled code

REAL TIME O.S Prioritzed ∑Tinterrupt + Very good Most complex (


interrupt much handled by
Tos
routines, then RTOS)
prioritized task
code
MOHAMMED ZIA AHMED KHAN
MECH-B 1604-17-736-070
PES - ASSIGNMENT 3
8) Describe the Function-Queue Scheduling architecture with examples.
A)

Function Queue Scheduling Architecture:


Interrupts add function pointers to a queue main routine reads the queue and
executes calls.

void main (void)


{
while (TRUE)
{
while (!!queue of function pointers is empty)
;
!! Call functions on the queue
}
}
MOHAMMED ZIA AHMED KHAN
MECH-B 1604-17-736-070
PES - ASSIGNMENT 3
Pro: Main routine can use any algorithm to choose what order to execute functions (not
necessarily FIFO) Better response time for highest priority task = length of longest
function code Can improve response time by cutting long functions into several
pieces.
Con: Worse response time for lower priority code (no guarantee it will run!).

9(a) What are the major differences of Real-time operating system with
other software architectures. Mention its advantages and
disadvantages.
A) Differences with other architectures:
• Signaling between interrupt routines and task code is handled by RTOS (no need for
shared variables).
• No main loop deciding what to do next, RTOS decides the scheduling.
• RTOS can suspend on task code subroutine to run.
Pros:
• The worst-case response time for the highest priority function is zero.
• System’s high priority response time relatively stable when extra functionality
added.
• Useful functionality pre-written.
• Generally come with vendor tools.
Cons:
• RTOS has cost
• Added processing time
• Code out of your control, may contain bugs.
MOHAMMED ZIA AHMED KHAN
MECH-B 1604-17-736-070
PES - ASSIGNMENT 3
9(b) What are the various criteria for selecting software architecture?
A) Selecting an Architecture:
• Select the simplest architecture that will meet your response requirements.
• If your response constraints require an RTOS, then buy one and use it because there
are also several debugging tools for it.
• It can create hybrids of the architectures.
• In RTOS or RR, the main task code can poll slow hardware devices that do not need a
fast response (leaving interrupts for faster hardware).

You might also like