-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer.java
More file actions
35 lines (30 loc) · 1010 Bytes
/
Copy pathServer.java
File metadata and controls
35 lines (30 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Server.java
*
* This creates the buffer and the producer and consumer threads.
*
* @author Greg Gagne, Peter Galvin, Avi Silberschatz
* @version 1.0 - July 15, 1999
* Copyright 2000 by Greg Gagne, Peter Galvin, Avi Silberschatz
* Applied Operating Systems Concepts - John Wiley and Sons, Inc.
*/
public class Server
{
public static void main(String args[]) {
BoundedBuffer server1 = new BoundedBuffer();
BoundedBuffer server2 = new BoundedBuffer();
// now create the producer and consumer threads
Producer John = new Producer(server1);
John.setName("John");
Producer Liz = new Producer(server2);
Liz.setName("Liz");
Consumer Mary = new Consumer(server1);
Mary.setName("Mary");
Consumer Bert = new Consumer(server2);
Bert.setName("Bert");
John.start();
Liz.start();
Mary.start();
Bert.start();
}//main
}//class