AMCAT Operating Systems Fundamentals 1 — Questions and Answers
Question 1: Which of the following scheduling algorithms can lead to starvation of low-priority processes?
- First Come First Served (FCFS)
- Round Robin (RR)
- Priority Scheduling (without aging) (Correct answer)
- Shortest Remaining Time First (SRTF)
Correct answer: Priority Scheduling (without aging)
In Priority Scheduling without aging, low-priority processes may wait indefinitely if higher-priority processes keep arriving. This is called starvation. FCFS processes jobs in order (no starvation), RR gives each process a time slice (no starvation), and while SRTF can cause starvation, Priority Scheduling is the classic example.
Question 2: What is the primary difference between a process and a thread?
- A process runs faster than a thread
- A thread is an independent program, while a process is a lightweight unit
- Threads within the same process share memory space, while processes have separate memory spaces (Correct answer)
- Processes can run concurrently but threads cannot
Correct answer: Threads within the same process share memory space, while processes have separate memory spaces
The fundamental difference is in memory: threads within the same process share the same address space (heap, global variables, code), while processes have completely separate memory spaces. This makes inter-thread communication faster but also introduces synchronization challenges.
Question 3: In virtual memory management, what is a page fault?
- An error in the page table structure
- An event that occurs when a program accesses a page that is not currently in physical memory (RAM) (Correct answer)
- A corruption of data on the hard disk
- A failure in the memory allocation algorithm
Correct answer: An event that occurs when a program accesses a page that is not currently in physical memory (RAM)
A page fault occurs when a running process tries to access a memory page that is mapped in its virtual address space but is not currently loaded into physical RAM. The OS then loads the required page from secondary storage (disk) into RAM, which causes a significant delay.
Question 4: Which of the following is NOT a necessary condition for deadlock according to Coffman's conditions?
- Mutual Exclusion
- Hold and Wait
- Preemption (Correct answer)
- Circular Wait
Correct answer: Preemption
The four necessary conditions for deadlock (Coffman conditions) are: Mutual Exclusion, Hold and Wait, No Preemption, and Circular Wait. 'Preemption' (the ability to forcibly take resources) actually prevents deadlock. It is 'No Preemption' (resources cannot be forcibly taken) that enables deadlock.
Question 5: What is the purpose of a semaphore in operating systems?
- To allocate memory to processes
- To synchronize concurrent processes and control access to shared resources (Correct answer)
- To schedule CPU time for processes
- To manage file system operations
Correct answer: To synchronize concurrent processes and control access to shared resources
A semaphore is a synchronization primitive used to control access to shared resources in a concurrent system. It uses a counter and two atomic operations (wait/signal or P/V) to ensure that critical sections are accessed safely, preventing race conditions.
Question 6: In the context of memory management, what is internal fragmentation?
- Wasted space between allocated memory blocks
- Wasted space within an allocated memory block because the block is larger than the requested size (Correct answer)
- Memory corruption due to buffer overflow
- Loss of data due to power failure
Correct answer: Wasted space within an allocated memory block because the block is larger than the requested size
Internal fragmentation occurs when allocated memory blocks are larger than what was actually requested. For example, if memory is allocated in fixed 4KB blocks and a process needs only 3KB, the remaining 1KB within that block is wasted. External fragmentation (option A) is wasted space between blocks.
Which of the following scheduling algorithms can lead to starvation of low-priority processes?