6 Pages

MidtermSpring2004

Course: CS 3204, Spring 2004
School: Virginia Tech
Rating:
 
 
 
 
 

Word Count: 841

Document Preview

3204 CS Operating Systems Midterm Spring 2004 ECHNI LYT C PO VIR I N G IA I TUTE ST IN ST U T P RO S I M R AT E UNI V E Instructions: Print your name in the space provided below. This examination is closed book and closed notes. No calculators or other computing devices may be used. Answer each question in the space provided. If you need to continue an answer onto the back of a page, clearly indicate...

Register Now

Unformatted Document Excerpt

Coursehero >> Virginia >> Virginia Tech >> CS 3204

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
3204 CS Operating Systems Midterm Spring 2004 ECHNI LYT C PO VIR I N G IA I TUTE ST IN ST U T P RO S I M R AT E UNI V E Instructions: Print your name in the space provided below. This examination is closed book and closed notes. No calculators or other computing devices may be used. Answer each question in the space provided. If you need to continue an answer onto the back of a page, clearly indicate that and label the continuation with the question number. If you want partial credit, justify your answers, even when justification is not explicitly required. There are xx questions, priced as marked. The maximum score is 100. When you have completed the test, sign the pledge at the bottom of this page and turn in the test. Note that either failing to return this test, or discussing its content with a student who has not taken it is a violation of the Honor Code. Do not start the test until instructed to do so! Name printed Pledge: On my honor, I have neither given nor received unauthorized aid on this examination. S IT D AN Y signed 1 CS 3204 Operating Systems 1. Midterm Spring 2004 [10 points] Consider two processes, P1 and P2, on a multi-tasking operating system with a single CPU. In each of the following situations would it be preferable for the OS to force a context switch and schedule another process? Explain why you reached your conclusion (a) P1 executes an input operation that requires reading data from a file on disk (b) P2 executes an arithmetic operation that involves a variable whose value is stored in primary RAM . 2. [10 points] Many modern multi-tasking operating systems use a quantum timer as part of the algorithm for scheduling processes. What is a quantum timer and how is it used? 3. [10 points] The scheduling algorithm in Windows 3.1 essentially waited for the running process to offer to be moved into the ready state. Describe at least two different (possibly related) problems with this approach? 2 CS 3204 Operating Systems 4. Midterm Spring 2004 Consider executing the two threads below, with the shared global variables that are shown. // shared globals int favoredThread = 1; bool t1WantsIn = false; bool t2WantsIn = false; void* T1(void* Data) { ... bool done = false; void* T2(void* Data) { ... bool done = false; while ( !done ) { t2WantsIn = true; favoredThread = 1; while ( t1WantsIn && favoredThread == 1 ); // entering critical section now ... // leaving critical section now // safe code follows ... while ( !done ) { t1WantsIn = true; favoredThread = 2; while ( t2WantsIn && favoredThread == 2 ); // entering critical section now ... // leaving critical section now // safe code follows ... } } } pthread_exit(0); } [10 pthread_exit(0); (a) points] Does the design of the two threads guarantee that mutual exclusion will be achieved? If not, clearly describe an execution sequence that would lead to a violation. (b) [10 points] Does the design of the two threads guarantee that deadlock will not occur? If not, clearly describe an execution sequence that would lead to a deadlock of the two threads. 3 CS 3204 Operating Systems 5. Midterm Spring 2004 [10 points] Aside from the technical distinction that fork() spawns a new process and pthread_create() spawns a thread, what is the most significant difference between them from a UNIX programmer's perspective? Assume that the pthread library will, in fact, be available on any UNIX platform. 6. [10 points] The simple program shown below creates a collection of threads that are intended to cooperate in the initialization of the elements of an array. Will the program always produce correct results, sometimes produce correct results, or never produce correct results? If not, explain how to fix it. If yes, explain why. Assume appropriate includes and declarations necessary for the code to compile and link; that is not the point. struct Package { int* L; int sIdx; }; ... int main() { pthread_t hThread[MAX_THREADS]; int* List = new int[OFFSET * MAX_THREADS]; Package P[MAX_THREADS]; for (int p = 0; p < MAX_THREADS; p++) { P[p].L = List; P[p].sIdx = p; pthread_create(&hThread[p], NULL, F, (void*) &P[p]); } Print(cout, List); // print contents of array pthread_exit(0); } void* F(void* D) { Package* Data = (Package*) D; for (int Idx = Data->sIdx; Idx < OFFSET * MAX_THREADS; Idx += MAX_THREADS) { Data->L[Idx] = Data->sIdx; } pthread_exit(0); } 4 CS 3204 Operating Systems 7. Midterm Spring 2004 [10 points] Consider the simple run/ready/block state transition scheme for process scheduling. Draw the state diagram, showing all the possible transitions. Label each transition with a brief, precise description of an event that might cause a process to make that transition. 8. [10 points] The Linux task state-transition diagram includes a zombie state and a dead state. Evidently, some tasks might be placed in the zombie state before making a final transition to the dead state. Why is this a necessary feature (or at least a useful one)? 5 CS 3204 Operating Systems 9. Midterm Spring 2004 [10 points] If an interrupt occurs while a process is executing, it is possible the interrupt is either synchronous or asynchronous. Give an example of something that might cause a synchronous interrupt. Give an example of something that might cause an asynchronous interrupt. Seemed appropriate somehow. have a good break! 6
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Virginia Tech - CS - 3204
CS 3204 Operating SystemsMidtermSpring 2005ECHNI LYT C POVIR I N G IAI TUTE ST INST U T P RO S I M R AT E UNI V EInstructions: Print your name in the space provided below. This examination is closed book and closed notes. No calcu
Virginia Tech - CS - 3204
CS 3204 Operating SystemsHomework 1: Computer SystemsPrepare your answers to the following questions either in a plain text file or in a Microsoft Word file. Answer each question clearly and concisely, but completely, using complete sentences. Ex
Virginia Tech - CS - 3204
CS 3204 Operating SystemsHomework 4: ConcurrencyPrepare your answers to the following questions either in a plain text file or in a Microsoft Word file. Answer each question clearly and concisely, and state conclusions using complete sentences. E
ASU - EEE - 460
EEE 460 Nuclear Concepts for the 21st CenturySpring 2006Problem: This problem uses data from the U.S. National Institute of Standards and Technology (NIST), see http:/physics.nist.gov/PhysRefData/XrayMassCoef/cover.html . Using photon energies from 1 ke
ASU - EEE - 460
ASU - EEE - 460
Purdue - BIOL - 221
Chan Huynh 1. a. This is a reduction reaction. You can tell by the enzyme that was used in the reaction. Reductases are only used for the purpose of lowering activation energies for reduction reactions. b. Fluvastatin prevents the synthesis of choles
Purdue - BIOL - 301
Biology 301 Fall 2008Chan Huynh Section 0012Diffusion, Osmosis, &amp; Tonicity Lab 4 Data DiscussionIntroduction 1. Osmosis is the diffusion of water through a selectively permeable membrane. Tonicity is the comparison of the osmotic pressure of the
Purdue - BIOL - 301
Percentage of Cells Plasmolyzed in Solutions of MgCl2, NaCl, KCl, and Sucrose100 95 90 85 80 75 70 65 Percentage (%) 60 55 50 45 40 35 30 25 20 15 10 5 0 0.00 0.03 0.05 0.08 0.10 0.13 0.15 0.18 0.20 0.23 0.25 0.28 0.30 0.33 0.35 0.38 0.40 Column B
Purdue - MCMP - 204
September 18, 2008 Sec. #13 Thu 2:30pmChan HuynhExercise 2Title: Melting Point Objective: To determine the composition of the eutectic mixture of aspirin and salicylic acid by observing the melting point ranges of samples containing various rati
Purdue - MCMP - 204
September 25, 2008 Sec. #13 Thu 2:30pmChan HuynhExercise 3Title: Separation and Analysis of the Components of a Mixture Objective: To isolate different substances of an unknown drug and to identify the components by using their melting point. Re
ASU - EEE - 460
UIllinois - ECON - 203
Graded Homework 13You have submitted this Homework 2 times (including this time). You may submit this Homework a total of 40 times and receive full credit. This homework will be due October 14 at 3am. This quiz covers the introduction to simple line
UIllinois - ECON - 203
Graded Homework 15You have submitted this Homework 2 times (including this time). You may submit this Homework a total of 40 times and receive full credit. This homework will be due October 21 at 3am. This quiz covers the t tests for slope in the co
UIllinois - ECON - 203
Graded Review 1 You have submitted this Homework 6 times (including this time). You may submit this Homework a total of 40 times and receive full credit. This review covers material on pages 7 - 20 of your course packet. Question #1Which of the fol
UIllinois - ECON - 203
Graded Review 2You have submitted this Homework 6 times (including this time). You may submit this Homework a total of 40 times and receive full credit. This review covers material that can be found in your course packet on pages 7 - 25 and material
UIllinois - ECON - 203
Graded Homework 14You have submitted this Homework 1 time (including this time). You may submit this Homework a total of 40 times and receive full credit. This homework will be due October 14 at 3am. This quiz covers some model assessment topics in
ASU - EEE - 460
Missouri (Mizzou) - BUSINESS - 3540
Chapter 12 - Consideration12.1 Define consideration and give an example of consideration which would be sufficient to legally bind a contract.Consideration is the value given in return for a promise. On ebay, the buyer promises to pay for the item
Missouri (Mizzou) - MARKETING - 3000
Marketing Final Exam Notes Non-Profit Marketing U.S. Nonprofit Services Over 1 million organizations o Generate $1.1 trillion in revenue each year o Account for abut 7% of all employment Many types o Arts/Culture/Humanities o Education o Religious
Missouri (Mizzou) - MARKETING - 3000
Benefits to taking this course 1. Functional: learn about marketing, get course credit 2. Social: meet friends, business partners 3. Personal: feeling good about learning or excelling 4. Experiential: laugh, be entertained, or catch up on sleep Costs
Missouri (Mizzou) - MARKETING - 3000
1. (p. 178-179) Part of the first step in the marketing research procedure is to: A. gather primary data. B. define the objectives. C. conduct an informal investigation. D. perform a situation analysis. 2. (p. 180) _ are original data gathered specif
Missouri (Mizzou) - MARKETING - 3000
MARKETING RESEARCH Marketing Research Includes: Syndicated research services Marketing information systems Marketing Intelligence Systems o Or Decision Support Systems Non-recurring research projects o Ex: study of consumers perceptions toward ho
Berkeley - ECON - 171
EEP 151/Econ 171 Development Economics Exercise 1: Using indicators to characterize development patternsAlain de Janvry, David Roland-Holst, Alan Fuchs and Paul Wassenich September 22, 2008I. [20 points] Comparing income growth across countriesCo
Berkeley - ECON - 171
EEP151/Econ171 Fall 2008Alain de Janvry and David Roland-Holst Alan Fuchs and Paul WassenichExercise 2 Doing a poverty assessment for Brazil and Indonesia Due October 2, 2008 Brazil and Indonesia are two large countries with large segments of the
Berkeley - ECON - 181
Econ/EEP 181: International Trade Assignment # 1 SolutionsLuosha Du, Shanthi Nataraj, and Robert Santillano University of California, Berkeley Due: September 15, 20081. We are given the following labor input requirements: Cloth 4 hours 6 hours Whe
Berkeley - ECON - 181
Econ/EEP 181: International Trade Assignment # 2 SolutionsLuosha Du, Shanthi Nataraj, and Robert Santillano University of California, Berkeley Due: October 1, 20081. Specic Factors and Trade. Finland is capital abundant relative to potential tradi
Berkeley - ECON - 136
Problem Set 1 SolutionsEcon 136, Fall 2008A note about grading: Each of your problem sets will be graded on a 0 to 5 scale. 5= no major or minor errors 4= no more than a few minor errors 3= a major or many minor errors 2= multiple major errors 1= m
Berkeley - ECON - 136
Economics 136. Financial Economics Midterm 1, Fall 2008, Suggested solutions 1. True or false. (20 points, 5 each) (i) True. The price of a zero-coupon bond is P = F= (1 + R)T and when R &gt; 0, this is les than F . (ii) False. A price weighted portfoli
Berkeley - ECON - 171
Econ171/EEP151 Fall2007AlaindeJanvry Melissa Hidrobo and Lourdes Rodriguez MidtermExamination (1hourand20minutes.20%ofthefinalgrade) AnswersallfourpartsPartI.Defineany4ofthefollowing5concepts.Ifyouuseagraphoraformula,makesurethatyou explainwhatit
Berkeley - ECON - 171
Econ 171/EEP 151 Fall 2007Alain de Janvry Melissa Hidrobo, Lourdes RodriguezFinal Examination Three hours. Scores add up to 100 points. 40% of course grade. Use back side of page if needed. Your name:_ Your SID__ Part I. Define 8 out of the follo
Berkeley - EPS - 8
Assignment 3 How to Stabilize and Lower Carbon Emission Based on Climate Change 2007: Synthesis Report. Summary for Policymakers, changes in fuels we use to general energy and how we personally use energy can reduce emissions as much as the report in
Berkeley - CHINESE - 100ax
/ ,( )? ,()? ,()! ,( ). ,( ). ,( )? ,( ). (). (). ,( )? (),. ,(). ,(),. ,( ). ,()? ( ( ),. )? ,( ). ,().
Colorado - ATOC - 1050
Date and TimeLocationAmount of Clouds Clear Clear, very few clouds Clear Partly Cloudy Scattered Clouds Mostly Cloudy Scattered Clouds Mostly Cloudy Clear, very few clouds Very few clouds Clear Clear Clear Partly Cloudy Partly CloudyCloud Types
Colorado - ATOC - 1050
Alisa SjolinHomework #2 ATOC 1050, Dr. KeenWeekly Weather Log Week of September 25, 2008 October 2, 2008Thursday September 25th: Today was a very nice day. There were clear skiesall day with few clouds in the sky. When I woke up the temperature
LSU - POLI - 4040
Ole Miss - ECON - 202
INSTRUCTO R: OFFICE: EMAIL:ECON 202 PRINCIPLES OF MICROECONOMICS Fall 2008 Section 4 Ali OFFICE T-TH (13:15 -14:15) Gungoraydinoglu HOURS: and also by appointment Holman 354 CLASS T-TH (11:00 AM - 12:15 PM) TIME: alieco@olemiss.e CLASSROOM Holman 1
Punjab Engineering College - ECC - 3101
ECC 3101- Computer Programming Lab Sheet 7- function 1. Write a program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of RM10) and the machine dispenses this amount using the least number o
Punjab Engineering College - ECC - 3102
ECC 3101- Computer Programming Lab Sheet 4 switch statement 1. Rewrite the previous program- Lab 3, Question 1, using the switch case statement. 2. Write a program that implements a simple calculator that reads 2 integers and math operator ('+', '-'
Punjab Engineering College - ECC - 3102
ECC 3101- Computer Programming Lab Sheet 3- if-else statement 1. Write a program that allows the user to input marks of 5 subjects, i.e; marks between 0 - 100. Give input of credit hours for every subject and declare them as integer data types. The p
Punjab Engineering College - ECC - 3102
Chapter 5 FunctionsLiang, Introduction to C+ Programming, (c) 2007 Pearson Education, Inc. All rights reserved. 013225445X1Objectives3 333 3 3 3 3 3 3To create functions, invoke functions, and pass arguments to a function (5.2-5.4). To u
Punjab Engineering College - ECC - 3102
Chapter 1 Introduction to Computers, Programs, and C+Liang, Introduction to C+ Programming, (c) 2007 Pearson Education, Inc. All rights reserved. 013225445X1Objectives3 3 3 3 3 3 3 3 3To review computer basics, programs, and operating system
E. Stroudsburg - HIST - 100
FILM LIST - HISTORY 143 Extra Credit Due April 24, 2008 2 3 pagesChoose one of the films below and evaluate. What relationships do you observe between the characters? Look for accuracy of historical issues. What do you see in the film that reinfor
E. Stroudsburg - HIST - 100
Saleh 1Viola Saleh History 143 April 22, 2008 JFK Book ReviewJohn F. Kennedy and a New Generation, by David BurnerA man does what he must - in spite of personal consequences, in spite of obstacles and dangers and pressures - and that is the bas
E. Stroudsburg - HIST - 100
NEW FRONTIERSPolitics and Social Change in the 1960sThe Election of 1960Republicans Richard M Nixon VP under Eisenhower Strong anti-communist stance Democrats John F Kennedy Mass Senator Moderate departure from New Dealers Won on first
E. Stroudsburg - HIST - 100
Rebellion and ReactionThe 1960s and 1970sThe SDS and the New Left New Left American affluence Expansion of college attendance students as social critics Atomic issues Civil rights Students for a Democratic Society (SDS) Agenda for a Gener
E. Stroudsburg - HIST - 100
Word List Chapter 35 Rebellion and Reaction 1. Students for a Democratic Society (SDS) 2. agenda for a generation Tom Hayden 3. Vietnam teach ins 4. The Feminine Mystique Betty Frieden 5. National Organization for Women (NOW) 6. Gloria Steinem MS m
E. Stroudsburg - HIST - 100
The choices reflect the trade-offs people face because we live in a world of scarcity, which means that although our wants are unlimited, the resources available to fulfill those wants are limited. Economics is the study of the choices consumers, bus
E. Stroudsburg - HIST - 100
ECON 112 GE: Principles of MicroeconomicsChapter 4- Economic Efficiency, Government Price Settings, &amp; TaxesPrice ceiling- a legally determined maximum price that sellers may charge. (ex: rent control) Price floor- a legally determined minimum pric
E. Stroudsburg - HIST - 100
Introduction to Philosophy / Prof. Pruims Notes Basic Concepts of Logic and Reasoning / p. 1BASIC CONCEPTS OF LOGIC &amp; REASONINGI. Good Arguments needs to be Valid, Sound, and Cogent.Argument, premises, conclusion. An argument is not just a series
E. Stroudsburg - PCS AND TH - 100
Getting Started withContentsGetting Started with myitlab! .2 ! @ # $ % ^ &amp; * System Requirements.2 Before You Register .3 Registering for myitlab.3 Enrolling in a myitlab Course ..6 Accessing Your myitlab Course .7 Getting Started in myitlab .7 Vi
E. Stroudsburg - PCS AND TH - 100
Account ID: 15987711 Order ID: 26270129 Date Wed Jul 16 19:55:47 EDT 2008 Submitted:
E. Stroudsburg - PCS AND TH - 100
Personal Computers and Their Uses Course Syllabus Summer 2008Course Information Instructor: Mary DeVito Phone: 570.422.3739 Office: 310A Stroud Hall, unless we are in the new building (Science &amp; Technology Building) by then Course Number: CPSC100
E. Stroudsburg - PHYSICAL G - 101
Topic for short essay 1 and discussion: Global Warming Prepare a short essay for an online discussion on Global Warming. The short essay should include: 1) the data or records that support global warming is in fact occurring; 2) the natural and human
E. Stroudsburg - PHYSICAL G - 101
GEO 120Introduction to Physical GeographyInstructor Dr. Shixiong (Shawn) HUChapter 1 Essentials of GeographyEssentials of GeographyThe Science of Geography Earth Systems ConceptsThe Science of GeographyGeography from geo Earth and graphein
E. Stroudsburg - PHYSICAL G - 101
Chapter 1 Essentials of GeographyEssentials of GeographyEarths Four Spheres The Earth as a Sphere Location and Time on Earth Maps, Scales, and Projections Remote Sensing and GISEarths Four SpheresAbioticnon-living (inorganic) systems Bioticlivi
E. Stroudsburg - PHYSICAL G - 101
Chapter 2 Solar Energy to Earth and the SeasonsSolar Energy to Earth and the Seasons: TopicsThe Solar System, Sun, and Earth Solar Energy: From Sun to Earth The SeasonsOur Solar System (1)Our Solar System (2)Aphelion PerihelionFigure 2.1S
E. Stroudsburg - PHYSICAL G - 101
Chapter 3 Earths Modern AtmosphereVariable Atmospheric Components: SubtopicsNatural Sources Natural Factors That Affect Air Pollution Anthropogenic Pollution Benefits of the Clean Air Act Focus Topic: Ozone LayerNatural SourcesNatural sources &gt;
E. Stroudsburg - PHYSICAL G - 101
Chapter 3 Earths Modern AtmosphereEarths Modern Atmosphere: TopicsPressure Composition Temperature FunctionThe principal substance of the atmosphere is air; a simple mixture of gases that is naturally odorless, colorless, tasteless, and formless
E. Stroudsburg - PHYSICAL G - 101
Chapter 4 Atmosphere and Surface Energy BalancesEnergy Balance at Earths Surface: SubtopicsRadiation Balance by Latitude Daily Radiation Patterns Simplified Surface Energy Balance The Urban Environment Focus Topic: Solar EnergyRadiation Balance
E. Stroudsburg - PHYSICAL G - 101
Chapter 4 Atmosphere and Surface Energy BalancesAtmosphere and Surface Energy Balances: TopicsEnergy Essentials Energy Balance in the TroposphereEnergy Pathways and PrinciplesEarths atmosphere and surface are heated by solar energy Unevenly dis