You are on page 1of 4

NAME

M.ZULQARNAIN

REG#
UW-20-CS-BS-063

SEMESTER
5TH-B

COURSE
OPEARATING SYSTEM
QUESTION-01
What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be
generated intentionally by a user program? If so, for what purpose?

ANSWER

Purpose of interrupts
 • Interrupts instruct the CPU to stop executing the present job or activity and instantly begin
executing other activities of greater priority.
 • Interrupts switch programme control to particular addresses on the demand.
 • Interrupts allow users to multitask, so we can use them to do multiple things at the same time.

 • Interrupts enable multitasking, therefore matching the speed of external devices to the speed
of the CPU enhances CPU efficiency and minimizes CPU latency. Enter kernel mode.

 • Interrupt prevents unused instruction cycles.

Difference between interrupts and traps

Traps
A trap is created by software. They are generated by instructions in the User Program. Traps occur
synchronously, following the execution of any procedure. Traps are used by the code in the same way
that programmes are. to call OS procedures, for instance. Traps typically cause a switch to the kernel
mode, where the desired operations are normally carried out.

Interrupts
An interrupt is a signal generated by an event or I/O devices. Hardware produces interrupts. Interrupts
occur asynchronously; they occur during the execution of a process. Events cause an interrupt. They
Events make a request for an interruption. The direction of execution is changed by them.

Can traps be generated intentionally by a user program


A trap is a software generated. They are generated by instruction in the User Program. A trap can be
generated intentionally by a user program. It can be used to call operating system routines or to catch
arithmetic errors.

QUESTION-02
Consider the RPC mechanism. Describe the undesirable circumstances that could arise from not
enforcing either the “at most once “or “exactly onec “semantics. Describe possible uses for a
mechanism that had neither of these guarantees.

ANSWER
If an RPC mechanism is incapable of offering either the "at most once" or "at least once" semantics, the
RPC server cannot guarantee that a remote operation will not be conducted multiple times. Take into
account what would transpire if a remote operation tried to withdraw money from a bank account on a
system that did not support these semantics. Multiple withdrawals from the server may occur as a result
of a single call to the distant process. The server must normally keep some kind of client state, such as
the timestamp mentioned in the text, in order to enable any of these semantics... A system can only offer
secure remote operations that do not alter data or provide time-sensitive results if it is unable to satisfy
any of these semantics. As an illustration, let's use our bank account. When making a withdrawal (or
deposit! ), we surely require "at most once" or "at least once" semantics. These semantics are not
required for an inquiry for an account balance or other account information, such as name, address, and
so on.

QUESTION-03
It is sometimes difficult to achieve a layered approach if two components of the operating
system are dependent on each other. Identify a scenario in which it is unclear how to layer two
system components that require tight coupling of their functionalities.
ANSWER
The storage subsystem and the virtual memory subsystem are two examples of two system components
that are closely connected. The virtual memory subsystem of many computers stores files there for the
purpose of executing them, whereas the storage subsystem is used by the virtual memory subsystem to
store programme elements that do not concurrently live in virtual memory. While a programme is
running, the file system can be changed concurrently, and those updates are first placed in virtual
memory before being placed in the storage subsystem. The two systems must carefully coordinate in
order to do this.

You might also like