📚 Operating Systems
Chapter 4: Threads & Concurrency
Comprehensive Examination
Course Code
CS 330
Duration
120 Minutes
Total Marks
70 Marks
Total Questions
50 Questions
Section 1: Thread Overview & Motivation (10 marks)
Q1
[1 mark]
A thread is best described as:
a) A process
b) A basic unit of CPU utilization
c) A memory segment
d) An I/O operation
Q2
[1 mark]
Which of the following is NOT shared by threads? (From old exam)
a) Program counter
b) Stack
c) Both (a) and (b)
d) None of the mentioned
Q3
[3 marks]
What comprises a thread? What does it share with other threads in the same process?
Q4
[1 mark]
Most modern applications are:
a) Multithreaded
b) Single-threaded
c) Non-threaded
d) Process-based only
Q5
[4 marks]
List and explain the FOUR benefits of multithreaded programming.
Section 2: Multicore Programming (12 marks)
Q6
[3 marks]
Explain the difference between concurrency and parallelism. Give an example of each.
Q7
[1 mark]
On a single-core system with multithreading, execution is:
a) Concurrent (interleaved)
b) Parallel (simultaneous)
c) Both concurrent and parallel
d) Neither concurrent nor parallel
Q8
[2 marks]
What is data parallelism? Give an example.
Q9
[2 marks]
What is task parallelism? Give an example.
Q10
[4 marks]
List and briefly describe FOUR challenges in programming for multicore systems.
Section 3: User and Kernel Threads (10 marks)
Q11
[4 marks]
What is the difference between user threads and kernel threads? List advantages and disadvantages of each.
Q12
[1 mark]
User-level threads are managed by:
a) The operating system kernel
b) A user-level threads library
c) The hardware
d) The file system
Q13
[1 mark]
If the kernel is single threaded, then any user-level thread performing a blocking system call will: (From old exam)
a) Cause the entire process to run along with the other threads
b) Cause the thread to block with the other threads running
c) Cause the entire process to block even if the other threads are available to run
d) None of these
Q14
[1 mark]
(True/False - From old exam) In a multi-processor system kernel threads cannot execute concurrently.
a) False
b) True
Q15
[3 marks]
Name THREE examples of thread libraries mentioned in the textbook.
Section 4: Multithreading Models (18 marks)
Q16
[4 marks]
Describe the Many-to-One threading model. What are its advantages and disadvantages?
Q17
[1 mark]
In the many-to-one model, multiple threads cannot run in parallel on multiprocessors because:
a) User threads are too slow
b) The OS prevents it
c) All user threads map to a single kernel thread
d) Hardware limitations
Q18
[4 marks]
Describe the One-to-One threading model. What are its advantages and disadvantages?
Q19
[1 mark]
Which operating systems use the one-to-one model?
a) Old UNIX systems
b) Windows and Linux
c) Solaris prior to version 9
d) No modern systems
Q20
[4 marks]
Describe the Many-to-Many threading model. What are its advantages?
Q21
[1 mark]
Which system historically used the many-to-many model?
a) Solaris prior to version 9
b) Windows 10
c) Modern Linux
d) Mac OS X
Q22
[3 marks]
What is the Two-Level model? How does it differ from the many-to-many model?
Section 5: Threading Issues (12 marks)
Q23
[2 marks]
What is the difference between asynchronous cancellation and deferred cancellation?
Q24
[1 mark]
Which cancellation method is safer?
a) Asynchronous cancellation
b) Deferred cancellation
c) Both are equally safe
d) Neither is safe
Q25
[3 marks]
Explain the difference between synchronous and asynchronous signals. Give an example of each.
Q26
[3 marks]
What are THREE options for delivering signals in a multithreaded program?
Q27
[1 mark]
Thread-local storage (TLS) is:
a) Shared among all threads
b) Unique to each thread
c) Stored in the kernel
d) The same as global variables
Q28
[1 mark]
Scheduler activations provide:
a) Downcalls from thread library to kernel
b) Direct CPU scheduling
c) Upcalls from kernel to thread library
d) Automatic thread creation
Q29
[1 mark]
LWP (Lightweight Process) is:
a) Another name for a thread
b) A type of kernel
c) An intermediate data structure between user and kernel threads
d) A scheduling algorithm
Section 6: Thread Scheduling (8 marks)
Q30
[4 marks]
Explain the difference between Process-Contention Scope (PCS) and System-Contention Scope (SCS).
Q31
[1 mark]
PCS (Process-Contention Scope) involves competition:
a) Among threads within the same process
b) Among all threads in the system
c) Among all processes
d) Between different CPUs
Q32
[1 mark]
SCS (System-Contention Scope) involves competition:
a) Among threads within the same process
b) Among all threads in the system
c) Only among kernel threads
d) Only among user threads
Q33
[1 mark]
Systems with many-to-many model use:
a) Only SCS
b) PCS for user threads to LWPs
c) No scheduling
d) Round-robin only
Q34
[1 mark]
Systems with one-to-one model use:
a) Only PCS
b) SCS (kernel schedules threads onto CPUs)
c> Both PCS and SCS
d) Neither PCS nor SCS
Section 7: Implicit Threading & Applications (Bonus: 10 marks)
Q35
[3 marks]
Describe how a multithreaded web server works. Why is multithreading beneficial for web servers?
Q36
[3 marks]
Describe three separate threads that might be used in a word processor application.
Q37
[3 marks]
What is a thread pool? What are THREE benefits of using thread pools?
Q38
[1 mark]
Implicit threading means:
a) Threading is handled by compilers and libraries, not the programmer
b) Threads are created automatically by the OS
c) No threading is used
d) All threads are hidden from the user
Q39
[Bonus 3 marks]
What is OpenMP? How does it simplify parallel programming?
Q40
[Bonus 3 marks]
Compare how Windows and Linux represent threads. What data structures are used?
Q41
[Bonus 4 marks]
A programming task can be divided into four subtasks: A, B, C and D. (From old exam)
(i) How many threads should you create in your program for maximum gains on a four-processor CPU if the subtasks are independent of each other?
(ii) How many if C is dependent on B and D is dependent on A?
Q42
[Bonus 3 marks]
Why should we have multiple threads? Why not multiple processes? Give at least TWO reasons. (From old exam)
Q43
[1 mark]
Which of the following statements are true for threads? (From old exam)
a) Require less time to create
b) Defines a single sequential execution stream
c) Both (a) and (b)
d) It takes longer to context-switch between them
Q44
[1 mark]
One of the disadvantages of User-Level Threads (ULTs) compared to Kernel-Level Threads (KLTs) is: (From old exam)
a) Scheduling is application specific
b) When a ULT executes a system call, all threads in the process are blocked
c) Thread switching does not require kernel mode privileges
d) None of the above
Q45
[Bonus 3 marks]
Explain Grand Central Dispatch (GCD) used in Apple's macOS and iOS systems.
Q46
[Bonus 3 marks]
What are fork() and exec() semantics in a multithreaded program? Does fork() duplicate all threads?
Q47
[Bonus 4 marks]
Discuss the benefits and challenges of designing multithreaded applications for modern multicore systems.
Q48
[1 mark]
Creating a thread in Solaris is approximately how much faster than creating a process?
a) 30 times faster
b) 5 times faster
c) Same speed
d) Slower
Q49
[Bonus 3 marks]
Explain what Java threads are and how they are implemented across different platforms.
Q50
[Bonus 4 marks]
Compare and contrast processes and threads. When would you use one versus the other?
📝 Submit Exam
Exam Results