Explain what would happen if the empty semaphore was not there, and

Concurrent and Parallel Algorithms

Question 1

A doughnut shop has to provide a steady stream of doughnuts for customers. The doughnuts are made by a chef in the kitchen and placed on a conveyor belt. The conveyor belt carries the doughnuts to where the customers are waiting to buy them. This scenario has been simulated using two processes: the chef and the customer, and a shared conveyor belt implemented as a circular array called conveyor, where each space in the array can hold one doughnut. There are two shared general semaphores, empty and full. In this scenario, there is only one chef and one customer. The pseudo-code for the chef is as follows. The chef makes use of an integer variable in for noting the next available space on the conveyor belt. while(true){ doughnut = makeDoughnut(); // Create a doughnut. wait(empty); conveyor[in] = doughnut; // Put the doughnut on the conveyor belt. in = (in + 1) mod n; signal(full); } The pseudo-code for the customer is as follows. The customer makes use of an integer variable out for noting the next location on the conveyor belt that contains a doughnut. while(true){ wait(full); doughnut = conveyor[out]; // Get a doughnut from the conveyor belt. conveyor[out] = null; out = (out + 1) mod n; signal(empty); eat(doughnut); // Eat the doughnut. } This code should be familiar to you as it is an example of the Producer-Consumer problem. (a) Explain, in words, the purposes of the empty and full semaphores.

Explain what would happen if the empty semaphore was not there, and for what kind of scenario this would apply to. You may wish to include simple examples.

 

#Explain #happen #empty #semaphore

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

INSTRUCTION: READ THE ATTACHED CHAPTERS 9 and 10 AND ANSWER

 INSTRUCTION: READ THE ATTACHED CHAPTERS 9 and 10 AND ANSWER THE FOLLOWING QUESTIONS. QUESTIONS ARE TO BE ANSWERED USING CHAPTERS.     Chilcote & Warner:  Chapter 11:  1) According to Braaten what is the biblical foundation of evangelism?  2) What is the abiding evangelistic task?  Chapter 12:  1) What is incarnational

Using the hierarchical order of Bloom’s taxonomy for the cognitive

Using the hierarchical order of Bloom’s taxonomy for the cognitive domain, develop a learning objective related to a selected nursing course for each of the six categories of cognitive skills: knowledge, comprehension, application, analysis, synthesis, and evaluation. Comment on at least two other student’s postings to enhance or improve learning

Emiliano Zapata’s vision for better a Mexico

Emiliano Zapata’s vision for a better Mexico Academic Level : Bachelor Paper details The only source that is to be used for this paper is the book “Emiliano Zapata” by Paul Hart. The paper can only talk about information that is talked about in the book. The question that the

APA style. 2 references less than 5 years. Each question must be

APA style. 2 references less than 5 years. Each question must be answered separately. Now that you have identified the treatment for onychomycosis and labs for baseline and follow up therapy. For Week 6, please address the following: Specify when to refer the patient after therapy and why? Provide a

Mini Literature Review Assignment 1. Your review should be based

Mini Literature Review Assignment 1. Your review should be based on your planned dissertation/research topic 2. Identify at least 20 relevant peer-reviewed journal articles related to this topic which address current issues in this area, focusing on most recent work (2016 onwards); analyse the findings and relevance of this research

Introduction to the Pancreas.

 In this assignment, you will focus on one endocrine gland, its normal function in the body, and how it responds during times of stress. You will also research one disorder related to stress. Choose one of the following endocrine glands from the table below to research. Discuss the hormones produced

Write one full page about internet of things(IoT). find at

Write one full page about internet of things(IoT).  find at least two scholarly articles about IoT.  Prepare a summary of issues related to IoT.  Make sure to include the followings:  1) the impact of IoT on organizations and society 2) government regulations on IoT 3) Be sure to give attribution

Week 3 Assignment – Alignment of HRM and Business Strategies

   Week 3 Assignment – Alignment of HRM and Business Strategies Instructions Select a publicly traded company to research. Evaluate its human resource (HR) and business strategy, HR department job positions, and ways it markets its company regarding human capital. The following are some of the company websites that provide

SYNOPSIS PAPER REQUIREMENTS Content Requirements Your synopsis paper MUST include

SYNOPSIS PAPER REQUIREMENTS Content Requirements Your synopsis paper MUST include the following sections and adequati include each of the following elements and address each question posed below. I. Prologue A. Title and number B. Effective date of implementation C. Preceding standard D. Succeeding standard E. Related standard (s) I. Purpose

Investigate and propose a psychiatric diagnosis based on the case

Investigate and propose a psychiatric diagnosis based on the case study attached. Include an in-depth overview of the disorder within the diagnosis, treatment options for the diagnosis, and a sound rationale that explains why this diagnosis was made. Must present a thorough overview of each disorder within the diagnosis. Assume

Topic: Hypertension A 56-year-old patient with newly diagnosed stage 1

  Topic: Hypertension A 56-year-old patient with newly diagnosed stage 1 hypertension has been referred to you for counseling regarding lifestyle modifications. He is married, with four children — two in high school, two in college. His job as a senior vice-president for a major retail chain requires that he

Business and IT strategy need to align to move the

Business and IT strategy need to align to move the company toward a common goal. Review the Phoenix Fine Electronics’ strategies listed in the attached scenario  Develop a 6- to 8-slide, multimedia-rich presentation for your next client meeting with the management team. In your presentation: Identify the commonalities in the

An oral presentation is one of the most essential skills

 An oral presentation is one of the most essential skills in business communication. Students will develop a three- to four-minute scripted training presentation that focuses on the foundations of business communication. The purpose of this presentation is to provide an audience with an overview of business communication. Visual aids such

double space – Each prompt question should be used as

double space – Each prompt question should be used as a header and answered using at minimum 1 paragraph (5 sentences). DUE 01/21/22 2:00 PM florida time  TOPIC: how has COVID affected schools and low-income people?Prompt Questions: Provide a summary of the material you have chosen to journal about with