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

1. Our “new normal” in the coronavirus crisis involves new

1.  Our “new normal” in the coronavirus crisis involves new ways of interacting with one another.  What are some of the new norms that have emerged?  How are we learning those new standards for behavior?  In thinking about this, be sure to concentrate on the learning process. Who has created

Let φ be a 3cnf formula. A non-identical assignment, or

  Let φ be a 3cnf formula. A non-identical assignment, or nid-assignment, to the variables of φ is an assignment where each clause of φ contains two literals with different truth values, i.e., there cannot be a clause with the 3 true literals. Thus, a nid-assignment satisfies φ without assigning

ASSIGNMENT 1 This assignment consists of writing the core elements

ASSIGNMENT 1  This assignment consists of writing the core elements for a research project that you already started in the previous sessions.  You must use the “Dissertation Proposal Form” template, placing your writings in section  II. Research Question or Hypothesis.  Save your document with the filename: FINAL_xxxxxxx (where xxxxxxx is

Human Resource Management: Recruitment and Selection: Onboarding

HRM 4111 Assignment #6 – Creating an Onboarding Program (30%) This assignment relates to the following Course Learning Requirements: CLR #1 – Link recruitment and selection theories and best practices within an organization to a recruitment and selection plan in both individual and team settings. CLR #2 – Build employee

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

Using the example from the systems analysis example video in

Using the example from the systems analysis example video in panopto you will create a brief systems analysis report based on the daycare snack example. Briefly post responses to the following Systems Analysis steps, use tables and figures when appropriate. When you are done be sure to comment on two

1. Select the company and make a recommendation on a

  1. Select the company and make a recommendation on a new product, service, or facility location appropriate for the company; 2. Explain why you selected the company 3. Include at least 2 options for the new product, service, or facility location you pursue; 4. You will invariably need to

Writing Assignment 1 Parameters and Standards

Compose a college level essay in which you explore two religious holidays, festivals, or celebrations as expressed in at least two different major world religions studied in the first half of this course: a specific Indigenous Tradition, Hinduism, Jainism, Buddhism, Daoism, Confucianism, or Shinto. Be sure to pay attention to

GLOBAL CAPITAL FLOWS OF ITALY Introduction Types of Capital Flows

GLOBAL CAPITAL FLOWS OF ITALY Introduction Types of Capital Flows Foreign Direct Investment Equity Portfolio Investment Bond Finance Commercial Banking Net versus Gross Flows Determinants of Capital Flows Capital Account Liberalization Capital Controls Assignment Questions: There are benefits that emerge from the general liberalization of global capital flows. Explain the

Reflect on the video , “America’s greatest speeches ,” Write

  Reflect on the video , “America’s greatest speeches ,” Write a brief Political Science summary , be sure to include the following questions: (123) Greatest Recorded Speeches in American History (1933-2008)    Why political scientists argue that public speaking, speeches could be powerful to influence society as a whole?

The existence of financial statements is one of the primary

The existence of financial statements is one of the primary reasons accountants do what they do. Before financial statements can be prepared, certain adjustments to account balances must be made. Knowing why adjustments are made allows you to consider what adjustments must be made. It is the end of the

Nature vs. Nurture and Continuity vs. Discontinuity: The implications of

  Nature vs. Nurture and Continuity vs. Discontinuity: The implications of Biological and Environmental Influences on Child Development and Learning   How much of an impact can be made in classroom How much of an impact do environmental risk factors have on impeding positive developmental outcomes How might Continuity of Care

Chapters 11 & 12 1-2 pages Discuss the advantages and

Chapters 11 & 12 1-2 pages  Discuss the advantages and disadvantages of secondary data and give examples of each. In New York City, police officers assigned to a specialized gang squad pay special attention to graffiti, or tagging.  In doing so, they conduct a content analysis to study actions, threats,

Makerere University Statement of Purpose Paper Nursing Assignment Help

Task summary: Write a Statement of Purpose Full order description: Dear Freelancer,  please write a task’ . MAIN DETAILS: * *IMPORTANT* * – Your essay will be a critical piece of the review of the application file. It is imperative that your essay clearly align with the chosen specialty track.

The goal of this project is to explore the topics

The goal of this project is to explore the topics of covariance and correlation. The project requires you to work in Excel with the provided spreadsheet. Be sure to fill in the yellow boxes in the Excel file for full credit and show all work by referencing cells where necessary

It’s 3 A.M., and Sally is Face-Timing you. Fortunately, you

  It’s 3 A.M., and Sally is Face-Timing you. Fortunately, you were up slugging away at your coursework and tying up some loose ends for the project. After receiving the Marketing Study for the property in Boca Raton (PDF) Download Marketing Study for the property in Boca Raton (PDF), Sally asked

Overview In chapters 1 and 2 you have learned about

  Overview In chapters 1 and 2 you have learned about pseudoscience, folk psychology, skepticism, and the scientific method. In the age of social media, being skeptical of scientific claims and being able to evaluate their credibility are important skills. Before completing this discussion, please prepare by reading the two