🎓 BookMCQ
← Back to 4. Threads in Operating System

📝 Multicore programming in operating system (33 MCQs)

Multicore Processor Architecture and Parallel Execution

Multicore programming develops applications that divide work among multiple processing cores within a processor or computer system. Each core can execute an instruction stream independently, allowing separate threads to run simultaneously. Operating system process and thread schedulers distribute runnable work across available cores, while memory management and synchronisation facilities coordinate access to shared data and hardware resources.

Why Single-Core Execution Limits Parallel Workloads

A single processing core can execute only one instruction stream at a time, even when a program contains multiple independent tasks. Increasing clock frequency alone faces power and thermal limitations. Multicore systems provide additional execution resources, but applications must expose independent work and coordinate shared state to benefit from simultaneous processing.

Thread Distribution and Shared-Memory Coordination

An application divides work into threads that can execute independently. The operating system scheduler assigns runnable threads to available cores, while each core maintains its own execution state. Threads may access shared memory, requiring mutexes, atomic operations, or other synchronisation mechanisms. Cache-coherence hardware helps maintain memory consistency between processor caches according to the architecture.

Dividing Image Processing Across Four CPU Cores

Suppose an image contains 4,000 rows and must undergo the same independent filter operation on every row. Four worker threads can each process approximately 1,000 rows. If work is evenly distributed and memory access does not become a bottleneck, the operations can execute simultaneously, reducing elapsed processing time compared with a single-core execution.

Speedup, Core Utilisation, and Parallel Workload Limits

Multicore programming improves throughput for parallel workloads in scientific computing, rendering, databases, and media processing. However, sequential instructions, lock contention, memory bandwidth, and uneven workloads limit speedup. Amdahl's law estimates the maximum speedup for a fixed workload: with sequential fraction S and N cores, speedup is limited to 1 divided by S plus the parallel fraction divided by N.

Misconceptions About Multicore Execution

'Four cores guarantee four times the performance' is incorrect because sequential work and contention restrict speedup. 'The operating system automatically makes every program parallel' is incorrect because the application must expose suitable concurrent work. 'Separate cores never share hardware resources' is incorrect because cores may compete for memory bandwidth, caches, and other shared resources.

Exam Focus: Core Allocation and Parallel Speedup

Distinguish concurrency from simultaneous execution and explain how the scheduler distributes threads across cores. Practise applying Amdahl's law and identifying sequential and parallel portions of a workload. Questions may examine core utilisation, cache coherence, load balancing, synchronisation, and reasons why adding processors produces less than proportional performance gains.

Key Terms of Multicore Programming

  • Core - Independent processor execution unit.
  • Parallelism - Simultaneous execution of tasks.
  • Load balancing - Distributing work among processors.
  • Amdahl's law - Formula limiting parallel speedup.
  • Cache coherence - Maintaining consistent cached data.
  • Atomic operation - Indivisible shared-state operation.
11
Easy
11
Medium
11
Hard

📝 All Multicore programming in operating system MCQs

Q1. Which hardware arrangement enables a multicore processor to execute independent instruction streams at the same instant?

A.Several independent processing cores on one chip ✅
B.One core operating at a higher clock frequency
C.A larger shared memory with one execution unit
D.A single core with a longer instruction pipeline
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A multicore chip contains multiple independent processing cores. Each core has its own execution resources and can run a separate instruction stream, allowing simultaneous execution rather than relying only on time-sliced switching.

Q2. A single-core computer alternates between two runnable threads, while a two-core computer runs one thread on each core. Which statement distinguishes these cases?

A.Both cases provide hardware parallel execution
B.The single-core case is parallel, while the two-core case is only concurrent
C.The single-core case provides concurrency; the two-core case can provide parallel execution ✅
D.Neither case allows the threads to make progress during overlapping periods
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Concurrency means activities make progress over overlapping periods, even when one processor alternates between them. Parallelism is stricter: instructions from different execution paths run at the same instant on separate cores.

Q3. A program contains one ordinary software thread and is run on an eight-core processor. Why will that thread not normally use all eight cores simultaneously?

A.The operating system reserves seven cores for kernel code
B.One instruction stream has only one current execution path that can be scheduled on one core at a time ✅
C.The processor must copy the thread eight times before execution
D.A single thread can run only when all eight cores are idle
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Adding cores increases available hardware execution capacity, but it does not automatically divide one instruction stream into independent parts. A single software thread normally runs on one core at a time.

Q4. A video-encoding application has four independent worker threads and a processor with four available cores. What can the hardware provide when all workers are runnable?

A.Each worker must wait for the previous worker to finish
B.All workers share one program counter
C.The operating system converts the workers into separate applications
D.The four workers can execute simultaneously on different cores ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: When four independent threads are runnable and four cores are available, the scheduler can place one thread on each core. Their instructions can then execute simultaneously, subject to resource availability and scheduling decisions.

