Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Multithreaded programming and synchronization

03/09/2020 Client: saeed Deadline: 24 Hours

  write code to help synchronize a professor and his/her students during office hours. The professor, of course, wants to take a nap if no students are around to ask questions; if there are students who want to ask questions, they must synchronize with each other and with the professor so that (i) No more than a certain number of students can be in the office at the same time because the office has limited capacity. (ii) Only one person is speaking at a time. (iii) Each student question is answered by the professor. (iv) No student asks another question before the professor is done answering the previous one. (v) Once a student finishes asking all his/her questions, he/she must leave the office to make room for other students waiting outside the professor’s office. You are to provide the following functions:  Professor(). This functions starts a thread that runs a loop calling AnswerStart() and AnswerDone(). See below for the specification of these two functions. AnswerStart() blocks when there are no students around.  Student(int id). This function creates a thread that represents a new student with identifier id that asks the professor one or more questions (the identifier given to your function can be expected to be greater or equal to zero and the first student's id is zero).  First, each student needs to enter the professor’s office by calling EnterOffice(). If the office is already full, the student must wait. After a student enters the office, he/she loops running the code QuestionStart() and QuestionDone() for the number of questions that he/she wants to ask. The number of questions is determined by calculating (student identifier modulo 4 plus 1). That is, each student can ask between 1 and 4 questions, depending on the id. For example, a student with id 2 asks 3 questions, a student with id 11 asks 4 questions and a student with id 4 asks a single question. Once the student has got the answer for all his/her questions, he/she must call LeaveOffice(). As a result, another student waiting on EnterOffice() may be able to proceed.  AnswerStart(). The professor starts to answer a question of a student. Print ...  Professor starts to answer question for student x.  AnswerDone(). The professor is done answering a question of a student. Print ...  Professor is done with answer for student x.  EnterOffice(). It is the student’s turn to enter the professor’s office to ask questions. Print …  Student x enters the office.  LeaveOffice(). The student has no more questions to ask, so he/she leaves the professor’s office. Print …  Student x leaves the office.  QuestionStart(). It is the turn of the student to ask his/her next question. Print ...  Student x asks a question.  Wait to print out the message until it is really that student's turn.  QuestionDone(). The student is satisfied with the answer to his most recent question. Print ...  Student x is satisfied. Since professor considers it rude for a student not to wait for an answer, QuestionDone() should not print anything until the professor has finished answering the question. A student can ask only one question each time. i.e., a student should not expect to ask all his/her questions in a contiguous batch. In other words, once a student gets the answer to one of his/her questions, he/she may have to wait for the next turn if another student starts to ask a question before he/she does. In the above list, x is a placeholder for the student identifier. Your program must accept one command line parameter that represents the total number of students coming to the professor’s office, and a second command line parameter that represents the capacity of the professor’s office (i.e., how many students can be in the office at the same time). For simplicity, you can assume that the Student threads are created at the ascending order of their identifiers. Your program must validate the command line parameters to make sure that they are numeric values. Your program must be able to run properly with any reasonable number of students (e.g., 200) and room capacity (e.g., 8, 20, 50). Your program must show randomness of events. For example, groups of students entering office at various points in the simulation. Your program must reach a completion state and terminate gracefully. A proper message should be output to indicate end of simulation, One acceptable output of your program is (assuming 3 students and a room capacity of 2): 

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Academic Master
Writer Writer Name Offer Chat
Academic Master

ONLINE

Academic Master

I have super grip on essays, case studies, reports and discussion posts. I am working on this forum from last 6 years with full amount of satisfaction of my clients.

$40 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Hypothesis Testing and Confidence Intervals - Intensive distribution exclusive distribution selective distribution franchising - Ashley county arkansas v pfizer inc - Contact woolworths car insurance - Ws c3850 24xu s datasheet - Jack and rochelle chapter summary - The solar opposites/lesson analyzer - Project management a managerial approach 9th edition instructor's resource guide - Ucla physiological science courses - Hrm 300 total rewards plan worksheet - Weka association rules example - Katy perry brighter than the moon - ACC week4 dis - What is the average temperature in the marine biome - Eco 204 week 2 assignment - Amazon prime video case study - Mary kay in india case study - Which statistical technique was used by raymond cattell to derive his 16 basic personality traits? - How to create a cost benefit analysis in excel - Mindless behavior posters at target - Journalism - AP Style - Principles of meat cookery - 28285 n st marys rd libertyville il 60048 - Peaceful warrior quotes socrates - Skinpen by bellus medical for sale - Cujo dog minding darwin - Business - 2 replies - Module 7 basic communication skills review questions answers - Ethical and Moral Proposal - Luther leads the reformation - Cic stage 4 - Dramatic irony in othello - How to find tax and tip - NEED TO RESOLVED CHM1033 LAB AND QUESTIONS - Mars inc marketing strategy - How to write a personal recount - Hp bl460c gen8 quickspecs - Wk#3 Research paper - How davy crockett died - 5-7 garema circuit kingsgrove nsw 2208 - Chiastic structure of mark's gospel - M5D1 Communicating Diverse - Business - Lds quotes on education - Rhb insurance annual report - Intercultural Competence Worksheet - Last days of cafe leila discussion questions - Journal - Research - Beauty and the beast jeanne-marie leprince de beaumont analysis - Self selected sample definition psychology - D7 Diabetes in school - Code of Ethics and Conduct: Poor Judgement - How to prepare an adjusted trial balance - Jet blue airlines company history - Tpg set up voicemail - Organization development and change cummings and worley - The case of the pricing predicament - Research on the impact of moods on tasks that involve considerable cognitive demands suggests that: - Fremont high school norton reader - SHE HELP ME OUT - Walmart strategic plan - Devil rays swim team - Spanish aunt bluff king in muse of comedy - Discussion - Www householdresponse com eastdevon - Cameron hughes costco - Low total protein nursing interventions - What are five recommended steps to make ethical decisions - Geo 2 - Scripts for teenage girl - Air exits a turbine at 200 kpa - Systematic collection and analysis of data - Parking at royal melbourne hospital - How can we bridge the differences that divide us - Presentation on output devices - Dampening paper for printmaking - Film critique - Traditional Chinese - Food chain food web energy pyramid - Order 2058693: Using the scientific method - The hypothetico deductive method seven steps with examples - 2p permit holders excepted meaning - WK 8 SOCW 6443 Assignment: Addressing Ethical Implications in the Treatment of ADHD - What is an episodic soap note - Horney's theory of personality development pdf - Strategic Change Management - One-one Leadership - Various populations served in criminal justice - Midas boots david jones - Paragon machine works dropouts - Mini project terrorism - Amazon case study strategic management - Girl powdering her neck analysis - Discussion 2: Combat Trauma, socw 6411 wk1-2 - Effect of extremely low birth weight babies on the family and community - Jet airways vision and mission - Metaphors for a storm - Social Norms/ Behavior