CMPS 272 Midterm, Fall 2004

American University of Beirut · Operating Systems · 21 pages

All CMPS 272 files
CMPS 272 Midterm, Fall 2004, page 1

Stuck on a question? A tutor can walk you through it.

CMPS 272 Midterm, Fall 2004, page 2 CMPS 272 Midterm, Fall 2004, page 3 CMPS 272 Midterm, Fall 2004, page 4 CMPS 272 Midterm, Fall 2004, page 5 CMPS 272 Midterm, Fall 2004, page 6 CMPS 272 Midterm, Fall 2004, page 7 CMPS 272 Midterm, Fall 2004, page 8 CMPS 272 Midterm, Fall 2004, page 9 CMPS 272 Midterm, Fall 2004, page 10

Showing the first 10 of 21 pages. Download the PDF to see all of it.

More CMPS 272 files

Show the text of this exam
oN IN oa ee sees Faculty of Arts and Sciences Department of Computer Science CMPS 272-Operating System Concepts Fall 2004 — 2005, Mid-term (November 20, 2004) Duration: 100 min Profs. Leila Ismail and Walid Keyrouz Student name -RWby Naor Student ID 2ee2re413 Signature Rag ciiar ——--------—-- Questions 1. General (7 questions) 2. CPU scheduling (2 problems) 3. Synchronization (3 problems) 4. Deadlocks (1 problem) Total Please read the instructions below carefully before you start with the exam. IMPORTANT INSTRUCTIONS . You MUST fill in your name, student ID, and your signature on the first page, and your initials on all the pages, including the first one. . You MUST explain your answers clearly to get points. Your handwriting MUST also be readible to be graded. _ You MUST NOT look at your neighbor's sheet. This will be considered as a cheating attempt. | You MUST NOT talk during the exam. Any communication will be considered as a cheating attempt. . Any cheating will result in a zero on the test and possibly in failing the course and may also lead to disciplinary actions against you. 6. Use your time carefully. If you feel you are stuck, skip to the next question. 7. Use the back side of a page if the space provided for a question is not enough. . There is a total of 21 pages. 1.General There are 7 general questions to solve. 1. Given two machines, M1 and M2: M1 uses DMA and interrupt-driven I/O; M2 uses polling-based VO. Compare the I/O performance from a user's perspective in the following scenarios: a) The two machines are single-user single-tasking machines. b) The two machines are multi-user multitasking machines. 2. What is the purpose of a System Call? Give 2 examples. RAO LCE ree uwsts to & Wa Sof beceere MRA Cee Te mle Lace Aven to bo OCESS fo c§ccess WENA omepetacr oc Chiewe S eciQWe choker . 3. What are the advantages of multithreaded programming when compared to multiprogramming without mulithreading? ee woullhout pliner eee aes co the parent process needs to create a cid pracess to dea uf euery new Proce SS UN) thet aie cb has to com pute © UMS New chid _precess has no Shorea resources uo en WS rent and so cxtates an overhead that ack Found caren U canes to muctBirrenchi ney J far Uuihpw treads 10 mulhHoitading, ath Tre some cot pid, --- and nave only a fens in acdchition, ith rad § Guiare Te SOLLICES Pour Kewtar totam - Many be create A Por to Ware need and pu vay a tread pool and puéed cut Cohenaver needed. 4, What is the difference between a user-level thread and a kernel-level thread? Why does a process block when one of its user level threads issues a system call, whereas the process does not block when one of its kernel-level threads does the same? (SSULS A system a Kemeko 5. What does the shell do? Can a user delete the shell and what happens to the operating system if a user were to delete the shell? The spetL takes Commands From the user ond Fore, - : 5 exectlh@s flew ie poss ble Ci-e - J > anere are rEsSTHCDONS on FHKE Commancks a USA TOD AG be fer). ni Rex QA User cannot delete tue shell | C tuisisone tupe OF CO Compton 66 Cor rd pest chen) iF a User ake to HSE Loouid be. Looutch keno re festwekvons as *O eolrak La Coutd or coutdin'& Ao. es OS a 6. What is the difference between the calls fork(), exec() and system()? fori) —> creates a crud process exec( ) —> executes RE A Certain PON - . 7 a un the gratd process | i> an system () > 7. Briefly define a CPU-burst and explain its relevance to process scheduling. fH CPu- burst is the Wns Q certciian process Needs to use the CPU schediler, 19 Order tO ANSW irks execuh \ ur ecitnon - scheduling 1S Hak ; lis relevance to process No matter whok te Lap For schediuuiney Used » the Scheditel/ needs to know the CPU- clec to ve able +o pours’ OF each prec SS IN OC gchactute (A mae/Fashuon siated b4 1% Algantom , andd hence , ogk the obs done 2.CPU Scheduling There are 2 problems to solve in this section. \2] —» Problem 1 Suppose that the following processes arrive for execution at the times indicated in the table below and that each process will run for the given duration. In answering the questions, use nonpreemptive scheduling and base all decisions on the information you have at the time the decision must be made. Process Arrival Burst Time 1 0 7 0.4 3 1 1 a) What is the average turnaround time for these processes with the FCFS and SJF scheduling algorithms? Draw the corresponding Gantt chart for each algorithm. a.1) FCFS a.2) SIF b) The SJF algorithm is supposed to improve performance, but notice that we chose to run process P, at time 0 because we did not know that two shorter processes would arrive soon. Compute the average turnaround time if the CPU is left idle for the first 1 unit and then SJF scheduling is used. Draw the corresponding Gantt chart. Assumption . idle Hme rs ensideced as aihneg time. [ idle lps | Po 1 Py | a | (2 - O ( 2 5 — Zobos Do, dumamund time = / . Co (elo Problem 2 Consider the following set of processes, with their arrival times, CPU-burst lengths, and priorities. Process Arrival Burst Time Priority 10 Compute the average waiting times for all the scheduling policies below and count the number of context switches. For scheduling policies (d) and (e), draw the corresponding Gantt chart. (a) FCFS without preemption Av wating hone = (dfrio «aye + 24) 8 f . comm Re) — /{ . 4 context sd¥iches (b) SIF without preemption / nu. wainng tne = CO + SE ~ €\2.9 Anes 4 context su ches RAN (c) SJF with preemption Av. waiting tina = (14 42 £54 10816 )/F ae (d) Priority with preemption (lyghest proaty is Lewest yum er 1. 4 here) (2 +3 + erte neo 17. Xx