Q1: Consider a process P running on a CPU. Which one or more of the following events will always trigger a context switch by the OS that results in process P moving to a non-running state (e.g., ready, blocked)? (2024 set 2)
(a) P makes a blocking system call to read a block of data from the disk
(b) P tries to access a page that is in the swap space, triggering a page fault|
(c) An interrupt is raised by the disk to deliver data requested by some other process
(d) A timer interrupt is raised by the hardware
Ans: (a, b)
Sol:
A: True
If a Process itself makes a block() call then it will be blocked until I/O.
B: True.
If a page is not in the physical memory, then the OS invokes the Page Fault Handler, and the process remains blocked until the page is read (i.e., disk I/O is complete).
By the way, there are two types of page faults: Minor and Major. A Minor fault occurs when a page is already in physical memory but was brought earlier using some other process, and the current process might not be aware of it. This typically happens when pages are shared. A Major Page Fault, on the other hand, occurs when we need to access the disk to retrieve the page into physical memory.
You can read more about both types of page faults here:
Since this question ask to get a page from the disk, it is considered a Major Page Fault. Therefore, the current process will be blocked until this I/O operation is completed.
C: False
That kind of request will be served by DMA and the CPU doesn't need to get involved hence the current program will keep on using the CPU.
D: False
Q2:Which of the following process state transitions is/are NOT possible? (2024 set 1)
(a) Running to Ready
(b) Waiting to Running
(c) Ready to Waiting
(d) Running to Terminated
Ans: (b, c)
Sol: Consider the following process state diagram:
From the above process state diagram, it is clear that:
Option (B, C) is correct.
Q3: Consider the following statements about process state transitions for a system using preemptive scheduling. (2020)
I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.
Which of the above statements are TRUE?
(a) I, II and III only
(b) II and III only
(c) I, II and IV only
(d) I, II, III and IV only
Ans: (c)
Sol: A blocked process cannot go to running state directly. Except (III), every option is viable.
Answer-(C)
Q4:The maximum number of processes that can be in Ready state for a computer system with n CPUs is (2015 SET 3)
(a) n
(b) n2
(c) 2n
(d) Independent of n
Ans: (d)
Sol: (D) independent of .
The number of processes that can be in READY state depends on the Ready Queue size and is independent of the number of CPU's.
Q5: In the following process state transition diagram for a uniprocessor system, assume that there are always some processes in the ready state: (2009)
Now consider the following statements:
I. If a process makes a transition D, it would result in another process making transition A immediately.
II. A process P2 in blocked state can make transition E while another process P1 is in running state.
III. The OS uses preemptive scheduling.
IV. The OS uses non-preemptive scheduling.
Which of the above statements are TRUE?
(a) I and II
(b) I and III
(c) II and III
(d) II and IV
Ans: (c)
Sol: 1. If a process makes a transition D, it would result in another process making transition A immediately. - This is false. It is not said anywhere that one process terminates, another process immediately come into Ready state. It depends on availability of process to run & Long term Scheduler.
2. A process P2 in blocked state can make transition E while another process P2 is in running state. - This is correct. There is no dependency between running process & Process getting out of blocked state
3. The OS uses preemptive scheduling. :- This is true because we got transition C from Running to Ready.
4. The OS uses non-preemptive scheduling. Well as previous statement is true, this becomes false.
So answer is (C) II and III .
Q6: The process state transition diagram of an operating system is as given below. Which of the following must be FALSE about the above operating system? (2006)
(a) It is a multi programmed operating system
(b) It uses preemptive scheduling
(c) It uses non-preemptive scheduling
(d) It is a multi-user operating system
Ans: (b)
Sol: Explanation:
A. It is a multi programmed operating system.
Correct, it has ready state. We can have multiple processes in ready state here so this is Multi programmed OS.
B. It uses preemptive scheduling
False : There is no arrow transition from running to ready state. So, this is non preemptive.
C. It uses non-preemptive scheduling
True.
D. It is a multi-user operating system.
We can have multiple user processes in ready state. So, this is also correct
Answer (B).
Q7:What is the swap space in the disk used for? (2005)
(a) Saving temporary html pages
(b) Saving process data
(c) Storing the super-block
(d) Storing device drivers
Ans: (b)
Sol: Swap space( on the disk) is used by Operating System to store the pages that are swapped out of the memory due to less memory available on the disk. Interestingly the Android Operating System, which is Linux kernel under the hood has the swapping disabled and has its own way of handling "low memory" situations.
Pages are basically Process data, hence the answer is (B).
10 videos|99 docs|33 tests
|
1. What is Process in Computer Science Engineering? |
2. What is the importance of understanding processes in Computer Science Engineering? |
3. How are processes different from threads in Computer Science Engineering? |
4. What are the different states a process can be in Computer Science Engineering? |
5. How does multitasking relate to processes in Computer Science Engineering? |
|
Explore Courses for Computer Science Engineering (CSE) exam
|