Operating Systems Junior

1 / 25

Explain the difference between Kernel Mode and User Mode. Why is this dual-mode operation necessary for system security?

Select the correct answer

1

Both modes have identical hardware privileges, but kernel mode simply runs its threads at a higher scheduling priority.

2

User mode has unrestricted hardware access, while kernel mode is restricted to running only trusted signed applications.

3

Kernel mode runs user applications directly, while user mode handles interrupts and manages the physical memory pages.

4

Kernel mode has unrestricted hardware access, while user mode is restricted and must use system calls to reach hardware.

What is the primary purpose of an Operating System, and what are its core functions?

Select the correct answer

1

It directly executes application logic within the hardware, bypassing any need for a resource management layer.

2

It compiles application source code and provides a graphical interface used for editing that same code directly.

3

It stores user data permanently and provides encryption, but it does not manage CPU scheduling or memory allocation.

4

It manages hardware resources and provides an abstraction layer between applications and the physical hardware.

What are privileged instructions, and why can they only run in kernel mode?

Select the correct answer

1

Instructions affecting hardware or control state directly; in user mode they would let apps bypass OS protection, so they run only in kernel mode.

2

Instructions that access encrypted memory regions; because keys live in the kernel, user mode cannot decode them, so they run privileged only.

3

Instructions that run faster than normal ones; user mode disables them merely for speed reasons, so they are reserved for the kernel to keep timing fair.

4

Instructions written only in assembly language; user programs use high-level code, so these low-level operations are handled exclusively by the kernel.

What are the different types of operating systems (batch, time-sharing, real-time, distributed, embedded)?

Select the correct answer

1

A distributed OS runs on a single isolated machine, while an embedded OS coordinates many networked computers as one system.

2

A time-sharing OS meets hard deadlines, while an embedded OS lets many users share one large mainframe interactively.

3

A real-time OS meets strict deadlines, while a time-sharing OS switches the CPU among users to give interactive response.

4

A batch OS gives interactive response, while a real-time OS processes jobs in bulk with no direct user interaction at all.

What is multiprogramming, and how does it improve CPU utilization?

Select the correct answer

1

Splitting a single program across many CPUs so each processor executes part of the work to finish the job faster.

2

Running one job at a time to completion so the CPU never idles while waiting for slow input or output devices.

3

Giving each user a short time slice in turn so an interactive terminal always feels responsive to the person using it.

4

Keeping several jobs in memory so the CPU runs another job whenever one waits for I/O, so the CPU stays busy.

Describe the Process State Transition Diagram. What triggers a process to move from Running to Waiting vs. Ready?

Select the correct answer

1

Running to Waiting on scheduler preemption; Running to Ready when an I/O completes

2

Running to Waiting when a child process exits; Running to Ready on memory freeing

3

Running to Waiting when its time slice expires; Running to Ready on a page fault

4

Running to Waiting on an I/O or event wait; Running to Ready on scheduler preemption

Explain the fundamental differences between a process and a thread. How do they differ in terms of memory sharing and overhead?

Select the correct answer

1

Threads always run slower than processes; both keep fully isolated memory to prevent any data corruption

2

Threads share the process address space with low overhead; processes have separate memory and cost more

3

Threads each own a separate address space; processes share one address space with very little overhead

4

Threads and processes both share memory fully; the only real difference is their scheduling priority level

What is a Process Control Block (PCB), and what specific information does the OS store in it to manage a process?

Select the correct answer

1

Process state, program counter, CPU registers, scheduling and memory info, and open-file/I/O status

2

The full source code of the program plus a copy of every file the process has opened during its run

3

Just the memory page tables and heap contents, excluding any register or scheduling-related information

4

Only the process ID and its current priority, with all register state kept solely in the CPU hardware

What resources are shared between threads of the same process, and what are kept private?

Select the correct answer

1

Heap and global data are private per thread; only the code segment and CPU registers are shared broadly

2

Code, global data, heap, and open files are shared; stack, registers, and program counter are private

3

Stack, registers, and program counter are shared; code, heap, and open files are kept private per thread

4

Everything including the stack and registers is shared; only the thread's priority value stays fully private

Explain the difference between a Program, a Process, and a Thread.

Select the correct answer

1

A program is passive code on disk, a process is a program in execution, and a thread is an execution path within a process.

2

A program is code in memory, a process is a scheduled thread, and a thread is a running copy of the program with its own memory.

3

A program is a group of threads, a process is passive code, and a thread is the active execution of a program stored on disk.

4

A program is running code, a process is idle code on disk, and a thread is a separate program that shares memory with others.

What are the benefits and costs of multithreading an application?

Select the correct answer

1

Threads guarantee faster execution on all hardware but require roughly twice the memory of using separate processes.

2

Threads always run in parallel on one core and simplify the code by fully isolating any state that gets shared.

3

Threads remove the need for context switches while eliminating every deadlock and race-condition possibility entirely.

4

Threads improve responsiveness and resource sharing but add synchronization complexity and race-condition risks.

What is a system call, and how does it differ from a standard library function call?

Select the correct answer

1

A system call is compiled into the program, while a library function is resolved by the kernel scheduler at every runtime call.

2

A system call runs entirely in user space, while a library function always switches to kernel mode to access the hardware directly.

3

A system call and a library function are identical; both execute in kernel mode and demand exactly the same privilege level.

4

A system call requests a kernel service via a mode switch, while a library function runs in user space and may wrap a syscall.

Explain the difference between preemptive and non-preemptive scheduling. When would you prefer one over the other?

Select the correct answer

1

