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

Imeon 9.12 hybrid inverter - Frankenstein book club discussion questions - I need help writing a paper on Saint Leo University Core Values, how they relate to Marketing... - Police administration 9th edition pdf free - Western digital data lifeguard iso - Ol 125 personal leadership reflection template - Library management system requirements - Different assessment tools in nursing - How to use ti 83 calculator for statistics - How to find homework answers online - Apriori property - Pecha Kucha Storyboard - February 15 national day - Comparative analysis of stratification systems - Essay - Milstead 3 legged stool of lobbying - Extra crispy bp bonnyrigg - Ally from fish in a tree - Iab mobile rising stars - How to get professional assignment proofreading in Canada - The rocking horse winner discussion questions - Aboriginal lesson plans year 3 - Super troopers german techno scene - Alive o songs confirmation - Ardex wpm 3000x price - Brockwood medical practice dorking - Https ktt key com ktt cmd logon - Ass 7 - Bill gates leadership style theory - Default blackvue wifi password - Discussion 5 - How is respecting diversity explained in the eylf - Cert 2 in business units - Student information system rfp - Research Paper - Gcu student library - Billy elliot hsc questions - How are crumple zones designed - First and second order rate laws - How does atar scaling work wace - Selleys oven plus heavy duty gel woolworths - Electrolytic cell lab report - Short discussion Post - Blazeview vsu - P lewis dot structure - Physics data sheet hsc - How to analyze a cafr report - Upper right number on chemical symbol - The true statement about cost behavior is that: - DB 5 - Huis hermon pretoria noord - Coexisting with feudalism on the lowest level of land division was the ___________system. - Determination of calcium carbonate in eggshells calculations - Cobit in information security - Sweet leaf bath co marketing report - Market maneuvering among industry rivals - Federal Reserve and the Great Recession Analysis - Wisc v sample report - Tricare operations manual 6010.56 m - The leadership experience daft pdf - Identifying motherboard components worksheet - Tv antenna tower collapse case study - St peter and st james hospice warehouse - How to draw a resistor - Demographic of super bowl audience - Is c6h12o6 a strong electrolyte - Creation story assignment - Motte and bailey castles - Ben and jerry's minter wonderland 2019 - View of human behavior in quantitative research - Simplifying the Dissertation Writing Journey in the UK - Branches of computer networking - The jewish japanese cookbook and how to raise wolves wiki - 11 was a racehorse 22 was 12 1111 race 22112 - Look say cover write check games - Writing response - Ph titration of a weak acid lab - Unlv restaurant management - One page, MLA Format - Job description assignment - Patient Engagement Activities and Communication Strategies - Smurf village wonders chart - Biology 101 quiz 9 liberty university - What is api 20e test strip used for - Macroeconomics seventh edition olivier blanchard answers - Leadership development Plan - How to calculate evpi from decision tree - Grtep webcom - Criminological Theory - Ob gyn soap note template - Analysis of i wandered lonely as a cloud - 8982 pebble beach cir westminster ca 92683 - Self leveling cement canadian tire - Concrete beam span depth ratio rule of thumb - Public and private families an introduction 7th edition pdf - Four stages of career development - Wireless sensor network communication architecture - To Accept or Reject a Client - Module 2 identifying oral agents used to treat diabetes answers - Two blocks are connected by a light string