ADA Thread Compilation - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

ADA Thread Compilation

Description:

http://www.gnat.com/ Support Ada 95. Multi-platform. Based on GNU GCC compiler. Open source ... http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/index.htm ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 12
Provided by: csMon
Category:
Tags: ada | compilation | gnat | thread

less

Transcript and Presenter's Notes

Title: ADA Thread Compilation


1
ADA Thread Compilation
  • Montana State University
  • CS 550 Design Translation of Programming
    Languages
  • Shen Wan

2
Ada Task Syntax
  • task_type_declaration task type
    Defining_Identifier known_discriminant_part
    is task_definitionsingle_task_declaration
    task defining_identifier is
    task_definitiontask_definition
    task_item private task_item end
    task_identifiertask_body task body
    defining_identifier is declarative_part
    begin handled_sequence_of_statements end
    task_identifier
  • Ex http//www.infres.enst.fr/pautet/Ada95/e_c29_
    p1.ada

3
Task Execution
  • Activation -- the elaboration of the declarative
    part of the task body (local variables in the
    body of the task are created and initialized
    during activation). The Activator identifies the
    task which created and activated the task.
  • Normal execution -- the execution of the
    statements visible within the body of the task.
  • Finalization -- the execution of any finalization
    code associated with any objects in its
    declarative part.

4
Ex GNU Ada Compiler
  • http//www.gnat.com/
  • Support Ada 95
  • Multi-platform
  • Based on GNU GCC compiler
  • Open source

5
GNARL Implementation
  • Each task has an associated Ada Task Control
    Block (ATCB).
  • There is a list which contains all the ATCBs (All
    Tasks List).
  • One auxiliary list is used to activate task
    objects in the same Ada scope at the same time.
  • Masters define a task scope which allow the
    run-time to manage task finalization.
  • The Ada task specification is translated by the
    compiler into a limited record
  • The Ada task body is translated into a procedure
    with intermixed calls to the RTS to manage the
    task body creation, activation and finalization.
  • The environment task is responsible for the RTS
    initialization. After this work, it also executes
    the main Ada subprogram.

6
Run-Time Information Associated with Each Task
7
Task Specification
  • The Ada task type is translated by the compiler
    into a limited record with the same
    discriminants.
  • For example, the following task specification
    task type T_Task (Discriminant DType) is
    ...end T_Task ...is translated by the compiler
    into the following code

8
Translated Code
  • T_TaskE aliased Boolean False --body
    elaboratedT_TaskZ Size_Type
    Unspecified_Size Size_Type (Size_Expression)
    --task stack sizetype T_TaskV (Discriminant
    DType) is limited record _Task_Id
    System.Tasking.Task_Id Entry_Family
    array (Bounds) of Void _Priority
    Integer Priority_Expression _Size
    Size_Type Size_Expression _Task_Info
    Task_Info_Type Task_Info_Expression
    _Task_Name Task_Image_Type new
    String'(Task_Name) end record

9
Task Body
  • the compiler translates the task body into a
    procedure.
  • For example, the following task body task body
    T_Task is ltDeclarationsgtbegin
    ltStatementsgtend T_Task...is translated by the
    compiler into the following code

10
Translated Code
  • procedure T_TaskB (_Task access T_TaskV) is
    Discriminant Dtype renames _Task.Discriminant
    procedure _Clean is begin Abort_Defer
    GNARL.Complete_Task Abort_Undefer end
    _Cleanbegin Abort_Undefer ltDeclarationsgt
    Activate_Tasks GNARL.Complete_Activation
    ltStatementsgtat end _Cleanend T_TaskB

11
References
  • A Detailed Description of the GNU Ada Run Time,
    http//www.iuma.ulpgc.es/users/jmiranda/gnat-rts/i
    ndex.htm
Write a Comment
User Comments (0)
About PowerShow.com