Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views6 pages

Os

It can
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

Os

It can
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Q1.

Attempt any eight of the following:

(a) Write any two services provided by OS.


Operating systems provide services like process management (creating, deleting, managing
processes) and memory management (allocating and deallocating memory). Other services
include file system management, I/O management, security, and networking.

(b) What is meant by System Call?


A system call is a way for a program running in user mode to request a service from the
kernel of the operating system. It's the interface between user applications and the OS.

(c) What is a process?


A process is an instance of a computer program that is being executed. It includes the
program code, its current activity, processor registers, program counter, stack, heap, and
other resources.

(d) Define a safe state.


A system is in a safe state if there exists a sequence of all the processes currently running
such that each process can finish its execution even if all other processes request their
maximum number of resources.

(e) What is a dispatcher?


The dispatcher is a component of the CPU scheduler that selects the process that should be
executed next and allocates the CPU to it.

(f) What is throughput?


Throughput is the number of processes that are completed per unit of time. It's a measure of
system efficiency.

(g) What do you mean by Rollback?


Rollback is a mechanism used in database and operating systems to revert a system or
process to a previous consistent state, often used in case of errors or failures.

(h) What is meant by Address Binding?


Address binding is the process of associating symbolic (logical) addresses used in a
program with actual physical addresses in memory. This can happen at compile time, load
time, or execution time.

(i) List various operating system files.


Operating systems have numerous files, including:

Kernel files: The core of the OS.


Configuration files: Settings for the OS and applications.
System libraries: Code used by various programs.
Device drivers: Enable communication with hardware.
Log files: Record system events.
(j) What do you mean by Deadlock?
Deadlock is a situation where two or more processes are blocked indefinitely, each waiting
for a resource that is held by one of the other processes.

Q2. Attempt any four of the following:

(a) Explain Operating System Structure.


The structure of an operating system can vary, but common models include:

Monolithic: All OS components are in the kernel.


Layered: OS is organized in layers, each building on the layer below.
Microkernel: Minimal kernel provides essential services, with other services in user space.
Modular: Core kernel with dynamically loadable modules.
(b) Explain 'Dining Philosopher's Synchronization problem'.
The Dining Philosophers problem illustrates the challenges of resource allocation and
deadlock in concurrent systems. Several philosophers sit at a circular table with one
chopstick between each pair. They need two chopsticks to eat. The problem arises when
each philosopher picks up their left chopstick and waits indefinitely for their right chopstick,
which is held by their neighbor.

(c) Explain different methods for recovery from deadlock.


Methods for deadlock recovery include:

Process termination: Aborting one or more processes involved in the deadlock.


Resource preemption: Forcibly taking resources away from one or more deadlocked
processes and giving them to others until the deadlock is broken.
(d) What is Fragmentation? Explain different types of fragmentation in detail.
Fragmentation is the phenomenon where usable memory space becomes divided into many
small, non-contiguous blocks. There are two main types:

External Fragmentation: Sufficient total free memory exists to satisfy a request, but it is not
contiguous. This often happens with dynamic memory allocation.
Internal Fragmentation: Allocated memory blocks may be slightly larger than the requested
size, resulting in wasted space within the block. This is common with fixed-size partitioning.
(e) List and explain system calls related to Process and Job control.
System calls related to process and job control include:

fork(): Creates a new process (child process).


exec(): Replaces the current process's memory space with a new program.
wait(): Suspends the execution of the calling process until one of its child processes
terminates.
exit(): Terminates the calling process.
kill(): Sends a signal to a process.
getpid(): Returns the process ID of the calling process.
nice(): Changes the priority of a process.
Q3) Write a short note on any two of the following:

(a) Write a note on interrupts.

Interrupts are signals that alert the operating system or a running program to an event that
requires immediate attention. These events can originate from hardware (like a device
finishing an I/O operation, a hardware error, or a timer expiring) or software (like a system
call or an exception). When an interrupt occurs, the CPU temporarily suspends its current
task, saves its state, and transfers control to a specific interrupt handler routine. This routine
processes the interrupt and then typically returns control to the interrupted program,
restoring its saved state. Interrupts are crucial for making systems responsive and efficient,
allowing the CPU to handle asynchronous events without constantly polling devices.

(b) Explain semaphores and the types in detail.

Semaphores are integer variables that, along with two atomic operations (wait and signal),
are used for process synchronization and mutual exclusion in concurrent programming. They
help control access to shared resources and coordinate the execution of multiple processes
or threads.

There are two main types of semaphores:

