CS FundamentalsHardGATE CS · Amazon/Microsoft SDE MCQ
A thread library offers only kernel-level threads (one-to-one). Which change makes thread creation and switching cheapest without losing parallelism on multiple cores?
- A. Switching to a many-to-one model
- B. Using processes instead of threads
- C. Disabling preemption during switches
- D. A many-to-many (M:N) model
Correct answer: D. A many-to-many (M:N) model
M:N multiplexes many user threads onto several kernel threads, so most switches happen in user space while several kernel threads still run on different cores. Many-to-one is cheap but gives up parallelism and blocks on system calls.
More Operating Systems questions
- A program creates threads with for (i = 0; i < 4; i++) pthreadcreate(&t[i], NULL, work, &i); and each thread reads arg as its index. What…
- In a directory, ln data h and ln -s data s are run, and then mv data data2 renames the original within the same file system. What happens…
- What does it mean that the read() system call on a terminal is 'blocking', and what state does the process enter while no input is…
- Which statement about thrashing and the degree of multiprogramming is correct?
- Two threads acquire mutexes: T1 locks A then B; T2 locks B then A. Which change prevents deadlock while still letting both threads hold…
- A system uses demand paging with a 4 KB page, and a process allocates a fresh 1 MB zeroed buffer with mmap but touches only its first 10…