‹ Operating Systems tests

Operating Systems practice questions

10 questions in 1 test. Open one to answer it on its own, or take a whole test.

  1. An image-processing program splits its work between two workers. In version 1 each worker is a separate process created with fork(); in version 2 each worker is a thread created… · Processes & Threads
  2. A program starts two threads. Each thread runs counter = counter + 1 one million times on a shared global counter that starts at 0, with no locking. Run on a multi-core machine… · Concurrency & Synchronization
  3. An OS uses round-robin scheduling. To make interactive programs feel snappier, an engineer cuts the time slice from 10 ms to 0.5 ms. Each context switch costs about 0.5 ms once… · CPU Scheduling
  4. A scheduler uses a multi-level feedback queue: a job that uses its whole time slice is moved down one priority level, and the scheduler always runs a job from the highest… · CPU Scheduling
  5. A user program calls read() to read bytes from a file. The program runs in user mode, where the CPU will not let it issue I/O instructions directly. How does the request reach… · Kernel Mode & System Calls
  6. A banking service transfers money between two accounts. transfer(from, to) locks from's mutex, then to's mutex, moves the money, and unlocks both. Occasionally the service hangs… · Deadlock
  7. A batch server runs 40 worker processes. After the job size grew, the combined memory each worker actively uses is now well above the machine's physical RAM. Monitoring shows the… · Virtual Memory
  8. A single-threaded C program sums a 4096 x 4096 array of 4-byte integers, stored row by row in memory (row-major). The whole array fits comfortably in RAM and is already resident… · Caching & Locality
  9. A file system uses data journaling. To append a block to a file it (1) writes a transaction to the journal (the new inode, bitmap and data block) (2) writes a commit block for… · File Systems
  10. A web server has 50 worker threads that share a pool of 5 database connections. At most 5 threads may hold a connection at once; a sixth thread asking for one should block until… · Concurrency & Synchronization