Page 1 of 1

## 1 Replies - 1511 Views - Last Post: 25 October 2012 - 02:53 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=297166&amp;s=254b31f1bd2356c4d08358faff470039&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 grendos2

Reputation: 0
• Posts: 21
• Joined: 03-November 09

Posted 25 October 2012 - 02:20 PM

Hi guys i am doing this java tutorial below, i am new to threads so i would welcome any suggestions on how to go about this. Thanks

University Car Park

A big Dublin University has a small car park, holding a maximum of 150 vehicles. The car park has two entrances and exits. Automatic barriers control the entrances. There is a problem that can occur during the rush-hour. Because of the two sets of entrances and exits, cars can enter or leave the car park simultaneously, so it is difficult to monitor the exact number of free spaces left, and it is possible for cars to enter the car park when it is full.
It has been decided that each entrance and exit should be monitored concurrently, and a running total must be displayed showing the number of vehicles in the car park. The following two situations should be simulated:

Suggest a solution to the above so that it gives Lecturers and Students equal precedence and provides a fair solution.
The Secretary of the University decides that Lecturers should have precedence over Students using the University Car Park for 70% of the spaces in the car park, with equal precedence for the remaining 30%. Implement a solution that would reflect this decision.

Is This A Good Question/Topic? 0

## Replies To: Threads with Mutual Exclusion

### #2 g00se

• D.I.C Lover

Reputation: 3640
• Posts: 16,733
• Joined: 20-September 08

## Re: Threads with Mutual Exclusion

Posted 25 October 2012 - 02:53 PM

http://docs.oracle.c...ckingQueue.html could be useful