1 Replies - 1511 Views - Last Post: 25 October 2012 - 02:53 PM Rate Topic: -----

#1 grendos2   User is offline

  • New D.I.C Head

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

Threads with Mutual Exclusion

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   User is online

  • D.I.C Lover
  • member icon

Reputation: 3640
  • View blog
  • 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
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1