Uma Implementação Java =============================================== package LeitoresEscritores; import java.util.LinkedList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; public class Main { public static void main(String[] args) throws InterruptedException { Buffer buffer = new Buffer(); ScheduledExecutorService execEscritor = Executors.newScheduledThreadPool(1); ExecutorService execLeitor = Executors.newFixedThreadPool(4); Escritor[] escritores = new Escritor[120]; for (int i = 0; i < 120; i++) escritores[i] = new Escritor(buffer, i+1); IniciaThreadsEscritores escalonador = new IniciaThreadsEscritores(escritores); execEscritor.scheduleAtFixedRate(escalonador, 0, 10, TimeUnit.MILLISECONDS); LinkedList leitores = new LinkedList(); for (int i = 0; i < 120; i++) leitores.add(new Leitor(buffer)); execLeitor.invokeAll(leitores); // Wait a while for tasks to respond to being cancelled execEscritor.awaitTermination(3, TimeUnit.SECONDS); execLeitor.awaitTermination(3, TimeUnit.SECONDS); } } --------------------------------------------- package LeitoresEscritores; public class Buffer { private int valor; private int contadorDeLeitores; public synchronized void escrever(int i) { valor = i; System.out.println("tempo:" + System.currentTimeMillis() + " - escrever: " + valor); contadorDeLeitores = 0; notifyAll(); } public synchronized int ler() { while (valor == 0 || contadorDeLeitores >= 4) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } contadorDeLeitores++; System.out.println("tempo:" + System.currentTimeMillis() + " - ler: " + valor); return valor; } } ---------------------------------------------- package LeitoresEscritores; public class IniciaThreadsEscritores implements Runnable { private Escritor[] escritores; private int i; public IniciaThreadsEscritores(Escritor[] escritores) { this.escritores = escritores; i = 0; } @Override public void run() { if (i < escritores.length) { escritores[i].start(); i++; } } } --------------------------------------------- package LeitoresEscritores; public class Escritor extends Thread{ private Buffer buffer; private int valorAEscrever; public Escritor(Buffer b, int val) { this.buffer = b; this.valorAEscrever = val; } @Override public void run() { buffer.escrever(valorAEscrever); } }