Threads Questions & Answers

Operating System Questions & Answers – Threads

This set of Operating System Multiple Choice Questions & Answers (MCQs) focuses on “Threads”.

1. The jacketing technique is used to ___________
a) convert a blocking system call into non blocking system call
b) create a new thread
c) communicate between threads
d) terminate a thread

2. Termination of the process terminates ___________
a) first thread of the process
b) first two threads of the process
c) all threads within the process
d) no thread within the process

3. Which one of the following is not a valid state of a thread?
a) running
b) parsing
c) ready
d) blocked

4. The register context and stacks of a thread are deallocated when the thread?
a) terminates
b) blocks
c) unblocks
d) spawns

5. Thread synchronization is required because ___________
a) all threads of a process share the same address space
b) all threads of a process share the same global variables
c) all threads of a process can share the same files
d) all of the mentioned

6. Which one of the following is not shared by threads?
a) program counter
b) stack
c) both program counter and stack
d) none of the mentioned

7. A process can be ___________
a) single threaded
b) multithreaded
c) both single threaded and multithreaded
d) none of the mentioned

8. If one thread opens a file with read privileges then ___________
a) other threads in the another process can also read from that file
b) other threads in the same process can also read from that file
c) any other thread can not read from that file
d) all of the mentioned

9. The time required to create a new thread in an existing process is ___________
a) greater than the time required to create a new process
b) less than the time required to create a new process
c) equal to the time required to create a new process
d) none of the mentioned

10. When the event for which a thread is blocked occurs?
a) thread moves to the ready queue
b) thread remains blocked
c) thread completes
d) a new thread is provided

A thread of execution is the smallest sequence of programmed instructions that a scheduler, which is usually part of the operating system, can handle independently. Threads and processes are implemented differently in different operating systems, although in most situations, a thread is a component of a process. Within a single process, many threads can run concurrently and share resources like memory, however distinct processes do not share these resources. At any given time, a process’ threads share its executable code as well as the values of its dynamically allocated variables and non-thread-local global variables.

Leave a Reply

Your email address will not be published. Required fields are marked *