Operating System

Operating System (2021-2025)

Distribute Education like Computer Geek

Q1 – Indexed/Grouped allocation is useful as
(a) It supports both sequential and direct access.
(b) Entire block is available for data.
(c) It does not require lots of space for keeping pointers.
(d) No external fragmentation.

 

Choose the correct answer from the options given below:
  1. (a) only
  2. (b) and (c) only
  3. (b) only
  4. (a), (b) and (d) only

(UGC NET DEC 2023)

Ans – (4)

Explanation – Indexed allocation stores files in such a way that an index block keeps track of all disk blocks allocated for the file. This prevents fragmentation and enables block-level access to any position in the file.

Indexed allocation enables sequential access (reading blocks in order) as well as direct access, with the pointers to each block in the index block allowing for direct lookup.

In indexed allocation, the index point is stored separately from the actual block, while part of the block stores a pointer to the next block in linked allocation.

This way, external fragmentation can be avoided because whenever a block is allocated, it is done so individually and need not be organized in a contiguous manner.

Indexed allocation does require additional space for splitting the index block. For very large files, this could mean an additional overhead of several index blocks.

Q2 –  In Linux, where is the user password stored?
  1. / etc/ password
  2. / root/ password
  3. / etc/ passwd
  4. / root/ passwd

(UGC NET DEC 2023)

Ans – (3)

Explanation – In Linux-based systems, the / etc/shadow file contains user passwords, whereas / etc/passwd contains user account details.

The file contains user account information such as the username, user ID (UID), group ID (GID), home directory, and shell.

In earlier versions, Linux systems, the passwords were stored within the / etc/passwd file.

But due to security issues in modern Linux systems, while / etc/shadow has encrypted passwords, / etc/passwd contains only user details.

Q3 – Which of the following statement are correct?
(a) A process always check state of currently executing process to enter critical schema.
(b) Spin locks uses busy waiting.
(c) Periodically testing a variable until some value appear is known as busy waiting.
(d) Critical region is a part of program, where shared memory is kept.
(e) Printer daemon, continuously checks to see if there are any file to be printed.

 

Choose the correct answer from the options given below:
  1. (a) and (b) only
  2. (b) and (c) only
  3. (b) and (d) only
  4. (b) and (e) only

(UGC NET DEC 2023)

Ans – (3)

Explanation – (a) is wrong, because if multiple processes want to access a shared resource (e.g., a printer), they don’t check which process is running. Instead, they check a lock or flag to see if the resource is available to determine if a process can enter the critical section.

(b) is correct. Spin lock is a locking mechanism used in multi-threading and multi-processing to avoid concurrent access by multiple processes and threads to shared resources.

When a process (or thread) wants access to a shared resource, it checks whether it is available. If the resource is being used, the process spins on a loop until it becomes available. As soon as the resource is free, the process can enter into the critical section and use the resource.

Consider a public toilet that operates with just one key. You reach the toilet, but it’s occupied. Instead of leaving and returning after some time, you decide to keep knocking at the door every second. The moment the occupant exits, you quickly push the door and enter before anyone else does. That’s busy waiting.

(c) statement uses busy waiting. You are thinking that this statement is correct, but it is not. The system does not “periodically”, it checks continuously without pausing

(d) A critical region (or critical section) is a part of a program where a shared resource (like shared memory, a file, or a printer) is accessedThis is correct.

(e) A printer daemon is a background process that manages printing jobs. However, it does not check for new print jobs all the time (busy waiting). A printer daemon that kept busy waiting all the time might be wasting CPU cycles. It is efficient because it just waits for a signal from the system that a print job has been added. Therefore, this statement is wrong.

Q4 – The interface(s) that provide(s) I/O transfer of data directly to and from the memory unit peripheral is/are termed as:
(a) DMA (Direct Memory Access)
(b) IOP (Input-Output Processor)
(c) Serial Interface
(d) Parallel Interface

 

Choose the correct answer from the options given below
  1. (a) only
  2. (b) only
  3. (a) and (b) only
  4. (c) and (d) only

(UGC NET DEC 2023)

Ans – (3)

Explanation – The question asks about which interfaces allow data transfer directly between memory units and peripheral devices.

Direct Memory Access (DMA) facilitates direct transfer of data between memory and peripherals, without CPU involvement, thereby increasing performance since the CPU can engage in other tasks while data is transferred in the background.

Input-output processors (IOP) manage any I/O operation independently of the CPU and are in communication with memory and peripheral devices.

Serial interfaces (For example – USB, RS-232) do not directly access memory. They need CPU interaction.

Parallel interfaces (For example – Most printers) are such that they send data in a parallel dig. They are unable to create direct memory access which essentially requires CPU intervention.

