Commit 9a158211 authored by Gabriele Civitarese's avatar Gabriele Civitarese

all the code under src folder

parent 3616ae49
package join;
import java.util.ArrayList;
import java.util.Random;
......@@ -22,6 +24,7 @@ public class Main {
for (Thread t : threads) {
t.join();
}
System.out.println("...All thread finished!");
}
......
package join;
import java.util.Random;
public class MyThread extends Thread {
......
package producerConsumer;
public class Consumer implements Runnable {
private final Queue queue;
......
package producerConsumer;
public class Main {
public static void main(String[] args) {
Queue q = new Queue();
......
package producerConsumer;
public class Producer implements Runnable {
private final String id;
......
package producerConsumer;
import java.util.ArrayList;
public class Queue {
......
package producerConsumerUnsynced;
public class Consumer implements Runnable {
private final Queue queue;
......
package producerConsumerUnsynced;
public class Main {
public static void main(String[] args) {
Queue q = new Queue();
......
package producerConsumerUnsynced;
public class Producer implements Runnable {
private final String id;
......
package producerConsumerUnsynced;
import java.util.ArrayList;
//Esempio di coda condivisa che non usa wait e notify
......
package semaphore;
import java.util.ArrayList;
import java.util.Random;
//Utilizzo di un semaforo "fatto a "
public class Main {
public static void main(String arg[]) throws Exception {
Random r = new Random();
......
package semaphore;
import java.util.Random;
public class MyThread extends Thread {
......
//Classe che implementa tramite wait e notify un Semaforo.
package semaphore;//Classe che implementa tramite wait e notify un Semaforo.
//Se non vi ricordate cosa sia un semaforo, google is your best friend.
public class Semaphore extends Thread {
public class Semaphore {
private int maxNumber; //numero massimo di thread
private int threadsIn; //conteggio dei thread nell'area critica
......
package semaphoreAPI;
import java.util.Random;
import java.util.Vector;
import java.util.concurrent.Semaphore;
......
package semaphoreAPI;
import java.util.Random;
import java.util.concurrent.Semaphore;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment