Saturday, 24 August 2019

Processes and Threads (Quiz)

Question 1
The list of processes waiting for a particular I/O device is called a(n) ____.
  1. standby queue
  2. device queue
  3. ready queue
  4. interrupt queue
Solution: device queue

Question 2
A _________________ saves the state of the currently running process and restores the state of the next process to run.
  1. save-and-restore
  2. state switch
  3. context switch
  4. process control block
Solution: context switch

Question 3
The ____ of a process contains temporary data such as function parameters, return addresses, and local variables. 
  1. text section
  2. data section
  3. program counter
  4. stack 
 Solution: stack

Question 4
A process that has terminated, but whose parent has not yet called wait(), is known as a ________ process. 
  1. zombie
  2. orphan
  3. terminated
  4. init 
 Solution: zombie

Question 5
The _______ process is assigned as the parent to orphan processes.
  1. zombie
  2. init
  3. main
  4. renderer 
 Solution: init

Question 6
Which of the following statements is true?
  1.  Shared memory is typically faster than message passing.
  2. Message passing is typically faster than shared memory.
  3. Message passing is most useful for exchanging large amounts of data.
  4. Shared memory is far more common in operating systems than message passing. 
Solution: Shared memory is typically faster than message passing.

Question 7
A process control block ____.
  1. includes information on the process's state
  2. stores the address of the next instruction to be processed by a different process
  3. determines which process is to be executed next
  4. is an example of a process queue 
 Solution: includes information on the process's state

 Question 8
All processes in UNIX first translate to a zombie process upon termination.
  1. True
  2. False 
 Solution: True

Question 9
Child processes inherit UNIX ordinary pipes from their parent process because:
  1.  The pipe is part of the code and children inherit code from their parents.
  2. A pipe is treated as a file descriptor and child processes inherit open file descriptors from their parents.
  3. The STARTUPINFO structure establishes this sharing.
  4. All IPC facilities are shared between the parent and child processes. 
Solution: A pipe is treated as a file descriptor and child processes inherit open file descriptors from their parents.

Question 10
The _____________ refers to the number of processes in memory.
  1. process count
  2. long-term scheduler
  3. degree of multiprogramming
  4. CPU scheduler
Solution: degree of multiprogramming

Question 11
_____ is not considered a challenge when designing applications for multicore systems.
  1. Deciding which activities can be run in parallel
  2. Ensuring there is a sufficient number of cores
  3. Determining if data can be separated so that it is accessed on separate cores
  4. Identifying data dependencies between tasks.

Solution: Ensuring there is a sufficient number of cores

Question 12
Which of the following would not be an acceptable signal handling scheme for a
multithreaded program?
  1. Deliver the signal to the thread to which the signal applies.
  2. Deliver the signal to every thread in the process.
  3. Deliver the signal to only certain threads in the process.
  4. Do not deliver the signal to any of the threads in the process.
Solution: Do not deliver the signal to any of the threads in the process.

Question 13
The ____ multithreading model multiplexes many user-level threads to a smaller or equal number of kernel threads.
  1. many-to-one model
  2. one-to-one model
  3. many-to-many model
  4. many-to-some model
Solution: many-to-many model

Question 14
A _____ uses an existing thread — rather than creating a new one — to complete a task.
  1. lightweight process
  2. thread pool
  3. scheduler activation
  4. asynchronous procedure call
Solution: thread pool

Question 15
_________ involves distributing tasks across multiple computing cores.
  1. Concurrency
  2. Task parallelism
  3. Data parallelism
  4. Parallelism
Solution: Task parallelism

Question 16
A ____ provides an API for creating and managing threads.
  1. set of system calls
  2. multicore system
  3. thread library
  4. multithreading model
Solution: thread library

Question 17
Thread-local storage is data that ____.
  1. is not associated with any process
  2. has been modified by the thread, but not yet updated to the parent process
  3. is generated by the thread independent of the thread's process
  4. is unique to each thread
Solution: is unique to each thread

Question 18
Signals can be emulated in windows through ____.
  1. asynchronous procedure calls
  2. local procedure calls
  3. remote procedure calls
  4. synchronous procedure calls 
 Solution: asynchronous procedure calls

Question 19
Pthreads refers to ____.
  1. the POSIX standard.
  2. an implementation for thread behavior. 
  3. a specification for thread behavior.
  4. an API for process creation and synchronization. 
 Solution: a specification for thread behavior.

Question 20
According to Amdahl's Law, what is the speedup gain for an application that is 60% parallel and we run it on a machine with 4 processing cores? 
  1. 1.82
  2. 0.7
  3. 0.55
  4. 1.43 
 Solution: 1.43 

No comments:

Post a Comment