●​ Binary Semaphores (Mutex Locks): These semaphores have an integer value that
can be either 0 or 1. They are primarily used to implement mutual exclusion, ensuring
that only one process can access a critical section at any given time. A value of 1
typically indicates that the resource is available, and a value of 0 indicates that it is
currently being held.​

●​ Counting Semaphores: These semaphores can have a non-negative integer value,


representing the number of available units of a particular resource. Processes can
decrement the semaphore to acquire a resource unit and increment it when they
release a unit. Counting semaphores are useful for managing a pool of identical
resources.​

(c) Write a short note on fragmentation.

Fragmentation is a phenomenon in memory management where usable memory space


becomes divided into many small, non-contiguous blocks. This makes it difficult to allocate
larger blocks of memory to processes, even if the total free memory is sufficient. There are
two main types of fragmentation:

●​ External Fragmentation: This occurs when there is enough total memory space to
satisfy a request, but it is not contiguous. It arises from the allocation and
deallocation of memory blocks of varying sizes, leaving behind scattered free spaces.​
●​ Internal Fragmentation: This occurs when a process is allocated a memory block
that is larger than it actually needs. The extra space within the allocated block
remains unused and is wasted. This often happens with fixed-size partitioning
schemes where processes are allocated in multiples of a fixed block size.​

Q4) Attempt any four of the following:

(a) What is meant by Shortest-Seek-Time-First? Explain in detail.

Shortest-Seek-Time-First (SSTF) is a disk scheduling algorithm that selects the disk request
with the minimum seek time from the current head position. In simpler terms, the disk head
moves to the closest pending request on the disk. This approach aims to reduce the overall
seek time and improve throughput compared to algorithms like First-Come, First-Served
(FCFS).

Here's how it works:

1.​ The disk head starts at a given initial position.


2.​ The algorithm examines all pending disk requests and calculates the seek time
(number of tracks the head needs to move) from the current head position to each
request.
3.​ The request with the shortest seek time is selected next, and the disk head moves to
that track.
4.​ Once the request is serviced, the process repeats from the new head position until all
requests are serviced.

While SSTF generally reduces the average seek time, it can lead to starvation for requests
that are far from the current head position if there is a continuous stream of requests closer
to the head.

(b) Define the terms:

●​ Logical Address: A logical address (also known as a virtual address) is the address
generated by the CPU during program execution. It is a virtual address because it
does not directly correspond to the physical address in the main memory. The
memory management unit (MMU) translates logical addresses to physical addresses
before the memory access.​

●​ Physical Address: A physical address (also known as a real address) is the actual
address of a memory location in the main memory. It is the address that is used by
the memory hardware to access the memory cells.​

(c) Explain Resource Allocation Graph in detail.

A Resource Allocation Graph (RAG) is a directed graph used to model the state of resource
allocation and process requests in an operating system. It helps in detecting and preventing
deadlocks. A RAG consists of two types of nodes:
●​ Processes: Represented by circles.
●​ Resources: Represented by rectangles. Each resource type can have multiple
instances, which are represented by dots inside the rectangle.

The graph contains two types of edges:

●​ Request Edge: A directed edge from a process to a resource instance indicates that
the process has requested an instance of that resource type.
●​ Assignment Edge: A directed edge from a resource instance to a process indicates
that an instance of that resource type has been allocated to the process.

A cycle in the Resource Allocation Graph indicates a potential deadlock situation. If there is
a cycle and each resource involved in the cycle has only one instance, then a deadlock
definitely exists. If there are multiple instances of resources, a cycle is a necessary but not
sufficient condition for a deadlock.

(d) Differentiate between Preemptive and Non-Preemptive Scheduling.

Feature Preemptive Scheduling Non-Preemptive


Scheduling

CPU Allocation The CPU can be forcibly Once a process is allocated


taken away from a running the CPU, it continues to run
process before it completes until it voluntarily releases
its CPU burst. the CPU (either by
completing its burst or by
requesting I/O).

Interrupts Relies on interrupts (e.g., Does not rely on external


timer interrupts) to switch interrupts for scheduling
between processes. decisions.

Context Switching Higher frequency of context Lower frequency of context


switching due to forced switching.
preemption.

Responsiveness Generally provides better Can lead to poor


responsiveness, especially responsiveness if a
for high-priority processes. long-running process holds
the CPU.

Complexity More complex to implement Simpler to implement.


due to the need for context
switching mechanisms.

Examples Round Robin, Priority First-Come, First-Served


Scheduling (with (FCFS), Shortest Job First
preemption), Shortest (SJF), Priority Scheduling
Remaining Time First (SR (without preemption).

You might also like