Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-wpx69 Total loading time: 0 Render date: 2024-09-28T17:24:41.332Z Has data issue: false hasContentIssue false

22 - Tasking Techniques

Published online by Cambridge University Press:  05 July 2014

Get access

Summary

Chapter 20 covered the basic concepts concerning tasking. This chapter provides a number of further examples of tasks and protected objects in order to illustrate how the various facilities work together.

An important topic which was only briefly alluded to earlier is the use of synchronized interfaces which pull together two very important features of programming namely OOP and concurrency.

Some topics covered in this chapter are in fact defined in the Systems Programming or Real-Time Systems annexes and thus might not be available in all implementations. However, they seem worthy of more detail than would otherwise be given in the brief notes on the specialized annexes in Chapter 26.

Dynamic tasks

The first example is an interesting demonstration of the dynamic creation of task objects. The objective is to find and display the first few prime numbers using the Sieve of Eratosthenes. (Eratosthenes was a Greek mathematician in the 3rd century BC and a friend of Archimedes of Eureka fame.) This ancient algorithm works using the observation that if we have a list of the primes below N, then N is also prime if none of these divide exactly into it. So we try the existing primes in turn and as soon as one divides N we discard N and try again with N set to N+1. If we get to the end of the list of primes without dividing N, then N must be prime, so we add it to the list and start again with N+1.

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

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 coreplatform@cambridge.org 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.

  • Tasking Techniques
  • John Barnes
  • Book: Programming in Ada 2012
  • Online publication: 05 July 2014
  • Chapter DOI: https://doi.org/10.1017/CBO9781139696616.030
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.

  • Tasking Techniques
  • John Barnes
  • Book: Programming in Ada 2012
  • Online publication: 05 July 2014
  • Chapter DOI: https://doi.org/10.1017/CBO9781139696616.030
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.

  • Tasking Techniques
  • John Barnes
  • Book: Programming in Ada 2012
  • Online publication: 05 July 2014
  • Chapter DOI: https://doi.org/10.1017/CBO9781139696616.030
Available formats
×