Skip to main content Accessibility help
×
Hostname: page-component-78c5997874-4rdpn Total loading time: 0 Render date: 2024-11-08T15:13:59.581Z Has data issue: false hasContentIssue false

3 - Task basics

Published online by Cambridge University Press:  01 June 2011

John W. McCormick
Affiliation:
University of Northern Iowa
Frank Singhoff
Affiliation:
Université de Bretagne Occidentale
Jérôme Hugues
Affiliation:
Institute for Space and Aeronautics Engineering (ISAE), Toulouse
Get access

Summary

In Chapter 1 we demonstrated the effectiveness of concurrent algorithms. Together, Horace and Mildred can prepare a meal faster than one of them alone. The concurrent algorithm for controlling the process of chutney cooking provides a simpler and more reusable solution than the original sequential algorithm. Now that you have a basic understanding of sequential programming with Ada we are ready to create concurrent Ada programs.

Ada is a concurrent programming language — it provides the constructs needed to support the creation of programs with multiple threads of control. Ada's task is an implementation of Dijkstra's (1968) process. An Ada program is composed of one or more tasks that execute concurrently to solve a problem. In this chapter we examine the Ada task as an independent entity. In the next two chapters, we'll examine the facilities that allow tasks to communicate, synchronize, and share resources.

Defining tasks

As with packages, the definition of a task has two parts: a declaration and a body. We can define a task type from which we can create multiple tasks that execute the same sequence of statements. Alternatively, we can define a singleton task that ensures that only one task executes the sequence of statements in the body. Let's look at a program that illustrates both alternatives.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2011

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Task basics
  • John W. McCormick, University of Northern Iowa, Frank Singhoff, Université de Bretagne Occidentale, Jérôme Hugues
  • Book: Building Parallel, Embedded, and Real-Time Applications with Ada
  • Online publication: 01 June 2011
  • Chapter DOI: https://doi.org/10.1017/CBO9780511973345.005
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Task basics
  • John W. McCormick, University of Northern Iowa, Frank Singhoff, Université de Bretagne Occidentale, Jérôme Hugues
  • Book: Building Parallel, Embedded, and Real-Time Applications with Ada
  • Online publication: 01 June 2011
  • Chapter DOI: https://doi.org/10.1017/CBO9780511973345.005
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Task basics
  • John W. McCormick, University of Northern Iowa, Frank Singhoff, Université de Bretagne Occidentale, Jérôme Hugues
  • Book: Building Parallel, Embedded, and Real-Time Applications with Ada
  • Online publication: 01 June 2011
  • Chapter DOI: https://doi.org/10.1017/CBO9780511973345.005
Available formats
×