Design an algorithm that prevents deadlock

Assignment Help Basic Computer Science
Reference no: EM132430985

Problem: A single-lane bridge connects North Village and South Village. Farmers in the two villages use this bridge to deliver their produce to the neighbouring town. The bridge can become deadlocked if both a northbound and a southbound farmer get on the bridge at the same time (farmers in these villages are stubborn and are unable to back up).

Required:

Question 1: Using either Java semaphores design an algorithm that prevents deadlock. Implement and test your algorithm by designing two threads, one representing a northbound farmer and the other representing a southbound farmer. Once both are on the bridge, each will sleep for a random period of time to simulate travelling across the bridge. Initially, do not be concerned about starvation (the situation in which northbound farmers prevent southbound farmers from using the bridge, or vice-versa).

Question 2: Modify your implementation in (a) so that it is starvation-free.

Reference no: EM132430985

Questions Cloud

Amount of information to work with : We know that encryption provides confidentiality. Does it provide privacy? (Explain)
Identify atleast two Aspen Institute panel discussion : According to the Pew report on immigration what is the relationship between our aging American workforce and immigration?Should we be concerned about this?
Characteristic of the scan disk scheduling policy : What is the main characteristic of the SCAN disk scheduling policy? Briefly describe its alternatives, C-SCAN and FSCAN and the reasons for introducing them.
What is the time to read one sector : We want to store 300,000 logical records, each having a size of 120 bytes, on a disk with the following size characteristics: sector size is 512 bytes/sector
Design an algorithm that prevents deadlock : Using either Java semaphores design an algorithm that prevents deadlock. Implement and test your algorithm by designing two threads
What differences between descriptive and evaluative research : Include a discussion of where program evaluation fits within these types of research. Then list 4 reasons for program evaluation and explain the importance.
Design a human resources system : Problem: For this Assignment, I am required to consider this scenario: I have been working with a local, medium-size business to design a human resources system
Describe the theory of knowledge called skepticism : Describe the theory of knowledge called skepticism. Consider the skeptic's charge that we can never be confident about the reliability of our normal sources.
Why are grey hat hackers dangerous : Question 1: Why are grey hat hackers dangerous? Question 2: State the seven steps in the information gathering process before an attack.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd