Quiz Space

Operating Systems · Quiz 2 · 24 Mar 2024 · January 2024 term

Question 18: Assuming context switches can occur at any time during t…

Question 18

+4 marksOne or more correct options

Assuming context switches can occur at any time during the execution of the following code snippet, counter is a shared variable. Which of the following can be the possible final values of the counter variable?

python
# Program 0
counter = 5
R1 = counter
R1 = R1 + 2
counter = R1
# Program 1
R2 = counter
R2 = R2 - 2
counter = R2

Select all that apply.

  1. A

    4

  2. B

    6

  3. C

    5

  4. D

    3

  5. E

    7

  6. F

    8

Show answer

Correct answers

  • C

    5

  • D

    3

  • E

    7

Question 18 of 19 in the IIT Madras BS Operating Systems (Operating Systems) Quiz 2 paper sat on 24 Mar 2024, in the January 2024 term (IIT M FOUNDATION AN EXAM QDF2 24 Mar 2024). It carries 4 marks.

More questions from this paper

  1. Q1Given the hexadecimal view of first few bytes of different files, identify the executable file (ELF file) from the opti…
  2. Q2Figure question
  3. Q3Consider the code given below. While the execlp("ls", "", NULL) function is running in the child process, what is the s…
  4. Q4Figure question
  5. Q5Which of the following best describes the role of the Programmable Interrupt Controller (PIC) in the xv6 operating syst…
  6. Q6A situation where several processes access and manipulate the same data is referred to as .
  7. Q7What system calls are commonly used for communication in message passing?
  8. Q8Consider the partial help message from the readelf utility Match the following. a) Linker view    1) readelf …
  9. Q9What is the correct sequence of tasks that takes place as part of hardware interrupt handling? (i) Process the interrup…
  10. Q10Figure question
  11. Q11Select the path traced in case of a timer interrupt caused while in the supervisor mode in xv6.
  12. Q12Figure question
  13. Q13Figure question
  14. Q14Assume that two processes P1 and P2 are sharing a variable. If P1 can go into critical section when the P2 is in the cr…
  15. Q15Round Robin provides the same or a lower response time compared to First-Come-First-Serve (FCFS) scheduling algorithm.
  16. Q16Figure question
  17. Q17Consider the following code snippet from Bakery Algorithm. critical section Considering there are 4 processes, and init…
  18. Q19Consider the following scenario where two processes are sharing a common variable. Global setup Process 1 Process 2 Sel…