Question 71
HardWhat is a thread pool used for?
- A.
Reusing a fixed set of threads for many tasks, avoiding the cost of creating a thread per task
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Operating Systems
What is a thread pool used for?
Reusing a fixed set of threads for many tasks, avoiding the cost of creating a thread per task
Making threads sequential
Running threads on GPUs only
Storing deleted threads
Sign up free to see the answer and a step-by-step explanation.
Which inter-process communication method lets two processes exchange data with the least copying?
Message queues
Shared memory
Pipes
Sockets
Sign up free to see the answer and a step-by-step explanation.
What is a pipe in Unix?
A kind of file permission
A one-way byte stream between processes, typically a parent and child
A network connection
A shared memory region
Sign up free to see the answer and a step-by-step explanation.
A context switch takes 5 μs and the time slice is 95 μs. What fraction of CPU time is spent on switching?
0.5%
10%
95%
5%
Sign up free to see the answer and a step-by-step explanation.
Which transition is NOT possible in the standard five-state process model?
Waiting → Running directly
Waiting → Ready
Running → Ready
Ready → Running
Sign up free to see the answer and a step-by-step explanation.
Why are user-level threads faster to create than kernel threads?
No system call or kernel data structure is needed
They cannot block
They run in kernel mode
They use less stack space only
Sign up free to see the answer and a step-by-step explanation.
Two threads each read a shared balance of ₹1,000, subtract ₹200 and write the result back, with no locking. Which final balances are possible?
Only ₹600
₹600 or ₹800
Only ₹800
₹400 or ₹600
Sign up free to see the answer and a step-by-step explanation.
What does pthread_join() do?
Kills a thread
Waits for a particular thread to finish
Joins two processes into one
Creates a new thread
Sign up free to see the answer and a step-by-step explanation.
A program runs 4 threads on a 2-core CPU. At most how many of them can execute instructions at the same instant?
4
2
1
8
Sign up free to see the answer and a step-by-step explanation.
Which statement about simultaneous multithreading (hyper-threading) is true?
It disables caches
It doubles the number of physical cores
It runs one thread on two cores at once
One physical core runs two hardware threads that share its execution units
Sign up free to see the answer and a step-by-step explanation.