Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

ABASYN UNIVERSITY PESHAWAR

DEPARTMENT OF COMPUTER SCIENCE

Assignment: 02

Subject: - Operating System Concept

Class /section: - CB

Submitted to: - Lecturer Wajid Ullah

Submitted by: - Adnan Alam

Reg no: 13800

Date: - 04/10/2021
Q1: How interrupts works in OS?

Answer:

Interrupt refer to the signals sent by external devices, normally I/O devices, to alert their
respective processors to an event, requiring attention, and to stop the currently
executing code so that a new one can be started. These are very important because they
give users better control of the system.

How does it work?

Basically, a single computer can perform only one computer instruction at a time. But,
because it can be interrupted, control is transferred to the operating system, which
determines the action to be taken. The OS can take turns in which programs or sets of
instructions that it performs. This is known as multitasking and allows the user to do a
number of different things at the same time. This is done through the code in the OS
which is called an interrupt handler. This prioritizes the interrupts and saves them in a
queue if more than one is waiting to be handled. There is also another little program,
sometimes called a scheduler that figures out which program to give control to next.
Interrupts are prioritized, so the higher the priority, the faster it will be handled.
An example of an interrupt is a signal to stop Microsoft Word so that a PowerPoint
presentation can start. This is called software interrupt where an application program
terminates or requests certain services from the operating system.

Q2: Through bus communication how we can read the data from
memory address 0. and write it to address 15. write each and every
step in sequential order.

Answer:

A bus or sometimes called a data highway because it is practically a pathway for digital
signals to rapidly move data. It s also define as a communication system that transfers
data between components inside a computer, or between computers.
And since the processor reads and writes data, moving in and out of the data bus is bi-
directional. There are three internal buses associated with processors: the data bus,
address bus, and control bus
Suppose we want to read data from memory address 0 and write it to address 15, here's
what happens,

 To get the data from the memory address 0 to the CPU, the address is copied
into a register called Memory Address Register or MAR).
 The register then sends the equivalent value to memory via the address bus
which is responsible for identifying the address of the location in cache or main
memory that is to be read from (memory address 0).
 The control unit then signals the memory via the control bus, telling that it is a
"read" operation
 The data will then be transferred from the memory to the register on the address
received via address bus. Transmission is done via the data bus which is also
responsible for distributing and managing real-time data in intelligent distributed
systems.
 For transferring data from register to a memory, the data to write is copied into
the MBR or memory buffer register.
 The MBR then sends its value on the data bus to memory.
 The control unit then signals the memory via the control bus, telling that it is a
"write" operation.
 The memory then stores the data into the memory address received from the
address bus.
Q3: Draw the instruction cycle with interrupt and without interrupt
(state Diagram)

ANSWER:

The instruction cycle refers to the process involved to execute a single instruction. The
two steps involve are fetch and execute. But sometimes, it is also called the fetch-
decode-execute cycle. A state diagram illustrates the basic operation cycle of a
computer. This is the process by which a computer retrieves a program instruction from
memory, determines what actions the instruction requires, and carries them out. It is
repeated continuously by the central processing unit (CPU) from the time the computer
starts until it is shut down.

The End:

You might also like