Embedded Systems Application Programming Exam, Exams of Computer Programming

The exam paper for the module ee324 embedded systems application programming for the spring examinations 2011. The exam consists of five questions, and students are required to answer three of them. Each question is worth 20 marks. The exam covers topics such as unix-style os commands, regular expressions, shell scripting, software architecture, schedulers, interrupt handling, and power management in embedded systems.

Typology: Exams

2012/2013

Uploaded on 03/25/2013

patnaa
patnaa 🇮🇳

4.6

(10)

87 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EE324 Embedded Systems Application Programming Page 1 of 6
Spring Examinations 2011
Exam Code(s)
3BP1
Exam(s)
Third Year Electronic & Computer Engineering
Module Code(s)
EE324
Module(s)
Embedded Systems Applications Programming
Paper No.
Repeat Paper
External Examiner(s)
Professor G.W. Irwin
Internal Examiner(s)
Prof. G. Ó Laighin
Dr. P. Corcoran
Instructions
:
Answer three of five questions: (20 marks per question )
Duration:
2 hrs
No. of Pages
6
Department(s)
Electrical & Electronic Engineering
Course Co-ordinator(s)
Requirements:
MCQ
Handout
Statistical Tables
Graph Paper
Log Graph Paper
Other Material
pf3
pf4
pf5

Partial preview of the text

Download Embedded Systems Application Programming Exam and more Exams Computer Programming in PDF only on Docsity!

EE324 Embedded Systems Application Programming

Spring Examinations 2011

Exam Code(s) 3BP Exam(s) Third Year Electronic & Computer Engineering

Module Code(s) EE Module(s) Embedded Systems Applications Programming

Paper No. Repeat Paper

External Examiner(s) Professor G.W. Irwin Internal Examiner(s) Prof. G. Ó Laighin Dr. P. Corcoran

Instructions :

Answer three of five questions: (20 marks per question )

Duration: 2 hrs

No. of Pages^6 Department(s) Electrical & Electronic Engineering Course Co-ordinator(s)

Requirements : MCQ Handout Statistical Tables Graph Paper Log Graph Paper Other Material

EE324 Embedded Systems Application Programming

Attempt THREE of five questions – 20 marks per question. ( NB: Candidates should note that marks may be lost if answers are not presented in a neat and orderly manner)

____________________________________________________

Q 1. (a) Explain, in the context of a Unix-style OS, what the following commands do?

(i) tr a-z A-Z < file1 > file2 (ii) cat foo.txt | grep unix | wc -l

(iii) kill -9 %3; fg %2 (iv) head 27 input.txt | tail

(v) grep -ic '^(.)(.)(.)(.).\4\3\2\1$' /usr/dict/words

(vi) (ls -l > recordfile) >& /dev/null

[4 marks]

(b) Describe carefully in words what exactly the following regular expressions match to:

(i) < EE3[0-9]*> (ii) '[])}]'

(iii) ^[0-9]*$ (iv) ^[aeiou]{2,}

(v) ing> (vi) [a-z]{2,10}

[4 marks]

(c) Give two alternative command line instructions to implement each of the following:

(i) chmod u=rwx,g=rx,o-rwx (ii) cd $HOME

(iii) cat readme.txt | grep unix | wc -l (iv) mkdir "A directory name with spaces! "

[5 marks]

(d) What is a shell script? What two things do you need to do to convert a text file with a list of Unix commands into a shell script? [2 marks]

(e) Write a shell script which takes a list of files, f1 , f2 , ..., fN as input and concatenates the files f2 , ..., fN into the first file, f1. In addition the script should write error messages to handle the following situations:

(i) FILE EXISTS error which should occur if f1 already exists.

(ii) NOT REGULAR FILES error which should occur is some of f2 , ..., fN are not regular files.

(iii) MISSING FILES error which should occur if there are less than 2 arguments.

[5 marks]

____________________________________________________

EE324 Embedded Systems Application Programming

Fig 2.2: Steering, Braking & Stability Control Systems for a Modern Auto-mobile [8 marks]

____________________________________________________

Q 3. (a) In the context of an RTOS what is the scheduler? Explain the differences between a co-operative and a pre-emptive scheduler in terms of (i) operation; (ii) implementation; (iii) performance and (iv) reliability and safety. [6 marks]

(b) What is a hybrid scheduler? How does it combine the best aspects of co-operative and pre-emptive schedulers? Explain, using codes sections or diagrams as appropriate, one possible implementation of hybrid scheduler. Explain any potential problems or flaws in your suggested implementation scheme and how these might be overcome. [6 marks]

(c) Explain what is meant by (i) priority inversion and (ii) deadlock? Give an example of how each can occur. Suggest at least two approaches to avoid or mitigate the effects of each. [6 marks]

(d) Comment on the statement: “In a non-pre-emptive RTOS, tasks cannot interrupt one another and therefore there are no data-sharing problems between tasks”. Do you agree or disagree? Explain your reasoning. [2 marks]

___________________________________________________

EE324 Embedded Systems Application Programming

Q 4. (a) Explain the shared-data problem which occurs between the application code and the interrupt handling code of an embedded system. Fig 4(a) shows some C-code which is susceptible to the shared-data problem. Explain how this code is intended to function and explain how intermittent errors can occur. [5 marks]

Fig 4(a): Code to implement the reading of sensor data using interrupts. An alarm is triggered if both sensors do not have the same data reading.

(b) Describe in detail three distinct algorithmic methods which can offer a solution to the shared data problem. Note briefly the advantages/disadvantages of each. Illustrate your discussion with example source code, flow charts, or diagrams, where appropriate. [8 marks]

(c) Explain and differentiate between (i) interrupt latency, (ii) interrupt response, and (iii) interrupt recovery times. How will interrupt nesting affect these timings? Use diagrams and pseudo code examples as appropriate. [4 marks]

(d) Explain briefly what each of the following Unix commands does. Give a typical command-line usage for each to illustrate the essential parameters required for each command:

(i) grep (ii) cat (iii) tail (iv) man (v) ps (vi) tr

[3 marks]

____________________________________________________

Q 5. A micro-controller based embedded system has a power-saving SLEEP mode and an IDLE mode where the processor consumes full power. The system may switch directly from RUNNING to IDLE modes but must enter a DOWN state in order to transition into SLEEP mode. It requires another transition via an UP state to switch back to normal run mode. The system is required to execute a periodic task which generates an interrupt every T mS, the execution time of this task being 100 mS. The duration and energy consumption during each state are given in Fig 5.1 below.

Fig 5.1: CPU states for the embedded system.

static int iTemperatures[2];

void interrupt vReadTemperatures (void) { iTemperatures[0] = !! read in value from HW iTemperatures[1] = !! read in value from HW }

void main (void) { int iTemp0, iTemp1; while (TRUE) { iTemp0 = iTemperatures[0]; iTemp1 = iTemperatures[1]; if (iTemp0 != iTemp1) !! Set off howling alarm; } }