1 / 14

Exam 2 Solution

Exam 2 Solution. 1) Which of the following is true regarding the relationship between processes and threads: A) It takes less time to terminate a process than a thread B) It takes far less time to create a new thread in an existing process than to create a new process

didina
Télécharger la présentation

Exam 2 Solution

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exam 2 Solution

  2. 1) Which of the following is true regarding the relationship between processes and threads: A) It takes less time to terminate a process than a thread B) It takes far less time to create a new thread in an existing process than to create a new process C) It takes less time to switch between two different processes than to switch between two threads within the same process D) All of the above

  3. 2) One of the disadvantages of User-Level Threads (ULTs) compared to Kernel-Level Threads (KLTs) is: A) When a ULT executes a system call, all threads in the process are blocked B) Thread switching does not require kernel mode privileges C) Scheduling is application specific D) All of the above

  4. 3) Concurrency plays a major part in which of the following specific contexts:A) Structured applications B) Multiple applications C) OS structure D) All of the above

  5. Problem 4.10 4) The following requirement must be met by any facility or capability that is to provide support for mutual exclusion A) No assumptions can be made about relative process speeds B) A process remains in its critical code section for a finite time only C) Only one process at a time can be allowed into a critical code section D) All of the above

  6. 5) A semaphore that does not specify the order in which processes are removed from the queue is called a: A) Weak semaphore B) Binary semaphore C) Strong semaphore D) None of the above

  7. 6) A chief characteristic of a monitor is: A) A process enters the monitor by invoking one of its procedures B) A maximum of two processes may be executing in a monitor at a time C) Local data variables of the monitor are accessible by any procedure requesting use of the monitor D) All of the above

  8. 7) In synchronization involving message passing, the sender of a message can be: A) Only non-blocking B) Either blocking or non-blocking C) Only blocking D) All of the above

  9. 8) In a system employing message passing, when a message is sent to a shared temporary data structure, this general approach is known as: A) Direct addressing B) Blocking C) Indirect Addressing D) None of the above

  10. 9) In a system employing message passing, the typical message is divided into two primary sections: A) Destination ID and Source ID B) Body and mailbox C) Header and mailbox D) None of the above Correct answer should have been: Destination and message for send; Source and message for receive

  11. 10) The Reader/Writer problem requires that certain conditions be satisfied, such as: A) Multiple writers may write to the file simultaneously B) Any number of readers may simultaneously read from the file C) Readers may read from the file while writers are writing to it D) None of the above

  12. 11) A reason why the Producer/Consumer problem cannot be considered a special case of the Reader/Writer problem with a single writer (the producer) and a single reader (the consumer) is: A The consumer must perform writes while the reader performs reads B) The Producer/Consumer problem doesn't deal with concurrency issues C) The producer and consumer must be both reader and writer D) None of the above

  13. 12) In an operating system, the unit of dispatching is usually referred to as a thread, while the unit of resource ownership is usually referred to as a process or task. 13) The basic form of communication between processes or threads in a microkernel O/S is message passing. 14) The basic requirement for support of concurrent process is the ability to enforce mutual exclusion. 15) The situation where Process 1 (P1) holds Resource 1 (R1), while P2 holds R2, and P1 needs R2 to complete and P2 needs R1 to complete is referred to as deadlock. 16) When only one process is allowed in its critical code section at a time, then mutual exclusion is enforced. 17. In multiprocessor configurations, special machine instructions that carry out two actions in a single instruction cycle are said to do so atomically. 18. A semaphore whose definition includes the FIFO policy for releasing blocked processes from the queue is called a strong semaphore.

  14. 19. The general solution of the bounded-buffer producer-consumer problem given in class utilizes three semaphores. Without giving code (or pseudo-code) for the solution to the problem, identify the three semaphores by identifying their use in the solution. In particular, what does the integer value associated with each semaphore represent? s : controls access to the buffer n: number of items in the buffer; used to prevent consumer from accessing an empty buffer e : number of empty slots in the buffer; used to prevent the producer from accessing a full buffer.

More Related