Preemptive can forcibly interrupt a running process; non-preemptive lets it run until it blocks or finishes

2

Preemptive runs each process to completion; non-preemptive interrupts processes at fixed timer intervals always

3

Preemptive avoids context switches entirely; non-preemptive relies on frequent switching for fair CPU sharing

4

Preemptive is used only in batch systems; non-preemptive is required for all real-time interactive workloads

What is the difference between Throughput, Turnaround Time, and Response Time?

Select the correct answer

1

Throughput is jobs finished per unit time, turnaround is time to first output, response is submission to completion.

2

Throughput is submission to completion, turnaround is jobs finished per unit time, response is time to first output.

3

Throughput is jobs finished per unit time, turnaround is submission to completion, response is time to first output.

4

Throughput is time to first output, turnaround is jobs finished per unit time, response is submission to completion.

How does a round robin scheduler handle a process that requires more time than the allocated time quantum?

Select the correct answer

1

It is preempted when the quantum expires and placed at the front of the ready queue again.

2

It is terminated when the quantum expires and must be resubmitted to the ready queue later.

3

It is preempted when the quantum expires and placed at the back of the ready queue.

4

It is allowed to keep running until completion since the quantum only applies to short jobs.

How does priority scheduling work, and how are priorities assigned to processes?

Select the correct answer

1

The CPU is given to the highest-priority ready process; priorities may be set statically by the user or dynamically by the system

2

The CPU is given to the process with the shortest burst time; priorities are always fixed at process creation and never changed

3

Processes run strictly in arrival order; priorities are inferred solely from how long each process has been waiting in memory

4

Each process receives an equal time slice in rotation; priorities only decide which queue a process is initially placed into

What is a Race Condition? Provide a conceptual example of how it can lead to data inconsistency.

Select the correct answer

1

Two processes competing for CPU cycles so the slower one is starved, like a background job never finishing its full computation

2

A thread holding a lock too long so others block indefinitely, like a shared counter being frozen at its last written value

3

Concurrent threads interleaving unsynchronized access so the result depends on timing, like two lost increments to a shared counter

4

A single thread executing operations out of program order so the result depends on the compiler, like a reordered loop counter

What are the four Coffman Conditions necessary for a deadlock to occur?

Select the correct answer

1

Resource sharing, hold and wait, forced preemption, and linear waiting must all hold simultaneously.

2

Mutual exclusion, priority inversion, preemption allowed, and circular wait must all hold simultaneously.

3

Mutual exclusion, starvation, no preemption, and bounded waiting must all hold simultaneously.

4

Mutual exclusion, hold and wait, no preemption, and circular wait must all hold simultaneously.

What is Virtual Memory, and how does it allow a program to run even if it is larger than the available physical RAM?

Select the correct answer

1

An abstraction mapping each process's address space across RAM and disk, so only actively used pages stay in RAM while the rest reside on disk until needed.

2

A scheduler feature that runs a large program in small time slices, loading each function only while it executes and discarding it fully once the call returns.

3

A technique that compresses the process's data in RAM on the fly, so a program needing more memory than exists can be squeezed into the available physical frames.

4

A dedicated fast region of the disk that the CPU addresses directly, so large programs execute their instructions straight from disk without ever occupying RAM.

What is Virtual Memory, and what are the primary benefits it provides to a programmer?

Select the correct answer

1

An abstraction giving each process a large private address space, freeing the programmer from managing physical memory and providing isolation between processes.

2

A caching layer between CPU and RAM that automatically speeds up memory access, so the programmer can rely on faster loads without tuning any data structures.

3

A compiler optimization that reduces a program's memory footprint at build time, so the programmer no longer needs to worry about how large the data set becomes.

4

A hardware feature that lets several programs share the same physical addresses safely, so the programmer can write code that reads other processes' memory.

Compare the different directory structures (single-level, two-level, tree, acyclic-graph).

Select the correct answer

1

A two-level directory arranges all directories into one hierarchical parent-child tree

2

A tree directory permits files to be shared through multiple links between users

3

A single-level directory gives each user a private directory to isolate their files

4

An acyclic-graph structure allows shared subdirectories and files but forbids cycles

What are the different file access methods (sequential, direct, indexed)?

Select the correct answer

1

Indexed access always processes records strictly in order from the start of the file

2

Sequential access jumps to any record instantly using a stored block position value

3

Direct access reads or writes any block by its number without processing prior blocks

4

Direct access rebuilds a separate index block whenever a record is added or removed

What is a Pipe, and what is the difference between a Named and Unnamed pipe?

Select the correct answer

1

Both named and unnamed pipes persist on disk and survive after the processes exit

2

A named pipe has a file-system name and works between unrelated processes

3

A named pipe allows only one-way data flow, while an unnamed pipe is bidirectional

4

An unnamed pipe has a file-system name and works between unrelated processes

Explain how pipes work for communication between a parent and child process.

Select the correct answer

1

A named disk file both processes open by path, taking turns to append and truncate its contents freely.

2

A kernel-managed byte buffer that the child inherits, letting one end write while the other reads.

3

A shared memory region both processes map directly, using locks to coordinate reads and writes safely.

4

A network connection between the two processes that routes bytes through the local loopback interface.

What is a device driver, and what role does it play in the OS I/O subsystem?

Select the correct answer

1

A user library applications link against to bypass the kernel and control the hardware registers directly.

2

Firmware stored on the device that boots it and exposes a fixed menu of operations to any operating system.

3

Software that translates generic OS I/O requests into commands specific to a particular hardware device.

4

A kernel thread that schedules which process may access each device based on their current priority levels.