Abstract

Shapiro and later Bokhari described a multiprocessing view of the Sieve of Eratosthenes, to test load balancing on shared-memory multiprocessors. Shapiro proposed the following parallel version of the sieve:Eratosthenes starts off with a large number of slaves and instructs the first one to write down the integers 2, 3, 4, … on the ground in a field. A second slave is dispatched with instructions to cross out all multiples of 2. Eratosthenes now moves down the "list" of numbers and dispatches a new slave whenever an uncrossed number is encountered. Thus, the third slave is sent off with instructions to cross out the multiples of 3, the fourth crosses out all multiples of 5, and so on. The uncrossed numbers that remain at the end of this process are the primes.It turns out that Ada (especially Ada95) supports multiprocessing well in the Sieve of Eratosthenes. One may make use of static and dynamic tasks, protected types, communication, and synchronization in a relatively small program, making the sieve an excellent choice for instruction. In a graduate course we offer at William & Mary, Theory of Programming Languages, we give students a multiprocessing assignment. At this stage, students have rarely done parallel programming, except for low-level threads and locks in operating systems courses. So a parallel programming assignment in a high level language adds an extra tool to their arsenals and gives them an idea of an important part of computing today.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.