Computer Science · Operating Systems
Consider a program that spawns 20 threads to find the sum of elements in a shared array of size 200. Each thread i takes elements A[10i] to A[10i + 9], computes a local sum loc_sum[i], and eventually adds loc_sum[i] to a shared global variable tot_sum for the total sum. Which operation MUST be placed inside a critical section?
- 1Neither Reading array values nor Adding to tot_sum
- 2Both Reading array values and Adding to tot_sum
- 3Adding to tot_sum✓
- 4Reading array values
Correct answer
Adding to tot_sum
Download Single Question PDF
Save this question and verified answer as a clean study sheet with live clickable link.
Share with Friends & Study Groups
Challenge your peer aspirants on WhatsApp or Telegram to solve this question!
Preparing for Computer Science?
Practice full-length mock tests with real exam timers, instant score analysis, and all-India ranking.
Want more practice questions on Operating Systems?
Solve complete topic-wise tests with detailed solutions on GkGet.
Related Practice Questions
Recommended practice questions in Computer Science · Operating Systems