Computer Science 422/622 Quiz 1 - Name ________________________ Computer Science 422/622 Quiz 1 1. Which of the following is NOT necessary in a computer system that is to run a multitasking operating system that supports multiple concurrent users: a. A timer capable of generating c. Multiple CPUs an interrupt. b. DMA I/O capability d. Memory protection. 2. In a multitasking operating system synchonous I/O operations performed through the CPU: a. Are good choices for Disk and c. Are sometimes used to perform Tape I/O since the CPU is fast. fast peripheral control functions such as re-arming a timer. b. Should not be used under any circumstances. 3. The most common way of performing disk and tape I/O in a multi- tasking O/S is: a. Using DMA transfers and c. With all transfers through polled detection of completion. the processor. b. Using DMA transfers with interrupt signalling of completion. Suppose 4 jobs each require 1 hour of CPU time and no I/O. The jobs are first run single threaded on a DOS type system and then run multitasked in a way in which each job is given 1 second time slices (Assume not task switch overhead). 4. What will be the average time until completion a. For the single threaded jobs. b. For the multitasked jobs. 5. What will be the maximum time until completion a. For the single threaded jobs. b. For the multitasked jobs. Computer Science 422/622 Quiz 2 - Name ________________________ 1. Which of the following is NOT a fundamental disadvantage of monolithic OS organization. a. Unrestricted access to shared c. Unrestricted access to shared global data makes bugs likely global data makes modifications and debugging difficult. to the system difficult to do without introducing new bugs. b. Excessive overhead of system calls generallly leads to poor system performance. Answer the following T or F. ___ 2. A problem with the use of the hierarchical (layered) approach to OS design is that it is difficult to organize an OS in a way that avoids circular dependencies and thus violates the hierarchy. ___ 3. The hierarchical design is inherently more suitable for use in a distributed memory mulitiprocessor system than the process/object oriented approach. ___ 4. One potential problem with the use of the process/object oriented design is that the overhead of passing large numbers of messages can cause system performance problems. ___ 5. The main distinction between threads and processes is that multiple processes typically run in a single shared address space while each thread runs in its own private address space. Computer Science 422/622 Quiz 3 - Name ________________________ Answer the following questions T or F. 1. The medium term scheduler is commonly known as the dispatcher. 2. A job may be scheduled a number of times by both the short and medium term schedulers before it completes. 3. The best (shortest) interactive response time is obtained when the mumber of users is such that maximum system throughput in transactions per second is being obtained. 4. On a single processor system if every process disables interrupts before entering a critical section and enables them on exit from the critical section, then no two processes will ever be in a critical section at the same time. 5. On a multi-processor system if every process disables interrupts before entering a critical section and enables them on exit from the critical section, then no two processes will ever be in a critical section at the same time. Computer Science 422/622 Quiz 4 Name _______________________ For each of the following application code approaches to providing mutual exclusion select the answer which best describes how it worked (or failed to work). 1. Using a single "Critical section busy" flag which was tested and then set prior to entering the critical section. a. Not safe. c. Could cause starvation (livelock). b. Could cause deadlock. d. Causes strictly alternating access to critical section. e. Works correctly 2. Both processes have a "Using Critical Section" flag. Before entering, a process sets its own flag and then loops until the other processes flag is clear. a. Not safe. c. Could cause starvation (livelock). b. Could cause deadlock. d. Causes strictly alternating access to critical section. e. Works correctly 3. Dekkers Algorithm. a. Not safe. c. Could cause starvation (livelock). b. Could cause deadlock. d. Causes strictly alternating access to critical section. e. Works correctly 4. Both processes have a "Using Critical Section" flag. Before entering, a process loops until the other processes flag is clear and then sets its own flag. a. Not safe. c. Could cause starvation (livelock). b. Could cause deadlock. d. Causes strictly alternating access to critical section. e. Works correctly 5. Both processes have a "Using Critical Section" flag. Before entering, a process sets its own flag and then tests the the other processes flag. If the other process's flag is clear, the critical section is entered. Otherwise, the process clears its own flag, and starts the whole sequence over again. a. Not safe. c. Could cause starvation (livelock). b. Could cause deadlock. d. Causes strictly alternating access to critical section. e. Works correctly Computer Science 422/622 Quiz 1 - Name ________________________ 1. A semaphore "WAIT" operation will decrement the value of the semaphore if: a. The current value is > 0. c. There is no task currently blocked on the semaphore. b. The current value is >= 0. d. Never. 2. A the value of a semaphore will have been incremented at the conclusion of a signal operation if: a. If the value is > 0. c. There is no task currently blocked on the semaphore. b. If the value = 0. d. Never. 3. A semaphore can be used to provide mutual exclusion among a. 2 or fewer tasks d. Any number of tasks. b. 3 or fewer tasks These two questions pertain to the OS semaphore implementation presented in class last time. 4. In a Uniprocessor system the call to getlock will find the lock free. a. Never. c. Nearly always. b. Infreqently. d. Always. 5. In a multiprocessor system disabling interrupts should be done a. Before attempting to c. Should not ever be done at all. acquire any lock. b. Just after acquiring any lock. Computer Science 422/622 Quiz 6 - Name ________________________ Answer the following T or F. ____ 1. A mutual exclusion semaphore is required in the producer-consumer problem when there is a single producer and a single consumer. ____ 2. In the producer - consumer problem it is possible for all the producers to use a common mutual exlusion semaphore and all the consumers to also use a common mutual exclusion semaphore that is different from the one used by the producers. ____ 3. In the producer consumer problem it is possible for each producer and consumer to have a private semaphore used for mutual exclusion. ____ 4. When mutual exclusion semaphores are used a consumer or producer should acquire the mutex semaphore BEFORE waiting on the "slots" or "items" ____ 5. It is not possible to have a correct producer consumer implementation that uses more than 1 producer or consumer. Computer Science 422/622 Quiz 7 - Name ________________________ 1. Use of Mailbox naming instead of direct naming is most desirable when: a. Two processes want to communicate c. Use of mailbox naming is with each other never a desirable option because its too inefficient b. Many processes want to communicate with a single server. 2. Sending of messages is said to be synchronous when: a. No mailbox buffering is used. c. Synchronous sending is always used in a mailbox system. b. Mailboxes have at least 1 buffer. 3. In a system that uses buffering and copying of messages rather than passing by address it will be necessary to copy the message twice when: a. It is sent before a receiver c. Always. is ready to receive it. b. A receiver is waiting on the d. Never. message at the time it is sent. 4. Which of the following is an ADVANTAGE of the use of pass by address when compared to copying. a. PBA works better in a networked c. PBA uses less CPU time system. than copying. b. PBA makes it easier for the sender to know when he can safely re-use the buffer space containing a message. 5. We identified in class last time 4 basic design considerations in building a message passing system.. The first three were: Naming, copying, and buffering what was the last one?? Computer Science 422/622 Quiz 1 - Name ________________________ For each of the following identify the Deadlock PREVENTION mechanism that is most appropriate: (Don't give the name of the associated condition necessary for deadlock.) 1. Allocation of real memory. 2. OS internal locks. 3. Files and I/O devices used by BATCH jobs. 4. Which one of the four conditions necessary for deadlock is generally not possible to eliminate. 5. Are the deadlock prevention techniques described in class applicable to: a. Consumable resources only c. Equally applicable to SR and C resource. b. Serially reusable resources only Computer Science 422/622 Quiz 9 - Name ________________________ 1. We identified three standard techiques for keeping track of free and allocated memory. One was using a bit map. What were the other 2. a. b. 2. Which of the memory allocation policies that we discussed always allocates from the largest free block of memory. a. First Fit. c. Last fit. b. Best Fit. d. Worst fit. 3. Which of the following policies is NOT one that we discussed. a. First Fit. c. Last fit. b. Best Fit. d. Worst fit. 4. If the list of free blocks of memory is always sorted into ascending size order, then the four policies are really two pairs of eqivalent policies. Draw circles around each equivalent policy pair. a. First Fit. c. Last fit. b. Best Fit. d. Worst fit.