1.
The difference between a program and a process is that a program is an active entity while a process is a passive entity.
Correct Answer
B. False
Explanation
The explanation for the given correct answer, which is False, is that the statement is incorrect. The difference between a program and a process is not that a program is an active entity while a process is a passive entity. In fact, it is the opposite. A program is a passive entity that resides on a storage device, while a process is an active entity that is created when a program is loaded into memory and executed. Therefore, the correct answer is False.
2.
The single benefit of a thread pool is to control the number of threads.
Correct Answer
B. False
Explanation
A thread pool does not only control the number of threads, but it also provides a way to manage and reuse threads efficiently. Instead of creating a new thread for each task, a thread pool maintains a pool of pre-initialized threads that can be assigned to different tasks. This eliminates the overhead of thread creation and destruction, resulting in improved performance and resource management. Therefore, the given statement is false.
3.
When a child process is created, which of the following is a possibility in terms of the execution or address space of the child process?
Correct Answer
D. All of the above
Explanation
When a child process is created, it is possible for the child process to have a new program loaded into it. This means that the child process can start executing a different program than the parent process. Additionally, the child process can run concurrently with the parent process, meaning that both processes can execute simultaneously. Lastly, the child process can be a duplicate of the parent process, which means that it inherits the same code, data, and resources from the parent process. Therefore, all of the given statements are possibilities in terms of the execution or address space of the child process.
4.
A process control block ____.
Correct Answer
C. Includes information on the process's state
Explanation
A process control block includes information on the process's state. This means that it contains details about the current status of the process, such as the values of its registers, the priority level, the program counter, and other relevant information. This information is crucial for the operating system to manage and control the execution of processes effectively. By having access to the process's state, the operating system can make informed decisions about scheduling, resource allocation, and process management.
5.
A ____ provides an API for creating and managing threads
Correct Answer
B. Thread library
Explanation
A thread library provides an API for creating and managing threads. This library includes various functions and methods that allow programmers to create, start, pause, resume, and terminate threads. It also provides synchronization mechanisms like locks, semaphores, and condition variables to ensure proper coordination and communication between threads. By using a thread library, developers can easily implement multithreading in their applications without having to directly deal with low-level system calls or the complexities of managing threads at the operating system level.
6.
A _____ uses an existing thread — rather than creating a new one — to complete a task.
Correct Answer
C. Thread pool
Explanation
A thread pool is a mechanism that uses an existing thread, rather than creating a new one, to complete a task. It allows for efficient management and reuse of threads, reducing the overhead of creating and destroying threads for each task. By using a thread pool, tasks can be assigned to available threads, improving performance and resource utilization.
7.
A thread is composed of a thread ID, program counter, register set, and heap.
Correct Answer
B. False
Explanation
A thread is not composed of a heap. A thread is a lightweight process that consists of a thread ID, program counter, and register set. The heap, on the other hand, is a region of memory used for dynamic memory allocation. Therefore, the statement that a thread is composed of a thread ID, program counter, register set, and heap is false.
8.
The ____ multithreading model multiplexes many user-level threads to a smaller or equal number of kernel threads.
Correct Answer
B. Many-to-many model
Explanation
The many-to-many multithreading model allows for the mapping of many user-level threads to an equal or smaller number of kernel threads. This model provides flexibility and efficiency by allowing multiple user-level threads to be executed concurrently on multiple kernel threads. The mapping between user-level and kernel threads can be dynamically adjusted, allowing for better load balancing and resource utilization.
9.
It is possible to have concurrency without parallelism.
Correct Answer
A. True
Explanation
Concurrency refers to the ability of a system to execute multiple tasks simultaneously, while parallelism refers to the actual execution of those tasks simultaneously. In other words, concurrency is about managing multiple tasks at the same time, but not necessarily executing them simultaneously. Therefore, it is possible to have concurrency without parallelism, where tasks are managed and scheduled to run concurrently, but not necessarily executed in parallel.
10.
Virtually all contemporary operating systems support kernel threads.
Correct Answer
A. True
Explanation
The statement suggests that most modern operating systems have the capability to support kernel threads. This means that these operating systems can handle multiple tasks simultaneously by dividing them into smaller units of execution called threads. Kernel threads are managed by the operating system's kernel, which allows for efficient multitasking and resource sharing. Therefore, the given statement is true.
11.
A _________________ saves the state of the currently running process and restores the state of the next process to run.
Correct Answer
C. Context switch
Explanation
A context switch is the process of saving the current state of a running process and restoring the state of the next process to be executed. This allows the operating system to efficiently manage multiple processes by temporarily suspending one process and resuming another. During a context switch, the operating system saves the current process's state, including its program counter, registers, and other relevant data, and then loads the saved state of the next process to be executed. This ensures that each process can continue from where it left off, maintaining the illusion of concurrent execution.
12.
A process that has terminated, but whose parent has not yet called wait(), is known as a ________ process.
Correct Answer
C. Zombie
Explanation
A zombie process is a process that has terminated but still exists in the process table because its parent process has not yet called the wait() system call to retrieve its exit status. This can happen if the parent process has terminated or is not properly handling its child processes. Zombie processes do not consume system resources but can still occupy space in the process table until they are properly reaped by the parent process.
13.
For a single-processor system, there will never be more than one process in the Running state.
Correct Answer
A. True
Explanation
In a single-processor system, only one process can be executed at a time. The processor can only handle one instruction at a time and can only switch between processes through context switching. Therefore, it is true that there will never be more than one process in the Running state in a single-processor system.