APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY Previous Years Question Paper & Answer

Course : B.Tech

Semester : SEMESTER 6

Subject : Embedded System

Year : 2018

Term : MARCH

Scheme : 2015 Full Time

Course Code : EC 308

Page:55





PDF Text (Beta):

pleted. An interrupt can occur at the end o ത്താ cy റാ: before all the 1
of the 123-511 operation. Therefore, the called ISR or another functio : 3 ட்‌
or can change that variable when it shares with anot 1 Can use the inc
found and the incomplete operations will be ೧೮೧71೮

Example 7.15

⋅⋅⋅⋅⋅⋅⋅ ‏.رط‎ Ass 5 7
multiply it by 4 and find - 4×] rs ن١‎ Assume that the Operation 07, is shift left by 2 bits to

हू mt _ non-atomically in four suboperations, 078 .. 008 ,,
⋅∙∙∙⋅∙∙∙ ∥∙∘⇃∙⋅∙⋅⋅⋅⋅ ⋮∙∙⋅∙⋅⋅⋅∙ ‏]ا‎ d १५०००००५ res ത്തു 7 1 ‏پت‎
‎at an instance that suboperations വയ. ग, and OPC ‏ہم‎ and 0127 096, respectively. Assuming

= ‏مس‎ ١ sare Completed and OPD, remained incomplete.

ಷ್ಟ ۶ at that instance. The / calls some function which uses x if x is the global
. 1! 2 ಎ i i

vari 10011165 > = 0" ‏.......جدر‎ 00. On return from interrupt, as OPD,, is not complete, ठग).

operates on b’j57....... 0൦ NOt ON bj 57 ... bog.

(8) Consider date d and time |. Let ‏ل‎ and t be taken in the program as global variables. Assume that a
thread Update_Time_Date is updating 1 and ‏ل‎ information on system clock tick interrupt 15. The
thread Display_Time_Date in Example 7.2 displays that 1 and ‏ل‎ information.

1. Assume that when Update_Time_Date ran t = 23:59:59 and date ‏ل‎ = 17 July 2007.

2. The Display_Time_Date gets interrupted and assumes that display d and operation t are non-
atomic. Display of d was completed but display of t was incomplete when interrupt ‏ول‎ occurred.

3. After a while, the ( changes to t = 00:00:00 and 6 = 18 July 2007 when the 1
Update_Time_Date runs. The display will show t = 00:00:00 and date d = 17 July 2007 on the
return from interrupt and re-start of blocked thread Display_Time_Date.

The use of shared variables d and t in two threads Update_Time_Date and Display_Time_Date

causes the display error.

7.8.2 Shared Data Problem Solutions

One solution is the use of atomic operation for solving the shared data problem. We need atomic operations
because of the following.
1. An interrupt can occur at the end of an 1
2. A DMA operation can occur at the end ©
taking these atomic-level details into account (
device loads into the memory using the system

any bus-operation).
3. A context switch operation can occur at
itself and a compiler or program may not be t
The following are the steps that, if used together, 8

the shared data problem:

٦ Use modifier volatile with a declaration for 8 ४
warms the compiler that certain variables can 71
gj ८ variable is also shared with a calling function.

nstruction cycle, not at the end of a high-level instruction.

f a machine cycle itself and a compiler or program may not
DMA operation means direct memory access, an 10
address and data buses when CPU is not performing

the end of an instruction for calling a new function, cycle
aking into account these atomic-level details. ॥
Imost eliminate a likely bug in the program because ௦

ariable that returns from the interrupt. This declaration
odify because the ISR does not consider the fact that

Similar Question Papers