13.07.2015 Views

Real-Time Programming with GNAT - DIT - Universidad Politécnica ...

Real-Time Programming with GNAT - DIT - Universidad Politécnica ...

Real-Time Programming with GNAT - DIT - Universidad Politécnica ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

This is a first implementation to explore the validity of thisapproach.This paper is targeted on the real-time community.There is a previous paper[9] that describes more deeply themain design goals and implementation choices of JTKfrom a wider point of view.The remainder of this paper is organized as follows.Section 2 is a brief overview of the JTK architecture and itsintegration <strong>with</strong> GNARL. Section 3 explains the mainimplementation details of JTK and how they areimplemented. Section 4 shows some performance results toendorse the feasibility of our approach. Section 5concludes <strong>with</strong> a summary of assessments, comments andpossible future work of this implementation.2. The architecture of JTKOne of the goals of the GNARL development was toprovide an easily portable implementation, by means of alayered design. Each layer provides all of the taskingrelatedservices required by the next higher layer through aprocedural interface. The architecture independentcomponents are clearly separated from the machinedependent parts by means of a well defined interface,called GNULLI 1 [1].Therefore, the replacement of the lower-level taskingimplementation can be carried out in a very straightforwardmanner. There are two ways of implementing a new runtimesystem using this interface:• A GNULLI interface can be built for an already existingthread library. This is the most common approach tobuilding new non real-time <strong>GNAT</strong> ports. This is also theway the RTEMS and VxWorks ports have been built.This approach has clear advantages: most real-timeoperating systems have a POSIX.1c compliant interface,and it is currently well known how to build a GNULLIon top of Pthreads. However, it is neither efficient norclear for two main reasons: First, the Pthread interface isoften built as a library which masks the native threadinterface for the operating system. And second, the<strong>GNAT</strong> run-time library already provides a lot of supportfor tasks, and implementing the high level part ofGNARL on top of Pthreads induces abstractioninversion which causes inefficiency in theimplementation.• The other way to build a real-time GNARL is toimplement a minimum kernel for task support <strong>with</strong> a1. GNU Lower-Level Interface.GNULL interface, which does not make use of anythread mechanism from the underlying operatingsystem. We believe that this approach, although harderto implement, leads to more efficient and predictablerun-time support. Since GNARL provides most of thefunctionality needed for tasking, only the missing, lowerlevel functions, have to be implemented, which resultsin a comparatively small executive.At the lowest level, we have developed a very simplekernel that offers the functionality that a minimal real-timeoperating system should provide. It has also been designedto fit Ada tasks semantics as tightly as possible. In order toprovide an easily predictable environment, this kernel hasbeen designed <strong>with</strong> this objective in mind, from hardwareup. Therefore it operates in a single virtual address space(no paging), it does not have a file system, and the onlydevices supported are a timer and a serial port. Thesesimplifications eliminate unpredictable time delays due topage faults, waiting for completion of I/O, and I/Ocompletion interrupt processing[2].Ada 95 Application Program<strong>Time</strong>r ServiceGNU Ada Run-<strong>Time</strong> LayerGNU Lower-Level LayerJTK LibraryMinimum KernelBare ix86 MachineFigure 1. Structure of the developed <strong>GNAT</strong>tasking system.JTK offers a priority driven scheduler <strong>with</strong> pre-emption.It has a FIFO queue for each priority level in order toprovide for scalability. Tasks run until they are blocked oruntil another task <strong>with</strong> a higher priority becomes ready toexecute.It also provides two basic synchronization methods:mutual exclusion and conditional synchronization. Formutual exclusion two kinds of mutex objects are provided:one operating as a simple binary semaphore, and the otherone using the Immediate Priority Ceiling Protocol, whichoffers the possibility for read and write locking. Forconditional synchronization, JTK implements conditionvariables, which are used by the timer and protectedobjects.The lower level task objects, as well as the scheduler,have been defined as tagged objects, so there is an easy andclean way of extending the implementation <strong>with</strong> newscheduling policies. There are different scheduling

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!