The Dining Philosophers Problem

Improved Essays
Operating Systems Homework
Sey_ Gozubuyuk
14501044
December 1, 2015
1 Dining Philosophers Problem
1.1 Problem De_nition
The Dining Philosophers Problem is often used to clarify synchronization prob- lems in concurrent algorithm design. [1]
In the problem there are _ve philosophers. They sit on chairs around a circu- lar table, and they either think or eat spaghetti. On the table there is spaghetti and _ve chopsticks, as shown in the Figure 1. The philosophers think until they are hungry. When a philosopher gets hungry, he tries to take the nearest two chopsticks. If he is able to pick up both of the left and right chopsticks, he eats for sometime. When he _nishes eating he drops the chopsticks, and make them available for other philosophers
…show more content…
This solution avoids deadlocks. However, the concurrency is reduced because of the arbitrator. Philosohers may be prevented from using available chopsticks. 1.2.3 Chandy/Misra solution
K. M. Chandy and J. Misra proposed another solution for The Drinking Phliso- phers Problem, which is a special case of Dining Philosophers Problem [4].
Chopsticks can either be clead or dirty. Initially, all forks are dirty. Every philosopher has an id. The following steps performed.
1. Each chopstick is given to the philosopher who is near to the chopstick, and has a smaller id.
2. When a philosopher wants to get chopstick, he request it from his neighbor.
3. When a chopstick is requested, the holder of the chopstick
(a) keeps the chopstick, if it is clean
(b) cleans and gives the chopstick to the requesting philosopher, if it is dirty. 2 The Banker's Algorithm
2.1 Problem De_nition
The Banker's algorithm aims to avoid deadlocks; and it is used for resource allocation. It also known for avoidance algorithm [5]. This algorithm can also
2
be used in banking system in order to prevent the bank from running out of money. It should guarantee that the bank is always in a safe state.
The Banker Algorithm found by Edsger Dijkstra. In this algorithm,
…show more content…
These are;
_ The amount of each resource that the new process requires [REQUEST]
_ The amount of each resource that each process could request [MAX]
_ The amount of each resource that each process is using [ALLOCATED]
_ The amount of each resource that available in the system [AVAILABLE]
_ The amount of each resource that needed by the system [NEEDED]
Resources can be allocated only when REQUEST _ NEEDED and REQUEST
_ AVAILABLE
If all of the processes can terminate in a _nite time, the state can be referred as safe state. In other words, if there exists a set of requests from processes that the maximum resource requirement of each process can be satis_ed, and the processes can terminate by releasing resources; the state is determined as safe state. If there is no such set, then the state is an unsafe state[5].
The operating system runs the Banker's algorithm every time it receives a request. As a result, it decides whether the state is safe or unsafe. If the state is safe, the operating system allocates resources to the request. Otherwise, the request is denied[5].
There are some disadvantages of the Banker's algorithm, which makes the algorithm impractical. These disadvantages can be listed as

