Question: Shared FIFO The asynchronous communication between real-time application's tasks is programmed by using a FIFO list (First In - First Out). This list is implemented

Shared FIFO The asynchronous communication between real-time application's tasks is programmed by using a FIFO list (First In - First Out). This list is implemented by a data structure composed of an array named Buffer of size Buffer_Size with two indexes Write_Index and Read_Index.

These indexes respectively represent the index of the first free place in the array, and index of the next character to read. In the zone of the array between Read_Index and Wr i te_Index-l, values are stored as shown in Figure 11.10.FIFO Read_Index Write Index Array elements written but not read Figure 11.10.

We suppose that there is always at least one element in the array and that it is never full. This array is managed like a circular buffer. Thus, the access operations Write and Read are programmed by:
Procedure Write{X : in Element) is begin Buffer{Write_Index) := X;
Write_Index .- (Write_Index mod Buffer_Size) + 1;
end Write;

Procedure Read(X ; out Element) is begin X ;= Buffer(Read_Index);

Read_Index ;= (Read_Index mod Buffer_Size) + 1;
end Read;
Determine the state of the array when:
1. two calls to wri te happen at the same time (the statements of the body of the procedure Wri te are executed in an interwoven way);
2. a call to wri te and a call to Read happen at the same time (the statements of the bodies of the procedure Wr i te and Read are executed in an interwoven way).
What would you conclude about this programming of an asynchronous communication between two tasks?

FIFO Read_Index Write Index Array elements written but not read Figure 11.10. FIFO management

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Systems Analysis And Design Questions!