سوال ۹۶ کنکور ارشد مهندسی کامپیوتر ۱۴۰۳
کدامیک از موارد زیر، درست است؟
الف ـ تعویض متن میان دو نخ سطح هسته، سربار یکسانی با تعویض متن میان دو نخ سطح کاربر ندارد.
ب ـ نخهای سطح کاربر در بالای هسته و بدون پشتیبانی هسته کنترل میشوند.
ج ـ یک نخ میتواند همزمان بر روی چندین متغیر شرطی مسدود شود.
پاسخ صحیح: گزینهٔ C — «الف» ـ «ب»
Evaluate each statement about user-level vs kernel-level threads and condition variables.
Statement A — TRUE. Switching between two kernel-level threads requires a trap into the kernel (mode switch) and goes through the kernel scheduler, whereas switching between two user-level threads is performed entirely in user space by the thread library, with no kernel involvement. Hence their overheads are not equal — kernel-thread switches are more expensive. The statement asserts they do not have the same overhead, which is correct.
Statement B — TRUE. User-level threads are implemented by a thread library that runs above the kernel, in user space. The kernel is unaware of them and provides no support; scheduling and management happen purely in user space. This is the defining property of user-level (many-to-one) threading.
Statement C — FALSE. When a thread executes on a condition variable, it releases the associated monitor lock and is suspended on that one condition variable's queue. A thread is a single, sequential flow of control, so at any instant it sits on exactly one wait queue — it cannot be simultaneously blocked on several condition variables.
Therefore the correct statements are A and B, which is option 3.
Pitfall: Statement A uses a double negative ("does not have the same overhead"). Read it as "the overheads differ" — which is true — rather than misreading it as a false claim.