Q5. A processor has multiple cores, and each core can execute a different instruction stream on different data. Which architecture description best fits this organization?

A.MIMD ✅
B.SIMD
C.SISD
D.MISD
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: MIMD systems allow multiple processing units to execute different instruction streams on different data. This matches multicore processors running separate software threads, whereas SIMD applies one instruction across multiple data elements.

Q6. A numerical application applies the same addition operation to many independent array elements. Which hardware capability can process several elements with one instruction on a core?

A.Multiple process address spaces
B.Time slicing between unrelated threads
C.SIMD vector execution ✅
D.A separate operating-system kernel for every array element
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: SIMD vector instructions apply one operation to multiple data elements in a single instruction. A core can therefore process several array values together, complementing the parallel execution available across multiple cores.

Q7. A multithreaded application runs on a shared-memory multicore computer. Which statement describes the programming environment most accurately?

A.Each thread must use a separate physical memory module
B.Threads can access a common process address space while executing on different cores ✅
C.Each core runs a separate operating system process by definition
D.The cores cannot access the same data unless it is sent over a network
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: In a shared-memory multicore system, threads can access the same process address space even when different cores execute them. The common memory model simplifies communication, although it does not by itself coordinate conflicting updates.

Q8. A workload performs the same mathematical operation on millions of independent pixels. Why might a GPU be considered alongside a general-purpose multicore CPU?

A.A GPU is designed primarily for running one sequential control thread
B.A GPU replaces the operating system scheduler
C.A GPU guarantees lower latency for every type of application
D.A GPU can provide high throughput for large amounts of parallel data processing ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: GPUs contain many execution elements designed to process large amounts of parallel data. They can accelerate workloads such as image transformations, although irregular control-heavy tasks may suit general-purpose CPU cores better.

Q9. A batch program contains 20 independent jobs, each requiring 4 ms of CPU time. Five cores are available, and scheduling overhead is negligible. What is the ideal completion time?

A.16 ms ✅
B.20 ms
C.40 ms
D.80 ms
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Five cores can process five jobs in each wave. Twenty jobs require four waves, and each wave takes 4 ms, so the ideal completion time is 20/5×4=1620/5 \times 4 = 16 ms.

Q10. A parallel program completes a workload in 18 seconds on one core and 6 seconds on three cores. What speedup does the three-core execution achieve?

A.2 times
B.2.5 times
C.3 times ✅
D.6 times
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Speedup is the single-core execution time divided by the parallel execution time. Here, 18/6=318/6 = 3, so the three-core run is three times as fast overall for the measured workload.

Q11. A four-core application achieves a measured speedup of 3.2 relative to one core. What is its parallel efficiency?

A.60 percent
B.70 percent
C.75 percent
D.80 percent ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Parallel efficiency is speedup divided by the number of cores used. The calculation is 3.2/4=0.83.2/4 = 0.8, which corresponds to 80 percent efficiency for the measured parallel execution in this configuration.

Q12. A student predicts that a program with 20 percent serial work and 80 percent parallel work will become four times faster on four cores. Using Amdahl reasoning, what is the correct ideal speedup?

A.2.5 times ✅
B.3.2 times
C.3.5 times
D.4 times
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The flawed step is assuming the entire program is parallel. The correct calculation is 1/(0.2+0.8/4)=1/0.4=2.51/(0.2 + 0.8/4) = 1/0.4 = 2.5, because the serial portion remains unchanged under the stated ideal conditions.

Q13. A multicore computer has six runnable software threads and four available cores. Which statement best describes the operating system scheduler role?

A.It must permanently assign every thread to a different core
B.It can select runnable threads for the available cores and time-share cores when needed ✅
C.It combines all six threads into one instruction stream
D.It makes all six threads execute simultaneously by increasing the clock frequency
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The scheduler selects runnable threads and maps them onto available processing cores. With more runnable threads than cores, some threads must wait or be time-sliced; hardware cannot execute all six simultaneously on four cores.

Q14. A developer is adapting a sequential simulation for a multicore processor. Which first step is most useful for exposing parallel execution?

A.Increase the clock speed assumed by the program
B.Duplicate the entire application process for every data item
C.Identify portions of work that can proceed independently and represent them as concurrent tasks ✅
D.Remove all intermediate results from memory
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Parallel execution requires independent or suitably coordinated work that can be assigned to different cores. Identifying such work is a necessary design step; adding cores alone does not create parallel tasks inside sequential code.

Q15. A rendering program has 12 independent frames to process. Each frame requires 5 ms of CPU time, and three cores are available. Assuming perfect distribution and no overhead, how long will the frames take?

