New version page

UNO CSCI 4500 - Study Guide

Upgrade to remove ads
Upgrade to remove ads
Unformatted text preview:

CSCI 4500/8506 Page 1 Quiz 3 Practice QuestionsCSCI 4500/8506 – Spring 2012Sample Questions for Quiz 3(covers modules 4, 5, and 6)1. The processes involved in the producer-consumer problem are those thata. need large amounts of memory.b. occasionally generate objects and those that then use those objects.c. are compute-bound and I/O-bound.2. The objects that are being produced in the producer-consumer problem are generallycharacterized asa. blocks of memory, independent of their content.b. data objects, like indications of keys pressed or released on a keyboard.c. units of processor time available for process execution.3. The processes in the producer-consumer problem are assumed to runa. at exactly the same rate.b. at about the same rate.c. at different and arbitrary rates, as is required by good solutions to race conditionproblems.4. A buffer, or storage area, is required in the producer-consumer problem. This buffer holdsa. objects produced before a consumer process is ready to use them.b. indications of when a producer process is allowed to run.c. objects that a consumer process considered, but then rejected as unsuitable.5. Access to the buffer in the producer-consumer problema. is always permitted for producers, but consumers must obtain explicit permission from aproducer to access the buffer.b. is controlled by the last object removed from the buffer.c. is shared by producers and consumers, and so must occur only inside a critical section.6. When the buffer in the producer-consumer problem is completely fulla. consumer processes are executed more rapidly.b. a producer that has created an object must block until an empty space becomes availablein the buffer.c. the number of producer processes is reduced by half.7. When the buffer in the producer-consumer problem becomes emptya. consumer processes wishing to obtain an object must block until the producer places anobject in the buffer.b. the speed with which producer processes are executed is increased.c. a dummy object is placed in the next buffer location that will be accessed by a consumer.CSCI 4500/8506 Page 2 Quiz 3 Practice Questions8. Assume a producer process is blocked while waiting on empty space in the buffer. In thiscase, a consumer processa. will awaken a producer when it removes an object from the buffer, allowing space for theproducer to place another object.b. will remove and discard sufficient data objects (from the buffer) to make space availablefor the blocked producer to place additional objects in the buffer.c. change its priority to be at least as high as that of the the blocked producer process.9. Consider that the statement count = count + 1; appears in multiple processes or threads in asystem where the variable named count is accessible by multiple processes or threads. Whatmust be done to ensure the value of count is correctly incremented when the statement isexecuted?a. Each of the processes or threads must have a unique (different) priority.b. It is impossible to guarantee that count will be properly incremented if multiple threadsor processes contain the statement that can increment it.c. The statement must be in a critical section in each of the processes or threads thatcontains it.10. Who proposed the semaphore data structure?a. Donald Shellb. Edgser Dijkstrac. Tony Hoare11. What is the significance of the letters P and V when describing the fundamental operationson a semaphore?a. They correspond to the first letters of the French words that describe the operations.b. They correspond to the first letters of the Dutch words that describe the operations.c. None of the other answer choices is correct.12. The problem with the producer consumer problem solution using the sleep and wakeupfunctions is related to the fact thata. a wakeup of a process (either a producer or a consumer) could be lost.b. in some cases, sleep will not cause a process to block.c. wakeup and sleep are not atomic operations.13. A semaphore has two data components. One of these is a set. What type of data objects canthis set contain?a. the identification of processes that currently hold (possess) one or more units of theresource controlled by the semaphoreb. process identificationsc. None of the other answer choices is correct.CSCI 4500/8506 Page 3 Quiz 3 Practice Questions14. A semaphore has two data components. One of these is an integer. What does the value ofthis integer represent?a. the number of processes currently holding (possessing) one or more units of the resourcecontrolled by the semaphoreb. the number of waiting wakeups for processes that request use of a resource controlled bythe semaphorec. the number of items in the set associated with the semaphore15. A P operation on a semaphore is also called a(n) _____ operation.a. leftb. upc. down16. A V operation on a semaphore is also called a(n) _____ operation.a. downb. incrementc. up17. When a P operation is executed on a semaphore with a count of zero,a. the identity of the process is added to the set associated with the semaphore, but theprocess continues execution.b. the process executing the P operation is blocked.c. the count is incremented and the process executing the P operation is blocked.18. When a V operation is executed on a semaphore with a count of zero,a. if any processes are identified by the set associated with the semaphore, one of them isremoved from the set and moved from the blocked to the ready state; otherwise the countis incremented by 1.b. the process executing the V operation is moved from the running to the blocked state,and its identity is added to the set associated with the semaphore.c. None of the other answer choices is correct.19. Which of the semaphore operations, P or V, must be executed atomically?a. Both operations must be executed atomically.b. V must be executed atomically.c. Either all P or all V operations on a given semaphore must be executed atomically, but itmakes no different which operation is selected for atomic operation.CSCI 4500/8506 Page 4 Quiz 3 Practice Questions20. In the semaphore-based solution to the producer/consumer problem, both the producer andthe consumer processes use access to the shared buffer as a resource, and use it in amutually-exclusive manner by performing down and up operations on a semaphore namedmutex. What other resource do producer processes require if they are not going to beblocked?a. full locations in the buffer containing items previously producedb. empty locations in the buffer into


View Full Document
Download Study Guide
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Guide and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Guide 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?