OS 2024 (Reg/Rep) Solved Question Paper Operating System

Time: 2 Hrs | Max. Marks: 60

Section - A

I. Answer any TEN of the following. (10×2=20)

1. What is an operating system?

An Operating System can be defined as an interface between user and hardware.

or

An Operating System (OS) is system software that manages computer hardware and software resources and provides services for computer programs. It acts as an intermediary between users and the computer hardware, allowing users to interact with the system efficiently and safely

2. What is multi programming operating system?

A Multiprogramming Operating System allows multiple programs to reside in memory and be executed simultaneously. While one program waits for I/O operations, the CPU can execute another, maximizing resource usage and improving system efficiency

3.Define schedulers. List its types.

Schedulers are components of an OS that determine which processes will run at any given time.

Types:

  • Long-term Scheduler (Job Scheduler)

  • Short-term Scheduler (CPU Scheduler)

  • Medium-term Scheduler:

4. Define thread. List its types.

A Thread is the smallest unit of a process that can be scheduled and executed independently. It shares the same memory space as other threads within the same process.

Types of Threads:

  • User-Level Threads (ULT)

  • Kernel-Level Threads (KLT)

5. What is turnaround time and waiting time?
  • Turnaround Time: The total time taken from the submission of a process to its completion.
    Turnaround Time = Completion Time – Arrival Time

  • Waiting Time: The total time a process spends in the ready queue waiting to be executed.
    Waiting Time = Turnaround Time – Burst Time

6. Define race condition.

A Race Condition occurs when two or more processes access shared data and try to change it at the same time. If the access is not synchronized, the final outcome depends on the sequence of access, which can cause unpredictable behavior and bugs

7. What is deadlock?

A deadlock is a situation where two or more processes are unable to proceed because each is waiting for a resource held by another, creating a circular dependency.

8. What is thrashing?

Thrashing is a condition where the system spends more time swapping pages in and out of memory than executing actual processes. It usually occurs when there is insufficient memory, and the OS is overwhelmed by page faults.

9. What is logical address?

A logical address is a virtual address generated by the CPU during program execution. It is mapped to a physical address by the Memory Management Unit (MMU)

10. What is Fragmentation?

Fragmentation refers to inefficient use of memory, where free memory is broken into small, non-contiguous blocks.

  • Internal Fragmentation

  • External Fragmentation

11. Define File. List its attributes.

A File is a collection of related data stored on a disk and treated as a single unit by the operating system.

Attributes:

  • Name

  • Type

  • Location

  • Size

  • Protection

  • Creation/modification time

  • Owner

12. List the operations on File.
  • Create

  • Open

  • Read

  • Write

  • Append

  • Close

  • Delete

  • Rename

Section - B

II. Answer any FOUR of the following. (4×5=20)

13. With a neat diagram explain PСВ.

A Process Control Block (PCB) is a data structure used by the Operating System to store all information about a process. When a process is created, the OS generates a PCB for it. It is essential for process management.

  • Process ID (PID): Unique identifier of the process.

  • Process State: Current status (Ready, Running, Waiting, etc.).

  • Program Counter: Address of the next instruction to be executed.

  • CPU Registers: Stores the values of CPU registers.

  • Memory Management Info: Includes base and limit registers, page tables, etc.

  • Accounting Info: CPU usage, process time, etc.

  • I/O Status Info: List of I/O devices allocated, files opened.

14. Explain the benefits of threads.

Threads are lightweight processes that share the same memory space but execute independently. Using threads provides several benefits:

  • Improved Performance: Threads enable parallel execution, improving application throughput and responsiveness, especially on multi-core systems.

  • Resource Sharing: Threads of the same process share code, data, and resources, reducing the overhead of memory usage compared to multiple processes.

  • Faster Context Switching: Switching between threads is faster than between processes because they share the same memory and require less overhead.

  • Simplified Communication: Threads can easily communicate with each other through shared memory, unlike processes which require inter-process communication (IPC).

  • Utilization of Multi-core Processors: Multithreaded programs can run different threads on different CPU cores, utilizing system resources efficiently.

  • Responsiveness: In user interfaces or servers, threads allow background tasks (e.g., loading, printing) to run without freezing the main application.

15. Explain necessary conditions for deadlock.

For deadlock to occur in a system, four necessary conditions must hold simultaneously. These conditions are described by Coffman’s Conditions:

  1. Mutual Exclusion: Only one process can use a resource at a time. If a resource is allocated to one process, others must wait.
  2. Hold and Wait: A process is holding at least one resource and waiting to acquire additional resources that are currently being held by other processes.
  3. No Preemption: Resources cannot be forcibly taken away from a process. A resource can be released only voluntarily by the process holding it.
  4. Circular Wait: A set of processes are waiting for each other in a circular chain. Each process holds at least one resource and is waiting for a resource held by the next process in the chain.
