CMPS 272 Final, Fall 2001

American University of Beirut · Operating Systems · 15 pages

All CMPS 272 files
CMPS 272 Final, Fall 2001, page 1

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

CMPS 272 Final, Fall 2001, page 2 CMPS 272 Final, Fall 2001, page 3 CMPS 272 Final, Fall 2001, page 4 CMPS 272 Final, Fall 2001, page 5 CMPS 272 Final, Fall 2001, page 6 CMPS 272 Final, Fall 2001, page 7 CMPS 272 Final, Fall 2001, page 8 CMPS 272 Final, Fall 2001, page 9 CMPS 272 Final, Fall 2001, page 10

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

More CMPS 272 files

Show the text of this final exam
ERICAN UNIVERSIT ® LIBRARY OF BEIRUT American University of Beirut ENB TNL eapeeS Na Faculty of Arts & Sciences Department of Mathematics CMPS 272-Operating Systems Final - Fall 2001-2002 Time: 2 Hours Walid Keyrouz and Ahmad Nasri ERICAN UNIVERSIT® LIBRARY OF BrERUT Student Id Student Name Instructor Name Signature Question A. General B. Unix C. Job Scheduling ERICAN UNIVERSIT D. Process Coordination LIBRARY OF BEIRED E. Deadlock F, Virtual Memory Total . Good Work & Good Luck ERICAN ONIVERSITH LIBRARY OF BEIKUT General Remarks Make sure of the followings: 1. Answers to multiple choice questions MUST be put in the tables provided at the end of each section. You MUST not put any marks on the questions nor on your choices. . Fillin the survey form after you finish your exam General . One of the more common instances of client-server architectures is that of a file server serving files to client stations. The file server typically has a lot of storage whereas client stations have a much smaller disk. The client stations access the files through the network. This setup also allows a user to access his/her files from any station. Examples of such environments are Unix using NFS and PCs using a Windows 2000 file server. Tn such an environment, when a user executes a program, which CPU executes the instructions of the program? (a) The CPU of the client machine. (b) The CPU of the server machine (c) The CPUs of both the server and client machines. (d) None of the above. What is the role of the other CPU if only one CPU executes the instructions of the program? Explain your answer in the space provided it for it on Page 4. . If the dirty bit is set to one then ‘(a) The page has to be written to the backstore. (b) The page has not been modified. (c) The page has to be swapped out. (d) The page is not in memory. . In scheduling. the technique of uging is best described as: (a) Gradual decrease of priority to prevent indefinite blocking. (b) Gradual decrease of priority to prevent deadlock. (c) Gradual increase of priority to prevent starvation. (d) Gradual increase of priority to prevent deadlock. . Throughput is: (a) The time between submission of a process until the first response is received. (b) The time before a process is preempted. (c) The number of processes in the ready queue. (d) None of the above. . 5. Which of the following is NOT true regarding multiprogramming: (a) It makes efficient use of CPU by overlapping the the demands of the CPU and its I/O devices. « (b) it always attempts to have something ready for the CPU to execute. ~ (c) The degree of multiprogramming is the number of jobs ready to be run, e.g. in the ready state. (d) All of the above. 6. In virtual memory, Belady’s anomaly says: (a) The page-fault rate may decrease as the number of frames increases. (b) The page-fault rate may decrease as the number of frames decreases. (c) The page-fault rate may increase as the number of frames decreases. (d) The page-fault rate may increase as the number of frames increases. 7. In multiprocessing, graceful degradation is best described as: & 8) (a) The ability to reduce the computation by distributing it among different processes. (b) The ability to continue computation in the presence of failing processes. + (c) The ability to reduce the reliability of the system doing the computation. (d) None of the above. 8. Busy waiting is best described when: (a) A process is waiting for an event to occur and it does so by executing instructions. (b) A process is waiting for an event to occur in some queues without having the CPU assigned. (c) A process is in a wailing state. (d) A process is executing a wait operation on a semaphore. 9, Which of the following is not a condition needed before a deadlock can occur? (a) At least one more resource must be held in a non-sharable mode. (b) A process holding at least one resource is waiting for more resources held by other processes. (c) Resources can be preempted. (d) There must be circular waiting. 10. Which of the following is not a major activity of an OS with regard to memory management. (a) Keep track of which parts of memory are currently being used. (b) Decide which processes ure to be loaded into memory w hen available. (c) Allocate and deallocate memory space as needed. (d) Managing the free-space of the system. Answers for Section A Explanation for A.1 Unix . Assume that the directory Silly contains two subdirectories Silly! and Silly2 and that the current working directory is Silly2. Which of the following command copies all files with extension .dat in Silly2 to the subdirectory Silly I: (a) 3 cp ../Sillyl/*.dat Silly2 (b) % ep /Sillyl/*.dat Silly2 (cy cp «dat ../Siilyiv (d) $ cp *.dat ./Siiiyl . . The following command: “3 chmod 664 temp” (a) Removes the write access privilege for all users. ¢ (b) Removes the read access privilege for all users. (c) Removes the read access privilege for other users. » (d) Removes the write access privilege for other users. . . Assuming that the file cars contains information about cars in the following format: Type Model year Quantity Price honda accord 81 30 6000 - Which commands will display all cars priced under 3000: (a) % awk ‘$5 <= 3000’ > cars (b) awk '$5 <= 3000' cars (c) % cat cars | awk ‘$5 <= 3000’ (d) 3 cat cars > awk ’ <= 3000’ . Which of the following executes the command “Mystery” using the contents of the file “Godxnows” as input? (a) % Mystery | Godknows (b) % Mystery > Godknows (c) 4 Mystery >> Godxnows ~ {d) % Mystery < Godknows v 5. Assuming that the output of the “ps” command ts the following: 1062 ttyqd :01 3 102 ttyqd 201 1067 ttyqd :00 totxgizmo 1103 ttyqd 200 txgizmo 1133 ttyqd 200 j 1035 ttyqd 210 The following command wil! sort the output of “ps” in alphabetical order with respect to the last field and save the results in a file called “PSDetail.info™: i(a) (b) (c) 3 ps > sort +3 | 'U Detail.info Detail.info ps | sort +3 > ps > sort -3 > 2 ow oh vu wm 'o Detail.info (d) None of the above. . Suppose your current working directory contains the following 20 files: FileO, Filel.,..., Filel9. Which command will concatenate the FileO to Filel0, File! to File 11, File2 File 12, and so on up to File9 to File!9. (a) % cat File* >> Filel* (b) % cat File? »> Filel? (c) % cat File[0-9] >> Filel[0-9] (d) None of the above. . The output of the command “cat sillyawk” is: { if ($1 ~ /°[tm]) $2 = "nice" print} Which best describes the role of the command “awk -f sillyawk data”: (a) Will replace by nice the second field of each line that starts with the letter ONLY. (b) Will replace by mice the second field of each line that starts with tm ONLY. (c) Will replace by nice the second field of each line with the first field containing the letter torm. (d) Will replace by rice the second field of each line that starts with t or m. . Which of the following commands print the name of the owner of the current directory? (a) $ ls -ld | awk (ovint $1} (b) (c) 4 : (d) % awk ’{ print "is -ld"}’ ls -ld | awk ‘‘print $3}’ ls -ld < awk . Suppose in your current directory you have a number of C files: Sillyl.c, silly2.c, Siliy3.c. Which of the command below will output all the lines of these files that start with int (the name of the file that contains each line must NOT be output): (a) C i are (b) % i rel (c) & : - . Assuming that you current working directory is MyDir issue the command SillyX at the prompt command to which it replies “command not found”. Which of the following could not be the problem? (a) SillyxX is not an executable file. (b) Your path variable does not include your current working directory. (c) Your path variable include the path of SillyX but SillyX ts not in MyDir. (d) Your path variable docs not include the path of the Sillyx and SillyX is in MyDir. (e) None of the above. Answers to Unix Question [1 | Job Scheduling _ A CPU scheduling algorithm determines an order for the execution of its scheduled pro- cesses. Given n processes to be scheduled on one processor, how many possible different schedules are there? Give a formula in terms of 2. (Assume that the scheduling algorithm is non-preemplive.) ) 2. Five jobs are waiting to be run. Their expected run times are 9, 6, 3, 5, and X. In what order should they be run to minimize average response time? (Your answer will depend on X.) 3. Consider the following set of processes, with the length of the CPU-burst time given in msecs: Process | Burst Time | Priority | P 10 3 | P 6 Py 2 Py 4 | | | | The processes are assumed to have arrived in the order P;. P2, P3, Py, Ps, all at time 0. (a) Draw three charts illustrating the execution of these processes using FCFS, SJF, and RR (quantum = 1) scheduling. What is the turnaround time of each process for each of the scheduling algorithms in part a. Process | FCFS SJF RR Pi toe : P| i ‘ What is the waiting time of each process for each of the scheduling algorithms in part a. Process FCES SJF RR P Py Px Ps Ps What is the turnaround time of each process for each of the scheduling algorithms in part a. Process FCFS SIF RR P Py Ps Py Ps Which of the schedules in part a results in the minimal average waiting time (over all processes)?