Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 1.25 KB

README.md

File metadata and controls

23 lines (14 loc) · 1.25 KB

Sieve of Erastothenes

An implementation of the Erastothene's Sieve for the calculation of all the primes up to a certain number. This was an academic project for the Operating Systems class at FEUP.

Features

  • Threads for faster computation and simultaneous number sieving
  • Semaphores and Mutexes for synchronization between threads
  • Shared Memory for parallel storing of the final primes

Usage

Compile primes.c using the Makefile and run it accordingly to the following example:

./primes <number>

This will generate a list of all the primes up to the chosen <number>. You can go as high as you want. Expect a few seconds of runtime with numbers higher than 1M.

Known Issues

Although the source file is compilable under Apple's OSX, the actual program won't run correctly on that Operating System. This is due to the fact that the usage of unnamed semaphores was a required feature and OSX doesn't implement those.

Please run this under a Linux VM if you happen to be using OSX. Vagrant will allow you to setup a Ubuntu Server VM with little to no effort.