Quiz Space

Operating Systems · Quiz 1 · 23 Feb 2025 · January 2025 term

Question 2: Consider the following code snippet: What are the sizes o…

Question 2

+3 marksOne correct option

Consider the following code snippet:

c
#define TIMER_BASE 0x40010000
void configure_timer(){
uint32_t *config_reg = (uint32_t*)(TIMER_BASE + 0x00);
uint8_t *status_reg = (uint8_t*)(TIMER_BASE + 0x04);
uint16_t *counter_reg = (uint16_t*)(TIMER_BASE + 0x08);
*config_reg = 0x1;
while((*status_reg & 0x1) == 0);
*counter_reg = 0xFFFF;
}

What are the sizes of the config_reg, status_reg, and counter_reg registers, respectively?

  1. A

    Sizes of all the registers are 4-byte.

  2. B

    Sizes of ‘config_reg‘, ‘status_reg‘, and ‘counter_reg‘ are 4-byte, 1-byte, and 2- byte respectively.

  3. C

    Sizes of ‘config_reg‘, ‘status_reg‘, and ‘counter_reg‘ are 2-byte, 1-byte, and 2- byte respectively.

  4. D

    Sizes of ‘config_reg‘, ‘status_reg‘, and ‘counter_reg‘ are 1-byte, 2-byte, and 4- byte respectively.

Show answer

Correct answer

  • B

    Sizes of ‘config_reg‘, ‘status_reg‘, and ‘counter_reg‘ are 4-byte, 1-byte, and 2- byte respectively.

Question 2 of 19 in the IIT Madras BS Operating Systems (Operating Systems) Quiz 1 paper sat on 23 Feb 2025, in the January 2025 term (IIT M IMPROVEMENT AN EXAM QIM2 23 Feb 2025). It carries 3 marks.

More questions from this paper

  1. Q1If the memory map for a device starts from the offset 0x40005000 and has a size of 1024 bytes in a 32-bit addressing sc…
  2. Q3What does the following ‘xv6‘ code snippet accomplish?
  3. Q4What is the correct sequence of setting up first user process?\ (i) Find an unused proc entry.\ (ii) Create trapframe.\…
  4. Q5Consider a process A that forks process B, and process B forks process C. Process A terminates, and process B continues…
  5. Q6Consider the following code snippet for the syscall function in kernel/syscall.c: What does the a6 register in the trap…
  6. Q7Consider a system with a virtual memory space size of 16GB and a single page table containing 2²⁰ entries. What is the …
  7. Q8Consider a system with 128 MB of physical memory and a 32-bit virtual address space. Given a page size of 8 KB, what wi…
  8. Q9What could be the possible output of the following program?
  9. Q10What is deadlock in an operating system?
  10. Q11Figure question
  11. Q12Figure question
  12. Q13Figure question
  13. Q14In the xv6 operating system, if a process is waiting for I/O to complete, what will be the state transition of the proc…
  14. Q15Imagine a basic Linux shell that executes the ls -l command. Which of the following lists correctly orders the system c…
  15. Q16Figure question
  16. Q17When a process invokes the exec system call, which components in the Process Control Block (PCB) remain unchanged?
  17. Q18Which of the following actions are performed by userinit? The source code of userinit is given below for reference.
  18. Q19Assume the following processes are in various states:\ Process P1 is waiting for I/O to complete.\ Process P2 has compl…