A.15 ms
B.20 ms ✅
C.35 ms
D.60 ms
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Three cores can process three frames during each 5 ms wave. Twelve frames require 12/3=412/3 = 4 waves, so the ideal elapsed time is 4×5=204 \times 5 = 20 ms.

Q16. A benchmark reports core count and speedup as follows: (1, 1.0) ; (2, 1.8) ; (4, 3.1) ; (6, 4.0) ; (8, 4.5). Which trend is most clearly shown?

A.Speedup remains fixed after the second core
B.Speedup grows exactly in proportion to core count
C.Speedup decreases whenever another core is added
D.Speedup increases, but each additional group of cores produces a smaller gain ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The measured speedup rises from 1.0 to 4.5, but gains become smaller as more cores are added. This is diminishing return rather than linear scaling, often because some work cannot execute in parallel.

Q17. A multicore benchmark reports core count and throughput in jobs per second: (1, 100) ; (2, 190) ; (3, 270) ; (4, 340) ; (5, 345). At which point does the data first show a clear approach to saturation?

A.At four cores, because the gain from four to five cores is only five jobs per second ✅
B.At two cores, because throughput is below 200 jobs per second
C.At three cores, because throughput is not an exact multiple of 100
D.At five cores, because that is the largest measured core count
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Throughput increases by 70 jobs per second from three to four cores, but only five from four to five. The sharp reduction in marginal gain indicates that the workload is approaching its throughput limit.

Q18. A student claims that four runnable threads on a two-core processor can all execute instructions simultaneously because they belong to one multithreaded process. What is the correction?

A.A process can run only one thread regardless of core count
B.Four threads require four separate processes
C.At most two of these threads can execute at one instant; the others must wait or be time-sliced ✅
D.All four threads execute simultaneously by sharing each core instruction cycle
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The flawed step is confusing the number of threads with the number of physical execution cores. With two cores, at most two software threads execute simultaneously; the remaining runnable threads await scheduling.

Q19. A developer runs an unchanged single-threaded program on a processor with twice as many cores and expects its execution time to be halved. Which assumption is incorrect?

A.The processor clock frequency is unchanged
B.The program automatically gains two independent instruction streams ✅
C.A single thread can issue instructions to only one core at a time
D.Additional cores may help other runnable work
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The incorrect assumption is that extra cores automatically parallelize serial code. Without dividing the workload into concurrent execution paths, the single thread remains bound to one core and gains no direct multicore speedup.

Q20. An image-processing program divides an array into four disjoint regions and uses four cores. Each core also applies a vector instruction to several values in its assigned region. Which combination is being used?

A.Only time-sharing, because each core processes multiple values
B.Only process-level concurrency, because the array has four regions
C.SIMD across the entire chip without multicore execution
D.Parallel work across cores together with SIMD operations within each core ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: The regions can run simultaneously on separate cores, while each core uses a vector instruction on several values in its own region. This combines multicore execution with SIMD-level parallelism within a core.

Q21. Two worker threads run on separate cores and read different portions of one shared array. Which design choice lets them use the same array without copying it into separate process address spaces?

A.Both threads belong to a process with a shared address space ✅
B.Each thread runs under a separate operating system
C.The array is transferred over a network before each read
D.The scheduler merges their private address spaces at dispatch time
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Threads in one process share the same virtual address space, so each can access its assigned array region directly. Separate processes would generally need an explicit sharing or data-transfer arrangement.

Q22. A student classifies a system as SIMD because four cores execute four different programs on four different data sets. Which correction is accurate?

A.SIMD means one program executes on one core only
B.The system is MIMD because cores execute different instruction streams on different data ✅
C.The system is SISD because the operating system schedules the cores
D.The system is MISD because each core has private registers
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The classification is wrong because SIMD applies the same instruction across multiple data elements. Different cores running different programs on different data sets match the MIMD execution model on a multicore processor.

Q23. A mobile processor combines high-performance cores with power-efficient cores. Why is this heterogeneous multicore design useful?

A.It ensures every task receives identical execution speed
B.It removes the need for operating-system scheduling
C.It allows performance-sensitive and energy-sensitive work to use different core types ✅
D.It requires all threads to migrate between cores after every instruction
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Heterogeneous processors provide cores with different performance and energy characteristics. The system can place demanding work on faster cores and less urgent work on efficient cores, balancing responsiveness with energy consumption.

Q24. A graphics workload applies the same color adjustment to 10 million independent pixels. Which execution platform is most likely to offer high throughput for this workload?

