Skip to content

ruigomeseu/sieve-of-eratosthenes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

An implementation of the Erastothenes Sieve in C using Threads and Shared Memory

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published