CS FundamentalsVery hardGATE CS
A system uses paging with a 2-bit protection field (read, write) in each PTE and the CPU also has an execute-disable bit. Which page setting best implements W^X for a JIT compiler that must write code and then run it?
- A. Keep the page writable and executable all the time
- B. Make the page executable only and write through a file
- C. Map the page writable and non-executable while generating code, then change it to read-only executable before running it
- D. Disable paging during code generation
Correct answer: C. Map the page writable and non-executable while generating code, then change it to read-only executable before running it
W^X means no page is both writable and executable at once, so a memory-corruption bug cannot inject and run code. JITs flip permissions (or use two mappings of the same frame).
More Operating Systems questions
- Swap space is configured at 2 GB, RAM is 8 GB, and the OS uses overcommit. A process mallocs 20 GB and touches only 1 GB. What happens on…
- Which algorithm decides WHICH process to kill when Linux runs out of memory?
- NUMA systems: a thread running on node 0 frequently reads memory allocated on node 1. Which statement is correct?
- Which statement about the clock interrupt frequency (tick rate) is correct?
- A real-time task must respond within 50 µs. Which OS property matters most?
- Assertion (A): Increasing the number of frames given to a process under FIFO can increase its page faults. Reason (R): FIFO does not…