Q160: Threads over processes?

Question160: Is there any benefit using threads over processes?

Options:

  1. No, processes are better as they provide better isolation.
  2. Yes, threads are beneficial as they are light weight to spawn.
  3. Yes, threads share code segment thereby saving memory.
  4. Both B and C depending on use case.

Solution: The correct answer is the last one. Threads are kind of light weight processes, they also share code segment with each other within the same process. Threads are useful for lightweight tasks whereas processes are useful for heavy weight tasks.

Q102: Why do we need access control bits in page table entries?

Question #102: Why do we need access control bits in page table entries?

  1. Because the pages might be shared.
  2. Some pages might contain executable code, which is read-only.
  3. Some pages contain data, so there shouldn’t be any instructions that should execute from that memory space.

Options:

A. All of the options 1, 2 and 3 are correct.

B. Only option 1 is correct.

C. Only options 2 and 3 are correct.

D. Only options 1 and 2 are correct.

Solution: The correct answer is C. Executable code should only be read-only and any attempt to write on that space should be trapped. Similarly any data should be read or written, but any attempt to execute from that address space should be trapped!