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 part (a). However, executing bar allows multiple threads to be in the critical section, and this can be achieved by initializing the semaphore
- Complete all of the details required on the front page of the examination booklet. - Make sure that you note the SIX(6) questions attempted on the front of your examination booklet - If Seven questions are attempted, the first SIX(6) will be marked. - You may use a non-programmable calculator - Graph paper will be provided. - Answers are to be written in ink. Pencils are permitted for graphing purposes. - The
Three examinations will be administered. The exams will consist of multiple choice questions and problems. Problems will be similar to those covered in class or those given as homework assignments.
Remember that your exam must be typed in a Word document. Do not save your work as Word 2007. The exam can either be submitted as an attachment through WebCT or a hardcopy can be submitted to me in my office before 5:00 pm on November 20. Completed exams will be accepted at
and types of questions) will be presented at the start of the class prior to the exam. The
1. When a social scientists say that the concept of race is a "social construct", they mean that the mainstream belief among scientists is that race is a social construct without biological meaning.
1. This is a closed book exam. You may only have pens, pencils , a calculator and one cheat sheet double sided on 8 ½ by 11 paper at your desk.
Rational decision is a state of being agreeable to reasons. The correct decision is not just reasoned but it is also optimal for solving a problem. Mr Weekes, the operation manager, employed series of analytical steps to review possible outcomes for problems by discussing it with managers to come up withdevise particular courses of action.
The Centers for Medicare and Medicaid Services (CMS) website offer a variety of information on Medicare, Medicaid, and Chip. For information concerning Medicare this site offers you an abundance of information such as eligibility and enrollment, health plans, prescription drug coverage,
An important property of the Law of One Price is that it holds even in markets
All questions on the examination will come from the lectures (Topics I – X) and the assigned chapters and parts of chapters in the textbook. To help frame the questions for you, they will be organized under the same main headings and subheadings used in the Lecture Notes. The only exceptions will be a few subheadings that pertain to material covered only in the text. Under each heading will be a mix of true-false and multiple-choice questions, and possibly a few analogies, with all answers to be recorded on a scantron sheet. Along with
1. Read "Case 9: National Collegiate Athletic Association Ethics and Compliance Program, pp 444-454. Answer the questions at the end of the case.
have a 90 minutes to complete the exam. The exam will cover all topics from the course. A
Problem solving is a universal process that allows us to make decisions on everything from what to eat and what to wear. These steps contain the necessary knowledge that has been constructed through previous life experiences. Without sufficient experience the supports designed to strengthen our choices are weakened ending in the ultimate failure of the problem.
17. Reducing the variations in our product or services is an important key to perceived quality TRUE
a. Design the logic for a program that allows a user to enter 10 numbers, then