OSMid Exam SP 20
OSMid Exam SP 20
OSMid Exam SP 20
Submit your exam report including answers to the questions via email with subject OSMidExam
to: [email protected]
Due by April 7, 2017
1. Which of the following items are shared across multiple threads belonging to the same
process?
A) code, data, files
B) registers
C) stack
D) all of the above
2. In a multithreaded server architecture, which of the following is used to service a new user
request?
A) a new created thread
B) a new created process
C) the same process for prior users
D) none of the above
4. Which of the following refers to the capability to allow multiple tasks make progress on a
single processor system?
A) concurrency
B) parallelism
C) data parallelism
D) task parallelism
5. ___________ is a formula that identifies potential performance gains from adding additional
computing cores to an application that has a parallel and serial component.
A) Task parallelism
B) Data parallelism
C) Data splitting
D) Amdahl's Law
1
6. _____ is not considered a challenge when designing applications for multicore systems.
A) Deciding which activities can be run in parallel
B) Ensuring there is a sufficient number of cores
C) Determining if data can be separated so that it is accessed on separate cores
D) Identifying data dependencies between tasks.
7. Which of the following models are possible for the relationship between the user threads and
kernel threads?
A) many-to-one model
B) one-to-one model
C) many-to-many model
D) two-level model
E) all of the above
8. ____ 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
9. The _____ model maps each user-level thread to one kernel thread.
A) many-to-many
B) two-level
C) one-to-one
D) many-to-one
10. The _____ model multiplexes many user-level threads to a smaller or equal number of kernel
threads.
A) many-to-many
B) two-level
C) one-to-one
D) many-to-one
11. Which of the following is a function that can be provided by Pthreads API for constructing a
multithreaded program?
A) pthread attr init
B) pthread_create
C) pthread_join
D) all of the above
2
13. The most common technique for writing multithreaded Java programs is _____.
A) extending the Thread class and overriding the run() method
B) implementing the Runnable interface and defining its run() method
C) designing your own Thread class
D) using the CreateThread() function
15. Which of the following options exist to deliver signals in 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 certain threads in the process
D) assign a specific thread to receive all signals for the process
E) all of the above
16. Which of the following options to deliver signals in multithreaded program should be applied
to an asynchronous signal that terminates a process (<control><C>, for example)?
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 certain threads in the process
D) assign a specific thread to receive all signals for the process
E) all of the above
17. Which of the following options to deliver signals in multithreaded program should be applied
to a synchronous signal?
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 certain threads in the process
D) assign a specific thread to receive all signals for the process
E) all of the above
18. To associate each thread created using an implicit technique such as a thread pool, with its
unique transaction identifier, we could use ____?
A) global variable
B) local variable
C) static data
D) thread-local storage
3
C) placed between user and kernel threads
D) common in systems implementing one-to-one multithreading models
21. Which of the following information is shared when the flag CLONE_VM in Linux clone()
system call is set up?
A) file-system information
B) memory space
C) signal handlers
D) set of open files
23. Which of the following circumstances can cooperative scheduling take place?
A) when a process switches from the running state to the waiting state
B) when a process switches from the running state to the ready state
C) when a process switches from the waiting state to the ready state
D) none of the above
24. Which of the following circumstances can preemptive scheduling take place?
A) when a process switches from the running state to the waiting state
B) when a process switches from the waiting state to the ready state
C) when a process terminates
D) none of the above
25. Which of the following items does not belong to the function of a dispatcher?
A) switching context from one process to another
B) selecting a process among the available ones in the ready queue
C) switching to user mode
D) jumping to the proper location in the user program to resume that program
26. Assume process P0 and P1 are the process before and after a context switch, and PCB0 and
PCB1 are respectively their process control block. Which of the following time units are included
inside the dispatch latency?
A) P0 executing
4
B) save state into PCB0, and restore state from PCB1
C) P1 executing
D) all of the above
27. Which of the following criteria is more important for an interactive system?
A) CPU utilization
B) Response time
C) Turnaround time
D) Throughput
28. Which of the following criteria is more important from the point of view of a particular
process?
A) CPU utilization
B) Response time
C) Turnaround time
D) Throughput
30. Which of the following scheduling algorithm may suffer from convoy effect?
A) SJF
B) FCFS
C) RR
D) Multilevel queue
32. I/O-bound program typically has many short ______ and a CPU-bound program might have
a few long __________.
A) I/O burst, CPU burst
B) I/O burst, I/O burst
C) CPU burst, CPU burst
D) CPU burst, I/O burst
33. The ______ occurs in first-come-first-served scheduling when a process with a long CPU
burst occupies the CPU.
A) dispatch latency
5
B) waiting time
C) convoy effect
D) system-contention scope
34. Which of the following scheduling algorithms gives the minimum average waiting time for a
given set of processes?
A) SJF
B) FCFS
C) RR
D) Multilevel queue
36. Which of the following scheduling algorithms gives the minimum average response time?
A) SJF
B) FCFS
C) RR
D) Multilevel queue
38. If the time quantum get too large, RR scheduling degenerates to __________?
A) SJF
B) FCFS
C) Shortest-remaining-time-first
D) Multilevel queue
39. Which of the following can be a solution to the problem of indefinite blockage of low-
priority processes?
A) Aging
B) Starvation
C) Multilevel queue
D) All of the above
6
C) interactive processes
D) batch processes
44. Which of the following POSIX API sets the scheduling policy?
A) pthread_attr_getsched_policy
B) pthread_attr_setsched_policy
C) pthread_attr_getscope
D) pthread_attr_setscope
(b) List the four major categories of the benefits of multithreaded programming. Briefly
explain each.
(d) Multicore systems present certain challenges for multithreaded programming. Briefly
describe these challenges.
(f) What are the two different ways in which a thread library could be implemented?
7
(h) What role does the dispatcher play in CPU scheduling?
(i) Explain the difference between response time and turnaround time. These times are both
used to measure the effectiveness of scheduling schemes.
(j) Explain the process of starvation and how aging can be used to prevent it.
(k) What effect does the size of the time quantum have on the performance of an RR
algorithm?
(l) Explain the fundamental difference between asymmetric and symmetric multiprocessing.
(a) Consider the set of processes shown in the table above, with the length of the CPU-burst
time given in milliseconds. The processes are assumed to have arrived in the order P1, P2
P3 , P4 , and P5, all approximately at time 0. Draw three Gantt charts illustrating the
execution of these processes using FCFS, round-robin (quantum size = 5), and a non-
preemptive priority (a smaller priority number implies a higher priority) scheduling.
Calculate average waiting time of each scheduling.
(b) What is convoy effect?
(c) Explain the difference multilevel queue scheduling and multilevel feedback queue
scheduling