Related Documents

  • Improved Essays

    BankID [11] allows users to log in into different merchants by using the same password and two-factor authentication. With this, it helps people to save their bank account. This is used in a web site (merchant) when it needs to securely identify its users. Overall the user need to enter their SSN (Social security number), a password, and at the end a one-time password.…

    • 640 Words
    • 3 Pages
    Improved Essays
  • Improved Essays

    Nt1330 Unit 3 Assignment 1

    • 1123 Words
    • 5 Pages

    Web server A web server processes requests using HTTP, the most basic network protocol used for information on the World Wide Web. HTML is the most frequent protocol for WWW and it may include images, scripts and style sheets in addition to text content. A user agent (eg. a browser) communicates by requesting a specific set of data using HTTP.…

    • 1123 Words
    • 5 Pages
    Improved Essays
  • Great Essays

    Nt1310 Unit 4 Paper

    • 1050 Words
    • 5 Pages

    The following is a list of the test phases that should be performed after the servers for consolidation have been built, software installed and configured. Some of these tests takes place concurrently and some are conducted post-build of the database consolidation system. 1.4.15.1 Systems Integration Testing I (SIT1) This phase includes integration testing, systems testing, user testing, security testing and Regression Testing. 1.4.15.2 Systems Integration Testing II (SIT2)…

    • 1050 Words
    • 5 Pages
    Great Essays
  • Improved Essays

    Unit 3 - P4, M3, D2

    • 1863 Words
    • 8 Pages

    P4 - explain possible priorities and responses when dealing with two particular incidents or emergencies in a health or social care setting. M3 - discuss health, safety or security concerns arising from a specific incident or emergency in a health or social care setting. D2 - justify responses to a particular incident or emergency in a health or social care setting. Understand priorities and responses in dealing with incidents and emergencies -…

    • 1863 Words
    • 8 Pages
    Improved Essays
  • Improved Essays

    Sindiswe Case Study

    • 535 Words
    • 3 Pages

    As the victim of a crime, Sindiswe has the following rights as stated by Bellion (2010). The right to be treated with fairness and with respect for dignity and privacy, the victim has the right to be helped promptly and in a provisional manner. Measures have been set in place to prevent secondary victimisation. The right to offer information during the statement giving process, the court process as well as at the parole hearing.…

    • 535 Words
    • 3 Pages
    Improved Essays
  • Decent Essays

    According to any situation there are two aspects, whether it is “Utilitarian” or “Deontological” from the two points of view whether from the bank’s view or the clients. As mentioned in the previous ethical situation, the client who proposed to the bank with two different balance sheets, he thought that the bank won’t mind to accept his loan and the balance sheet as they would know that businesses don’t prefer to pay too much taxes. From the Bank point of view this is an unethical situation from the client, from the utilitarian point of view: first what “Utilitarian” means, the happiness and satisfaction of greater number of people, and an action is morally right when it’s consequences leads to an overall happiness. The bank here refused to give the client the loan, as the bank consider this situation as a fraud, and running from paying his obligations which are the taxes, so the bank chose to act in a legal and ethical way to give the Bank its reputation and support the Government.…

    • 342 Words
    • 2 Pages
    Decent Essays
  • Decent Essays

    Australian Unity Board is responsible for Group governance: approval of strategies, operating plans, budgets; setting and monitoring Group risk management framework; control and accountability policies/systems. Committees include: • Audit and Compliance: approves annual internal audit plan; main objective is to oversee the credibility and objectivity of financial reporting and the compliance with obligations; oversees and appraises the quality of audits conducted by both internal/external auditors (e.g. EY financial auditors); determines adequacy of controls and evaluates adherence. • Risk: oversees risk management framework for identifying, assessing, mitigating and monitoring material risks arising from the business activities; promotes…

    • 221 Words
    • 1 Pages
    Decent Essays
  • Improved Essays

    Safety Factors Nvq

    • 257 Words
    • 2 Pages

    To allocate sufficient resources to maintain safe and healthy conditions of work; • To take steps to ensure that all known safety factors are taken into account in the design, construction, operation and maintenance of plants, machinery and equipment; • To ensure that adequate safety instructions are given to all employees; • To provide wherever necessary protective equipment, safety appliances and clothing and to ensure their proper use; • To inform employees about materials, equipment or processes used in their work which are known to be potentially hazardous to health or safety; • To keep all operations and methods of work under regular review for making necessary changes from the point of view of safety in the light of experience and upto…

    • 257 Words
    • 2 Pages
    Improved Essays
  • Superior Essays

    Jane Austen’s Pride and Prejudice and Stanley Kramer’s Guess Who’s Coming to Dinner utilise language conventions to express similarities and differences in the ways they prove that good people have prejudice and that such issues can be overcome. Kramer creates these ideas visually through film techniques whereas Austen relies on active reading. First, prejudice is established through characterisation of protagonists and how it impacts their lives. Subsequently, how even the best people can react negatively when confronted with difference and change, shown through the symbolism of blindness.…

    • 1280 Words
    • 6 Pages
    Superior Essays
  • Improved Essays

    RANBAXY DRUG-ADULTERATION CONTROVERSY The Food, Drug and Cosmetic Act of United States (abbreviated as FDCA) is a set of laws passed by Congress in 1938 giving authority to the Food and Drug Administration (FDA) of the country to oversee the safety of food, drugs, and cosmetics. As per the act: A drug is adulterated if the methods used in or the facilities or controls used for its manufacturing, processing, packing or holding do not conform to or are not operated or administered in conformity with current Good Manufacturing Practice (cGMP) regulations.…

    • 687 Words
    • 3 Pages
    Improved Essays
  • Improved Essays

    While analyzing the Tao-te-Ching, many major themes are apparent. From the inevitability of change to the importance of non-action, the Tao-te-Ching is truly full of life lessons that deserve extensive analysis; however, one of the most prevalent and recurring themes is balance and its importance. Throughout Cultural Perspectives, many authors have addressed this same theme. Siddhartha Gautama Buddha, Plato, and Saint Augustine have all discussed this important topic; however, Aristotle best complements and contrasts Lao Tzu’s Tao-te-Ching in his work Nichmachean Ethics. When comparing and contrasting these two texts, one can see that these two authors had very similar ideas on the concept of balance. When comparing the two texts’ thoughts…

    • 763 Words
    • 4 Pages
    Improved Essays
  • Improved Essays

    The ancient Romans were a social people, who rather than dining alone with their families, would attend decadent dinner parties at their friends houses. These dinner parties were a ritualistic affair that often lasted for hours at a time. They focused on culture and always had entertainment of some sort, from performers to the guests themselves who contributed by singing, dancing, reciting, and even making up short poems on the spot. This traditional Roman method of dining has been adopted and warped by Trimalchio, a wealthy man written about in Petronius’ “Satyricon”. Trimalchio was freed from slavery and grew such a tremendous amount of wealth that even upper-class would attend his parties just to get a free meal, despite his dinner parties…

    • 1166 Words
    • 5 Pages
    Improved Essays
  • Decent Essays

    CARE VALUES IN HEALTH AND SOCIAL CARE L.O - Explore the care values that underpin current practice in health and social care Person centred approach - Safeguarding is an action an individual takes that promotes safe and protects those in danger, this could mean a risk assessment as hazards will need to be reported to prevent it from happening again…

    • 219 Words
    • 1 Pages
    Decent Essays
  • Great Essays

    Freedom Vs Security

    • 1805 Words
    • 8 Pages

    First of all “freedom” and “security” are both vague concepts that are both equally important and therefore there is a trade off between them. They are both interconnected and neglecting one in the pursuit of the other can cause a problem in that society. This essay aims to highlight both the advantages and disadvantages of freedom and security at an individual and societal level. It will also incorporate use of significant examples in different countries relating to these concepts focusing on the Uk and America. Finally it will introduce the concepts of Liberalism and totalitarianism and how they apply to freedom and security.…

    • 1805 Words
    • 8 Pages
    Great Essays
  • Great Essays

    In the classic film, Guess Who’s Coming to Dinner, Stanley Kramer, the director of the movie, takes the 1967 time period into consideration and provides his audience with a story of an interracial relationship that inevitably invites conflict within the family. His film is not only entertaining, but it also provides as meaningful message based on love. Spencer Tracey takes a major role in playing Matt Drayton, and is identified as the father that is unable to stomach the fact that John Prentice, a young black doctor played by Sidney Poitier, is madly in love with his white daughter and is seeking her hand in marriage. John wants nothing more than to make his daughter happy, but if Matt doesn’t give his approval by the end of the night, John…

    • 1259 Words
    • 6 Pages
    Great Essays