• Home
  • Textbooks
  • Real-Time Systems and Programming Languages: Ada, Real-Time Java and C/Real-Time POSIX
  • Resource control

Real-Time Systems and Programming Languages: Ada, Real-Time Java and C/Real-Time POSIX

Alan Burns, Andy Wellings

Chapter 8

Resource control - all with Video Answers

Educators


Chapter Questions

Problem 1

The following resource controller attempts to associate priorities with request:
type Level is (Urgent, Medium, Low);
task Controller is
entry Request (Level) (D:Data);
end Controlier;
task body Controller is
...
begin
loop
...
select
accept Request (Urgent) (D:Data) do
...
end;
or
when Request (Urgent) 'Count $=0 \Rightarrow$
accept Request (Medium) (D:Data) do
...
end;
or
when Request (Urgent) 'Count $=0$ and
Request (Medium) 'Count $=0 \Rightarrow$
accept Request (Low) (D:Data) do
...
end;
end select
...
end loop;
end controller;
Explain this solution and indicate under what conditions it will fail. Why would it not be advisable to extend the above solution to cope with a numeric priority which falls in the range 0 to 1000 ? Sketch an alternative solution which will cope with larger priority ranges. You may assume that the calling tasks issue simple entry calls and are not aborted.

Check back soon!
01:20

Problem 2

Show how the resource manager given in Section 8.3.1 can be programmed in Java (which does not have a requeue facility).

Adam Conner
Adam Conner
Numerade Educator

Problem 3

Show how the Ada resource manager given in Section 8.3.4 can be programmed using protected objects.

Check back soon!

Problem 4

Show how the Ada resource manager given in Section 8.4 can be updated to allow high-priority clients to be given preference over low-priority clients.

Check back soon!

Problem 5

Show how C/Real-Time POSIX mutexes and condition variables can be used to implement a resource controller where several identical resources can be allocated and freed. Clients can request and free one or more resources using the following interface:
typedef struct \{
... /* fill in */
\} resource;
void allocate (int size, resource ${ }^* \mathrm{R}$ );
void deallocate (int size, resource ${ }^* \mathrm{R}$ );
void initialize (resource ${ }^* \mathrm{R}$ );

Check back soon!

Problem 6

Show how the network router example given in Section 8.4.2 can be programmed in Java.

Check back soon!