A.A single-core processor running one sequential instruction stream
B.A disk controller with multiple request queues
C.A CPU core dedicated only to keyboard input
D.A GPU designed for large-scale data-parallel computation ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: The pixel operations are numerous and largely independent, making them suitable for a throughput-oriented GPU. Such processors execute many similar operations in parallel, while a general-purpose CPU remains useful for control-heavy work.

Q25. A parallel program has a serial fraction of 10 percent and a parallel fraction of 90 percent. According to Amdahl reasoning, what is the maximum possible speedup as the number of cores approaches infinity?

A.10 times ✅
B.9 times
C.90 times
D.100 times
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: As core count approaches infinity, the parallel portion takes negligible time, but the serial 10 percent remains. The upper bound is therefore 1/0.10=101/0.10 = 10, regardless of additional cores under these assumptions.

Q26. A developer uses an OpenMP parallel-for construct on a loop whose iterations are independent. What is the intended multicore effect?

A.The loop is converted into a single sequential process
B.The compiler removes the loop condition
C.The runtime can distribute loop iterations among a team of threads ✅
D.Each iteration is assigned its own physical processor permanently
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: An OpenMP parallel-for construct expresses that independent loop iterations may execute concurrently. The compiler and runtime create or use a thread team and distribute iterations, subject to loop dependencies and runtime configuration.

Q27. A processor exposes four logical CPUs through simultaneous multithreading, but those logical CPUs belong to two physical cores. A student assumes this is identical to having four independent physical cores. What is the error?

A.Logical CPUs never execute separate hardware threads
B.Two physical cores cannot expose more than two logical CPUs
C.Simultaneous multithreading disables all parallel execution
D.Logical CPUs share execution resources within physical cores, so they are not equivalent to four independent cores ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: The assumption ignores shared physical resources. Simultaneous multithreading exposes multiple hardware-thread contexts per core, but those contexts may compete for execution units and caches rather than behaving like separate physical cores.

Q28. A program has 90 percent parallel work and 10 percent serial work. What ideal speedup should be expected on eight cores, ignoring overhead?

A.8.0 times
B.About 4.71 times ✅
C.About 7.2 times
D.10 times
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Amdahl calculation is 1/(0.10+0.90/8)=1/0.21251/(0.10 + 0.90/8) = 1/0.2125, which is approximately 4.71. The serial fraction limits the gain even when eight cores are available without extra overhead in this idealized eight-core case.

Q29. A developer says that a multicore processor automatically turns a conventional sequential loop into parallel work whenever several cores are idle. Which statement best corrects this claim?

A.The operating system can split any loop without inspecting its dependencies
B.Idle cores execute duplicate copies of the same thread
C.Parallel execution requires software or compiler support to expose independent work ✅
D.A sequential loop always uses every core through cache sharing
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Idle cores do not reveal which iterations are independent or how results should be combined. The program or its compiler must expose safe parallel work before the scheduler can distribute it across cores.

Q30. A server has four cores and uses one thread per core for a workload with independent requests. A request arrives while all four threads are busy. What can the operating system do?

A.Queue the request or schedule it when a worker becomes available ✅
B.Execute the new request simultaneously on all four busy cores
C.Increase the number of physical cores temporarily
D.Merge the new request into a running thread without changing its state
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When every core is occupied by a running worker, another request cannot begin immediate CPU execution on those cores. It can wait in a queue until a worker or core becomes available.

Q31. Which statement best describes the relationship between multicore execution and higher clock frequency?

A.Adding cores always raises the clock frequency of every core
B.Higher clock frequency is required before multiple cores can execute in parallel
C.Multicore execution and clock frequency are distinct ways of increasing processing capability ✅
D.A multicore processor uses one clock cycle for the entire application
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Multiple cores increase the number of instruction streams that may execute simultaneously. Clock frequency affects how quickly each core advances, so adding cores and raising frequency are distinct performance approaches.

Q32. A simulation has a serial setup stage taking 2 seconds followed by four independent tasks taking 8 seconds each. With four cores, all tasks run simultaneously and setup occurs first. Ignoring overhead, what is the total elapsed time?

A.8 seconds
B.10 seconds ✅
C.18 seconds
D.34 seconds
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The serial setup requires 2 seconds. The four independent 8-second tasks then execute together on four cores, adding 8 seconds, so total elapsed time is 2+8=102 + 8 = 10 seconds.

Q33. A data-analysis program processes 800 independent records, each requiring 0.5 ms of CPU time. Four cores divide the records evenly, then a serial merge takes 10 ms. Ignoring overhead, what is the total time?

A.100 ms
B.110 ms ✅
C.210 ms
D.410 ms
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Each core handles 200 records, requiring 200×0.5=100200 \times 0.5 = 100 ms. The serial merge adds 10 ms, so total elapsed time is 100+10=110100 + 10 = 110 ms under ideal balancing.

🔗 Related Topics (MCQs)