Q5 – Match List-I with List-II
List-I
List-II
(a) LRU
I. A page is written to secondary memory only when it has been selected for replacement.
(b) Demand Paging
II. A page that has not been referenced for the longest time is replaced.
(c) Long term scheduling
III. The decision to add to the number of processes that are partially or fully in main memory.
(d) Medium term scheduling
IV. The decision to add to the pool of processes to be executed.
Choose the correct answer from the options given below:
 
(a)
(b)
(c)
(d)
1.
I
III
IV
II
2.
II
I
IV
III
3.
III
II
I
IV
4.
IV
II
III
I

(UGC NET DEC 2023)

Ans – (2)

Explanation – (a) – II

LRU (Least Recently Used) – In this page replacement technique, the page which has not been used the longest gets replaced.

(b) – I

Demand Paging – Demand paging loads pages into memory only when needed. That is how a page is written to secondary memory. That is for pages that need replacement.

(c) – IV

Long Term Scheduling – Controls and monitors the admission of new processes into the system for execution.

(d) -III

Medium Term Scheduling – This refers to the scheduling of the number of processes present in the memory by swapping some processes out when memory is filled up.

Q6 – A program that is used by other routines to accomplish a particular task, is called:
  1. Micro program
  2. Micro operation
  3. Routine
  4. Subroutine

(UGC NET DEC 2023)

Ans – (4)

Explanation – It is asking about some code which is to be invoked from other parts of a program to achieve a specific task.

In simple terms, a function or module is to be reused at different places in a program without rewriting a single piece of code.

subroutine is a small piece of code designed to perform a certain task and is callable by other parts of a program. The same improves code reusability and modularity and eliminates code duplication in a program by calling the subroutine elsewhere at the point where we want to invoke that process.

Micro program – A low-level sequence of instructions used in the processor to execute machine instructions. This is not the answer.

Micro operation – A single, basic operation performed upon data in the CPU. So, this is also not the answer.

Routine – A general term for a sequence of instructions, though not necessarily designed to be used by other routines. That’s why not the answer.

Q7 – Which of the following(s) are main memory?
(a) Virtual Memory
(b) Cache memory
(c) RAM
(d) SSD

 

Choose the correct answer from the options given below:
  1. (a) and (c) only
  2. (b) and (c) only
  3. (c) and (d) only
  4. (a), (b) and (c) only

(UGC NET DEC 2023)

Ans – (2)

Explanation – Main memory, sometimes referred to as primary storage, is the working memory of the computer, where the CPU keeps the data and program instructions currently in use. It is volatile, which means that data residing in RAM will be lost when the computer is powered off.

Types of Main Memory

RAM – It stores the operating system, applications, and data currently being used by the computer. Fast and directly accessible by the CPU.

Cache Memory – It holds copies of those data most frequently accessed from the main RAM. It is extremely fast and placed near the CPU. Helps reduce the time to access data from the main memory.

Virtual memory is a technique that extends RAM and SSD (Solid State Drive) is a secondary memory that is non-volatile.

Q8 – Given as 4 GB (≈4.3 x 109 bytes) of virtual space and typical page size of 4 KB and each page table entry is 5 bytes. How many virtual pages would this imply? What is the size of whole page table?
  1. 107500 and 20480 bytes
  2. 215000 and 40960 bytes
  3. 10750 and 10240 bytes
  4. 43000 and 1024 bytes

(UGC NET DEC 2023)

Ans – (None)

Explanation – Virtual space = 4.3 x 109 = 4300,000,000 bytes

Page size = 4KB = 4000 bytes

Number of virtual pages = Virtual space / page size

Number of virtual pages = 1075000 pages

Page table entry = 5 bytes

Whole page table size = 1075000 x 5 = 5375000 bytes

So, the answer is 1075000 and 5375000 bytes.

Note – UGC has found an error in this question so this question is dropped.

Q9 – Arrange the following levels of interrupt protection within the Linux Kernel, in the order of increasing priority.
(a) user mode programs
(b) bottom half interrupt handlers
(c) Kernel system service routines
(d) top half interrupt handlers

 

Choose the correct answer from the options given below:
  1. (a), (b), (d), (c)
  2. (a), (c), (b), (d)
  3. (a), (c), (d), (b)
  4. (d), (a), (c), (b)

(UGC NET DEC 2023)

Ans – (2)

Explanation – At each level, there exists a different level of interrupt protection in the Linux kernel, and they proceed according to a priority order: the order of increasing priority implies that operations of lower priority are processed first, while higher priority operations are processed last. Let’s analyze each in turn.

(a) User Mode Programs – These run in user space and are at the lowest priority. They can always get pre-empted by kernel operations and interrupts.

(c) Kernel System Service Routines – Those run in kernel mode when system calls are being executed. They have a higher priority than user mode programs but can still get interrupted by hardware interrupts.

