Chapter 3: Processes Threads Resources Flashcards
\_\_\_\_ is a thread library for Solaris that maps many user-level threads to one kernel thread. A) Pthreads B) Green threads C) Sthreads D) Java threads
B- GREEN THREADS
Pthreads refers to ____.
A) the POSTFIX standard.
B) an implementation for thread behavior.
C) a specification for thread behavior.
D) an API for process creation and synchronization
C- A SPECIFICATION FOR THREAD BEHAVIOR
The \_\_\_\_ multithreading model multiplexes many user-level threads to a smaller or equal number of kernel threads. A) many-to-one model B) one-to-one model C) many-to-many model D) many-to-some model
C- MANY-TO-MANY MODEL
Cancellation points are associated with \_\_\_\_ cancellation. A) asynchronous B) deferred C) synchronous D) non-deferred
B- DEFERRED
Which of the following would be an acceptable signal handling scheme for a multithreaded program?
A) Deliver the signal to the thread to which the signal applies.
B) Deliver the signal to every thread in the process.
C) Deliver the signal to only certain threads in the process.
D) All of the above
D- ALL OF THE ABOVE
Signals can be emulated in windows through \_\_\_\_. A) asynchronous procedure calls B) local procedure calls C) remote procedure D) none of the above
A- ASYNCHRONOUS PROCEDURE CALLS
Thread-specific data is data that ____.
A) is not associated with any process
B) has been modified by the thread but not yet updated to the parent process
C) is generated by the thread independent of the thread’s process
D) is copied and not shared with the parent process
D- IS COPIED AND NOT SHARED W/THE PARENT PROCESS
LWP is ____.
A) short for lightweight processor
B) placed between system and kernel threads
C) placed between user and kernel threads
D) common in systems implementing one-to-one multithreading models
C- PLACED BETWEEN USER AND KERNEL THREADS (LIGHTWEIGHT PROCESS)
Windows XP uses the \_\_\_\_. A) one-to-one model B) many-to-one model C) one-to many-model D) many-to-many model
A- ONE-TO-ONE MODEL
In multithreaded programs, the kernel informs an application about certain events using a procedure known as a(n) \_\_\_\_. A) signal B) upcall C) event handler D) pool
B- UPCALL
Why should a web server not run as a single-threaded process?
For a web server that runs as a single-threaded process, only one client can be serviced at a time. This could result in potentially enormous wait times for a busy server.
List the four major categories of the benefits of multithreaded programming. Briefly explain each
The benefits of multithreaded programming fall into the categories: responsiveness, resource sharing, economy, and utilization of multiprocessor architectures. Responsiveness means that a multithreaded program can allow a program to run even if part of it is blocked. Resource sharing occurs when an application has several different threads of activity within the same address space. Threads share the resources of the process to which they belong. As a result, it is more economical to create new threads than new processes. Finally, a single threaded process can only execute on one processor regardless of the number of processors actually present. Multiple threads can run on multiple processors, thereby increasing efficiency
What are the two different ways in which a thread library could be implemented?
The first technique of implementing the library involves ensuring that all code and data structures for the library reside in user space with no kernel support. The other approach is to implement a kernel-level library supported directly by the operating system so that the code and data structures exist in kernel space
Describe two techniques for creating Thread objects in Java
One approach is to create a new class that is derived from the Thread class and to override its run() method. An alternative – and more commonly used – technique is to define a class that implements the Runnable interface. When a class implements Runnable, it must define a run() method. The code implementing the run() method is what runs as a separate thread
In Java, what two things does calling the start() method for a new Thread object accomplish?
Calling the start() method for a new Thread object first allocates memory and initializes a new thread in the JVM. Next, it calls the run() method, making the thread eligible to be run by the JVM. Note that the run() method is never called directly. Rather, the start() method is called, which then calls the run() method.