16. Consider the following page reference string
1, 0, 7, 1, 0, 2, 1, 2, 3, 0, 3, 2, 4, 0, 3, 0, 2, 1, 0, 7
Assume 3 frames, calculate number of page fault using FIFO and LRU page replacement technique.

Given:

  • Page Reference String: 1, 0, 7, 1, 0, 2, 1, 2, 3, 0, 3, 2, 4, 0, 3, 0, 2, 1, 0, 7

  • Number of Frames: 3

16. Please solve on your own until the official answer is provided.

17. Explain linked list method of free space management.

The Linked List Method is one way to manage free space on storage devices (like disks). In this method, all free disk blocks are linked together using pointers.

Free space management refers to the process of keeping track of all the free blocks in the storage system (like RAM or hard disk) so that they can be reused when needed for storing data, processes, or files.

Key Points:

  • Each free block contains a pointer to the next free block.

  • The Operating System maintains a head pointer to the beginning of the free space list.

  • When a block is allocated, the OS removes it from the list.

  • When a block is freed, it is added back to the list.

Advantages:

  • Easy to implement.

  • Efficient for sequential allocation and deallocation.

Disadvantages:

  • Accessing free blocks is sequential, not direct.

  • Pointer storage inside blocks uses some space.

Applications

  • File systems: To track unused disk blocks.

  • Memory allocation: To keep track of unused memory segments in heap management.

Section - C

II. Answer any FOUR of the following. (4×5=20)

18. Explain Batch operating system and time sharing operating system.

A Batch Operating System is one of the earliest types of operating systems where users submit jobs (programs and data) in batches to be executed one after another without manual intervention.

  • Users submit jobs to the computer operator.

  • The operator collects similar jobs and forms a batch.

  • The batch is submitted to the OS for processing.

  • After execution, the output is returned to the users.

Advantages:

  • Efficient for large-scale repetitive tasks.
  • Reduces idle time of the CPU by automating job execution.

Disadvantages:

  • No interactivity (users cannot modify jobs while running).
  • Slow turnaround time (users must wait until the entire batch completes).

A Time-Sharing Operating System allows multiple users to interact with a computer system simultaneously by rapidly switching CPU time among different tasks.

  • The CPU switches rapidly among users.

  • Each user’s task is given a time quantum (e.g., 10 milliseconds).

  • If the task doesn’t complete in that time, it’s paused and another user’s task runs.

Features:

  • Multi-user system: Many users work simultaneously.

  • Interactive: Users can interact with running programs.

  • Quick response time and efficient CPU utilization.

Advantages:

  • Better CPU utilization.

  • Fast response time for users.

  • Efficient for interactive applications.

Disadvantages:

  • Complex system design.

  • Security and data protection issues due to multi-user access.

  • Requires expensive hardware (at the time of invention).

19. Consider the following set of processes with the length of CPU burst time in milliseconds.
ProcessBurst Time (ms)
P13
P21
P33
P44
P52

Draw Gantt chart illustrating the execution of these process using FCFS and round robi (quantum time – 1 msec) scheduling method.

19. Please solve on your own until the official answer is provided.

20. Explain the following:
a) Operation on File

Files are essential components of an operating system, and various operations can be performed on them. These operations include:

1. File Creation

  • A new file is created in the file system.

  • Example: create("example.txt")

2. File Opening

  • A file must be opened before reading/writing.

  • Example: open("example.txt", mode="read")

3. File Reading

  • Data is read from an existing file.

  • Example: read("example.txt", buffer, size)

4. File Writing

  • Data is written into a file (overwrites or appends).

  • Example: write("example.txt", "Hello World")

5. File Closing

  • After operations, the file is closed to free system resources.

  • Example: close("example.txt")

6. File Deletion (Removing)

  • A file is removed from the file system.

  • Example: delete("example.txt")

7. File Truncation

  • The file size is reduced (content beyond a certain point is deleted).

  • Example: truncate("example.txt", size=100)

8. File Seeking (Positioning)

  • The file pointer is moved to a specific position.

  • Example: seek("example.txt", offset=50)

9. File Renaming

  • A file is given a new name.

  • Example: rename("old.txt", "new.txt")

10. File Copying

  • A duplicate of the file is created.

  • Example: copy("source.txt", "destination.txt")

b) Attributes of File.

Files have metadata (attributes) that describe their properties. These attributes are managed by the file system and include:

1. File Name

  • A human-readable identifier (e.g., document.txt).

2. File Type

  • Indicates the format (e.g., .txt.exe.jpg).

3. File Size

  • The amount of storage occupied (in bytes).

4. Location (Path)

  • The directory where the file is stored (e.g., /home/user/file.txt).

5. Creation Time

  • The date and time when the file was created.

6. Last Modified Time

  • The timestamp of the most recent modification.

7. Last Access Time

  • When the file was last read.

8. Owner & Permissions

  • User/group ownership and access rights (read, write, execute).

9. Protection Mode

  • Access control settings (e.g., read-only, hidden).

10. File Handle (Descriptor)

  • A unique identifier used by the OS to manage open file.

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    error: Content is protected !!