(b) Bottom Half Interrupt Handlers – These listen for deferred work enumerated by the top half of an interrupt. They are of higher priority than system service routines but can still be interrupted by top-half handlers.

(d) Top Half Interrupt Handlers – These are the highest priority because these execute immediately on hardware interrupts response. They run with interrupts disabled to ensure their swift execution.

Q10 – Given below are two statements:
 
Statement I: In datagram networks – routers hold state information about correction.
 
Statement II: In virtual circuit network – each virtual circuit requires router table space per connection.
 
In the light of the above statements, choose the most appropriate answer from the options given below:
  1. Both Statement I and Statement II are correct.
  2. Both Statement I and Statement II are incorrect.
  3. Statement I is correct but Statement II is incorrect.
  4. Statement I is incorrect but Statement II is correct.

(UGC NET DEC 2023)

Ans – (4)

Explanation – Each router in datagram networks, example, in IP across the Internet, does not maintain a state information of connections.

In datagram networks, each packet is treated on its own or independently, and a router will then base its forwarding decision on a destination address from the packet itself.

Since routers have information concerning the state of connections, then, statement I is not correct.

In a virtual circuit network (such as ATM or MPLS), connections are established before communication starts while routers have a routing table entry for each virtual circuit.

Which implies, every active connection needs to take its space in the routing table of the router for storing virtual circuit information. Statement II becomes correct.

Q11 – The head of a moving head disk with 200 tracks, numbered 0 to 199, has just finished a request at track 125, and currently serving a request at track 143. The queue of requests is given in the FIFO order as 86, 147, 91, 177, 94, 150, 102, 175, 130. What will be the total number of head movements required to satisfy these requests for SCAN algorithm?
  1. 259 cylinders
  2. 169 cylinders
  3. 154 cylinders
  4. 264 cylinders

(UGC NET DEC 2023)

Ans – (2)

Explanation – The first request in the problem follows FIFO (First-In-First-Out) order, but SCAN Scheduling Algorithm does not process requests in FIFO order.

SCAN moves in one way first-either left or right-until the end and then reverses. Here in the current example, the disk head has just finished a request at track 125 and has started servicing track 143, which means it is moving towards the right. The request queue is 86, 147, 91, 177, 94, 150, 102, 175, 130.

Multi-directional SCAN-first with the right requests – 147, 150, 175, 177. Upon completing the request at track 177, the disk head will head towards 199 and subsequently change its direction and service the left requests – 130, 102, 94, 91, and 86. Even though 86 is first in the FIFO order, it is served last because SCAN would not jump toward it immediately. It follows a systematic approach to moving in one direction before changing direction.

In the first phase, it is directed from 143 to 177 with 34 cylinders & from 199 to 177 with a further 22 cylinders onward in the right direction and then reverse direction for verification from 199 to 86 on left with 113 cylinders.

So, 34 + 22 + 113 = 169 cylinders (Option 2).

Q12 – An address in main memory is called:
  1. Virtual Address
  2. Memory Address
  3. Logical Address
  4. Physical Address

(UGC NET DEC 2023)

Ans – (4)

Explanation – An address in main memory refers to the actual location where data is stored in RAM. This is called a physical address because it represents a real, hardware-based address in a computer’s memory.

Other options –

Virtual Address – Used in virtual memory systems where programs use addresses mapped to physical addresses.

Memory Address – A general term that can refer to either virtual or physical addresses.

Logical Address – Is the address generated by CPU, which is then translated into a physical address by the Memory Management Unit (MMU).

Q13 – Given below are two statements:
Statement (I): A thread is a dispatchable unit of work that does not executes sequentially and is not interruptible

 

Statement (II): It is not possible to alter the behaviour of a thread by altering its context when thread is suspended

 

In the light of the above statements, choose the most appropriate answer from the options given below:
  1. Both Statement I and Statement II are correct
  2. Both Statement I and Statement II are incorrect
  3. Statement I is correct but Statement II is incorrect
  4. Statement I is incorrect but Statement II is correct

(UGC NET DEC 2023)

Ans – (2)

Explanation – A thread is a unit of work that is lightweight, allowing it to be dispatched by the operating system for actual execution purposes. Threads follow a strict sequence of instructions just like processes, allowing them to be executed in a strictly sequential manner. The other aspect that is contradictory to the statement is that threads are interruptible. The operating system may suspend, resume, pre-empt, or even kill them.


In a similar manner, the second statement is also incorrect. On suspension, its execution is interrupted, but its context-such as register values, program counter, and stack-is preserved by the operating system. The context can also be modified, making it possible for the execution behavior of the thread to change when it starts executing again. This means that it is possible to modify the context of the thread when it is suspended in order to modify its behavior. Since both are incorrect, the correct option is Option 2.

BOOKS

Operating System by Silberschatz

Operating System by Rajiv Chopra