Thursday, May 7, 2020

Midterm 2 Solutions Essay - 1910 Words

CSCI 4061: Introduction to Operating Systems Fall 2008 Mid-Term Exam II Sample Solution NAME: STUDENT ID: General Instructions: †¢ Write your name and student ID clearly above. †¢ You have 1 hour and 15 minutes to write the exam. No extra time will be given. †¢ There are 4 questions in the exam, all with subparts. The questions combine for a maximum of 100 points. †¢ You must write your answers clearly in the space provided for each question. You might use the backside of each page, as well as any additional sheets as required. If you are using additional space, you must clearly label the question no. that you are answering. Any loose sheets must have your name and student ID written clearly. †¢ The exam is open book/open notes, however,†¦show more content†¦The threads run concurrently, and their order of execution or the interleaving of their instructions is non-deterministic. For each of the following, show how you will modify the code for thread i using semaphores to achieve the desired execution behavior. Note: For each semaphore that you use, show where you will add its wait and/or signal operations, and also specify its initial value. Also Note: You can use pseudocode instead of POSIX/C syntax for your solution. (a) (6 pts) Have each thread execute its code (both foo and bar) in a mutually exclusive manner. The order in which the threads execute does not matter. Ans: This is a classical critical section problem, and we basically need a mutex lock here. Recall that a semaphore with initial value of 1 can be used identically to a mutex lock (since it allows only 1 thread to be in the critical section at a time). So the solution is as follows. Declare a global semaphore: semaphore sem=1; Code for thread i: wait(sem); foo(i); bar(i); signal(sem); (b) (12 pts) Have each thread execute foo in a mutually exclusive manner, but allow upto 5 of them to execute bar concurrently. The order in which the threads execute does not matter. Ans: Here, executing foo is again a classical critical section problem, that can be solved similar to p art (a). However, executing bar allows multiple threads to be in the critical section, and this can be achieved by initializing the semaphoreShow MoreRelatedFin 534 Midterm Exam Part 1 and Part 2 Solution711 Words   |  3 PagesFIN 534 Midterm Exam Part 1 and Part 2 Solution Purchase here https://sellfy.com/p/cZb2/ Product Description FIN 534 Midterm Exam Part 1 and Part 2 Solution FIN 534 Midterm Exam Part 1 and Part 2 Solution FIN 534 Midterm Exam Part 1 and Part 2 Solution FIN 534 Midterm Exam Part 1 and Part 2 Solution FIN 534 Midterm Exam Part 1 and Part 2 Solution FIN 534 Midterm Exam Part 1 and Part 2 Solution FIN 534 Midterm Exam Part 1 and Part 2 Solution Purchase here https://sellfy.com/p/cZb2/ Read MorePlagiarism And Academic Dishonesty Prevention Over Detection And Punishment1614 Words   |  7 Pagesdesigned to target plagiarism/academic dishonesty prevention over detection and punishment. Answering the questions in the problem set would ensure the following things: 1. Students understand the meaning of cheating and plagiarism and how to avoid it. 2. Students are clear about the expectations of the class. 3. Students understand the importance of honesty and personal development. 4. Students are aware of the thin line between collaboration and cheating. 5. Students agree to the academic integrityRead MoreCBU Syllabus 2015 MBAC 51031353 Words   |  6 Pagesï » ¿ Introduction to Accounting: MBAC 5103 Instructor Information Professor: Derrick Hayes Winter 2015 Office: SB217 Tues Thurs: 1:00 – 2:15 pm Email: derrick_hayes@cbu.ca Phone: 563-1312 Course Website (URL): Textbooks and Readings Required Text: Hayes, Derrick, Introduction to Accounting, Primus, McGraw Hill Prerequisites: NONE CourseRead MoreDante1739 Words   |  7 PagesBUSINESS (FALL 2013) SAMPLE TEST MIDTERM EXAMINATION PART 01: MULTIPLE CHOICE QUESTIONS (20 POINTS) 1. (1 pt) Given the following two-person game, which strategy can be eliminated by use of dominance? Y1 Y2 13 0 X2 6 8 X3 12 14 a. X2 c. Y2 b. Y1 e. X1 d. X3 The following payoff table is using for next 6 questions. 2. (1 pt) What decision would an optimist make? a. Alternative 1 c. State of Nature A b. Alternative 2 e. Alternative 3 d. Do Nothing Read MoreIntermediate Managerial Accounting848 Words   |  4 PagesPrerequisites Textbooks (Required) : : BUS 254; 60 credit hours. Cost Management and Control (2008): Custom Publication for Simon Fraser University, McGraw-Hill Ryerson Ltd. ISBN: 978-0-07-007553-5. Bus 322 Casebook (2010), Pearson Learning Solutions, ISBN: 978-0-558-72686-7. Students are expected to read the assigned chapters, class notes, and other assigned materials before coming to class and are expected to discuss the assigned chapters and other related materials during lectures. CourseRead MoreHrm 531 Week 2 Individual Assignment Essays1014 Words   |  5 PagesHRM 531 WEEK 2 INDIVIDUAL ASSIGNMENT To purchase this visit here: http://www.activitymode.com/product/hrm-531-week-2-individual-assignment/ Contact us at: SUPPORT@ACTIVITYMODE.COM HRM 531 WEEK 2 INDIVIDUAL ASSIGNMENT The Employment Law Compliance Plan task in the form of a memo, as described in the message from Traci on the Atwood and Allen Consulting Page. Activity mode aims to provide quality study notes and tutorials to the students of HRM 531 Week 2 Individual Assignment in orderRead MorePsy 100 Week 8 Assignment 2 – Adjustment Case Study – New Updated Work1210 Words   |  5 PagesPSY 100 WEEK 8 ASSIGNMENT 2 – ADJUSTMENT CASE STUDY – NEW UPDATED WORK To purchase this Click here: http://www.activitymode.com/product/psy-100-week-8-assignment-2-adjustment-case-study-new-updated-work/ Contact us at: SUPPORT@ACTIVITYMODE.COM PSY 100 WEEK 8 ASSIGNMENT 2 - ADJUSTMENT CASE STUDY - NEW UPDATED WORK Write a three to six (3-6) page paper in which you: 1. Summarize the two (2) articles you selected from the NPR Website. 2. Describe the major adjustment issues discussed inRead MoreDocx949 Words   |  4 PagesUniversity – HCMC Department of English IE2 READING WRITING 1. Course Statistics : 120 periods (8 credits) Number of instruction weeks : 10 Number of sessions : 30 Number of sessions per week :3 Number of periods per session 2. Pre-requisite Number of periods :4 Students who achieved IE1 course score 50 or scored from 35-60 on the Placement Test are required to take this course. 3. Learning outcome Students who have successfully completed the course are expectedRead MoreMgmt 303 Midterm Exam Solution – All Possible Questions3790 Words   |  16 PagesMGMT 303 Midterm Exam Solution – All Possible Questions http://hwguiders.com/downloads/mgmt-303-midterm-exam-solution-all-possible-questions/ (TCO 1) The _____ approach of going green is a good example of the firm’s social responsibility in addition to demonstrating the highest degree of environmental sensitivity. (Points : 5) 2. (TCO 2) The Ford Motor Company sold an auto parts company because profitability was low. The main environmental dimension considered was (Points : 5) 3. (TCORead MoreSec 402 Wk 5 Midterm Exam3349 Words   |  14 PagesSEC 402 WK 5 MIDTERM EXAM To purchase this visit here: http://www.activitymode.com/product/sec-402-wk-5-midterm-exam/ Contact us at: SUPPORT@ACTIVITYMODE.COM SEC 402 WK 5 MIDTERM EXAM SEC 402 WK 5 Midterm Exam TRUE/FALSE 1. A SYN flood is characterized by the brute force transmission of requests for access to the target network, with the aim of overwhelming its capacity to receive them. 2. Computerized information is so tightly bound within the fabric of our society that its trustworthiness

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.