0% found this document useful (0 votes)
0 views

computer architecture

Uploaded by

075bei042
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

computer architecture

Uploaded by

075bei042
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 96

1.

2 RAID
RAID (Redundant Arrays of Independent Disks) is a technique that makes use
of a combination of multiple disks for storing the data instead of using a
single disk for increased performance, data redundancy, or to protect data in
the case of a drive failure. The term was defined by David Patterson, Garth A.
Gibson, and Randy Katz at the University of California, Berkeley in 1987. In
this article, we are going to discuss RAID and types of RAID their
Advantages and disadvantages in detail.

What is RAID?
RAID (Redundant Array of Independent Disks) is like having backup copies of
your important files stored in different places on several hard drives or
solid-state drives (SSDs). If one drive stops working, your data is still safe
because you have other copies stored on the other drives. It’s like having a
safety net to protect your files from being lost if one of your drives breaks
down.

RAID (Redundant Array of Independent Disks) in a Database Management


System (DBMS) is a technology that combines multiple physical disk drives
into a single logical unit for data storage. The main purpose of RAID is to
improve data reliability, availability, and performance. There are different
levels of RAID, each offering a balance of these benefits.

How RAID Works?


Let us understand How RAID works with an example- Imagine you have a
bunch of friends, and you want to keep your favorite book safe. Instead of
giving the book to just one friend, you make copies and give a piece to each
friend. Now, if one friend loses their piece, you can still put the book together
from the other pieces. That’s similar to how RAID works with hard drives. It
splits your data across multiple drives, so if one drive fails, your data is still
safe on the others. RAID helps keep your information secure, just like
spreading your favorite book among friends keeps it safe

What is a RAID Controller?


A RAID controller is like a boss for your hard drives in a big storage system. It
works between your computer’s operating system and the actual hard drives,
organizing them into groups to make them easier to manage. This helps
speed up how fast your computer can read and write data, and it also adds a
layer of protection in case one of your hard drives breaks down. So, it’s like
having a smart helper that makes your hard drives work better and keeps
your important data safer.

Types of RAID Controller

There are three types of RAID controller:

Hardware Based: In hardware-based RAID, there’s a physical controller that


manages the whole array. This controller can handle the whole group of hard
drives together. It’s designed to work with different types of hard drives, like
SATA (Serial Advanced Technology Attachment) or SCSI (Small Computer
System Interface). Sometimes, this controller is built right into the computer’s
main board, making it easier to set up and manage your RAID system. It’s like
having a captain for your team of hard drives, making sure they work
together smoothly.

Software Based: In software-based RAID, the controller doesn’t have its own
special hardware. So it use computer’s main processor and memory to do its
job. It perform the same function as a hardware-based RAID controller, like
managing the hard drives and keeping your data safe. But because it’s
sharing resources with other programs on your computer, it might not make
things run as fast. So, while it’s still helpful, it might not give you as big of a
speed boost as a hardware-based RAID system
Firmware Based: Firmware-based RAID controllers are like helpers built into
the computer’s main board. They work with the main processor, just like
software-based RAID. But they only implement when the computer starts up.
Once the operating system is running, a special driver takes over the RAID
job. These controllers aren’t as expensive as hardware ones, but they make
the computer’s main processor work harder. People also call them
hardware-assisted software RAID, hybrid model RAID, or fake RAID.

Why Data Redundancy?


Data redundancy, although taking up extra space, adds to disk reliability. This
means, that in case of disk failure, if the same data is also backed up onto
another disk, we can retrieve the data and go on with the operation. On the
other hand, if the data is spread across multiple disks without the RAID
technique, the loss of a single disk can affect the entire data.

Key Evaluation Points for a RAID System


● Reliability: How many disk faults can the system tolerate?

● Availability: What fraction of the total session time is a system in

uptime mode, i.e. how available is the system for actual use?

● Performance: How good is the response time? How high is the

throughput (rate of processing work)? Note that performance

contains a lot of parameters, not just the two.

● Capacity: Given a set of N disks each with B blocks, how much

useful capacity is available to the user?

RAID is very transparent to the underlying system. This means, that to the
host system, it appears as a single big disk presenting itself as a linear array
of blocks. This allows older technologies to be replaced by RAID without
making too many changes to the existing code.

Different RAID Levels


● RAID-0 (Stripping)

● RAID-1 (Mirroring)

● RAID-2 (Bit-Level Stripping with Dedicated Parity)

● RAID-3 (Byte-Level Stripping with Dedicated Parity)

● RAID-4 (Block-Level Stripping with Dedicated Parity)

● RAID-5 (Block-Level Stripping with Distributed Parity)

● RAID-6 (Block-Level Stripping with two Parity Bits)

Raid Controller

1. RAID-0 (Stripping)

● Blocks are “stripped” across disks.


RAID-0

● In the figure, blocks “0,1,2,3” form a stripe.

● Instead of placing just one block into a disk at a time, we can work

with two (or more) blocks placed into a disk before moving on to the

next one.
Raid-0

Evaluation
● Reliability: 0

There is no duplication of data. Hence, a block once lost cannot be

recovered.

● Capacity: N*B

The entire space is being used to store data. Since there is no

duplication, N disks each having B blocks are fully utilized.

Advantages
● It is easy to implement.

● It utilizes the storage capacity in a better way.

Disadvantages
● A single drive loss can result in the complete failure of the system.
● It’s not a good choice for a critical system.

2. RAID-1 (Mirroring)

● More than one copy of each block is stored in a separate disk. Thus,

every block has two (or more) copies, lying on different disks.

Raid-1

● The above figure shows a RAID-1 system with mirroring level 2.

● RAID 0 was unable to tolerate any disk failure. But RAID 1 is

capable of reliability.

Evaluation
Assume a RAID system with mirroring level 2.

● Reliability: 1 to N/2

1 disk failure can be handled for certain because blocks of that disk
would have duplicates on some other disk. If we are lucky enough

and disks 0 and 2 fail, then again this can be handled as the blocks

of these disks have duplicates on disks 1 and 3. So, in the best case,

N/2 disk failures can be handled.

● Capacity: N*B/2

Only half the space is being used to store data. The other half is just

a mirror of the already stored data.

Advantages
● It covers complete redundancy.

● It can increase data security and speed.

Disadvantages
● It is highly expensive.

● Storage capacity is less.

3. RAID-2 (Bit-Level Stripping with Dedicated Parity)

● In Raid-2, the error of the data is checked at every bit level. Here, we

use Hamming Code Parity Method to find the error in the data.

● It uses one designated drive to store parity.

● The structure of Raid-2 is very complex as we use two disks in this

technique. One word is used to store bits of each word and another

word is used to store error code correction.

● It is not commonly used.


Advantages
● In case of Error Correction, it uses hamming code.

● It Uses one designated drive to store parity.

Disadvantages
● It has a complex structure and high cost due to extra drive.

● It requires an extra drive for error detection.

4. RAID-3 (Byte-Level Stripping with Dedicated Parity)

● It consists of byte-level striping with dedicated parity striping.

● At this level, we store parity information in a disc section and write

to a dedicated parity drive.

● Whenever failure of the drive occurs, it helps in accessing the parity

drive, through which we can reconstruct the data.


Raid-3

● Here Disk 3 contains the Parity bits for Disk 0, Disk 1, and Disk 2. If

data loss occurs, we can construct it with Disk 3.

Advantages
● Data can be transferred in bulk.

● Data can be accessed in parallel.

Disadvantages
● It requires an additional drive for parity.

● In the case of small-size files, it performs slowly.

5. RAID-4 (Block-Level Stripping with Dedicated Parity)

● Instead of duplicating data, this adopts a parity-based approach.

Raid-4
● In the figure, we can observe one column (disk) dedicated to parity.

● Parity is calculated using a simple XOR function. If the data bits are

0,0,0,1 the parity bit is XOR(0,0,0,1) = 1. If the data bits are 0,1,1,0

the parity bit is XOR(0,1,1,0) = 0. A simple approach is that an even

number of ones results in parity 0, and an odd number of ones

results in parity 1.

Raid-4

● Assume that in the above figure, C3 is lost due to some disk failure.

Then, we can recompute the data bit stored in C3 by looking at the

values of all the other columns and the parity bit. This allows us to

recover lost data.

Evaluation
● Reliability: 1

RAID-4 allows recovery of at most 1 disk failure (because of the

way parity works). If more than one disk fails, there is no way to

recover the data.

● Capacity: (N-1)*B

One disk in the system is reserved for storing the parity. Hence,

(N-1) disks are made available for data storage, each disk having B

blocks.

Advantages
● It helps in reconstructing the data if at most one data is lost.

Disadvantages
● It can’t help reconstructing data when more than one is lost.

6. RAID-5 (Block-Level Stripping with Distributed Parity)

● This is a slight modification of the RAID-4 system where the only

difference is that the parity rotates among the drives.


Raid-5

● In the figure, we can notice how the parity bit “rotates”.

● This was introduced to make the random write performance better.

Evaluation
● Reliability: 1

RAID-5 allows recovery of at most 1 disk failure (because of the

way parity works). If more than one disk fails, there is no way to

recover the data. This is identical to RAID-4.

● Capacity: (N-1)*B

Overall, space equivalent to one disk is utilized in storing the parity.

Hence, (N-1) disks are made available for data storage, each disk

having B blocks.

Advantages
● Data can be reconstructed using parity bits.

● It makes the performance better.

Disadvantages
● Its technology is complex and extra space is required.

● If both discs get damaged, data will be lost forever.

7. RAID-6 (Block-Level Stripping with two Parity Bits)

● Raid-6 helps when there is more than one disk failure. A pair of

independent parities are generated and stored on multiple disks at

this level. Ideally, you need four disk drives for this level.

● There are also hybrid RAIDs, which make use of more than one

RAID level nested one after the other, to fulfill specific requirements.

Raid-6
Advantages
● Very high data Accessibility.

● Fast read data transactions.

Disadvantages
● Due to double parity, it has slow write data transactions.

● Extra space is required.

Advantages of RAID
● Data redundancy: By keeping numerous copies of the data on many

disks, RAID can shield data from disk failures.

● Performance enhancement: RAID can enhance performance by

distributing data over several drives, enabling the simultaneous

execution of several read/write operations.

● Scalability: RAID is scalable, therefore by adding more disks to the

array, the storage capacity may be expanded.

● Versatility: RAID is applicable to a wide range of devices, such as

workstations, servers, and personal PCs

Disadvantages of RAID
● Cost: RAID implementation can be costly, particularly for arrays with

large capacities.

● Complexity: The setup and management of RAID might be

challenging.
● Decreased performance: The parity calculations necessary for some

RAID configurations, including RAID 5 and RAID 6, may result in a

decrease in speed.

● Single point of failure: RAID is not a comprehensive backup

solution while offering data redundancy. The array’s whole contents

could be lost if the RAID controller malfunctions.

Conclusion
In Conclusion, RAID technology in database management systems distributes
and replicates data across several drives to improve data performance and
reliability. It is a useful tool in contemporary database setups since it is
essential to preserving system availability and protecting sensitive data.

Interrupt
Interrupts play a crucial role in computer devices by allowing the processor to
react quickly to events or requests from external devices or software. In this
article, we are going to discuss every point about interruption and its various
types in detail.

What is an Interrupt?
The interrupt is a signal emitted by hardware or software when a process or
an event needs immediate attention. It alerts the processor to a high-priority
process requiring interruption of the current working process. In I/O devices
one of the bus control lines is dedicated for this purpose and is called the
Interrupt Service Routine (ISR).
When a device raises an interrupt at let’s say process i, the processor first
completes the execution of instruction i. Then it loads the Program Counter
(PC) with the address of the first instruction of the ISR. Before loading the
Program Counter with the address, the address of the interrupted instruction
is moved to a temporary location. Therefore, after handling the interrupt the
processor can continue with process i+1.

While the processor is handling the interrupts, it must inform the device that
its request has been recognized so that it stops sending the interrupt request
signal. Also, saving the registers so that the interrupted process can be
restored in the future, increases the delay between the time an interrupt is
received and the start of the execution of the ISR. This is called Interrupt
Latency.

Types of Interrupt
Event-related software or hardware can trigger the issuance of interrupt
signals. These fall into one of two categories: software interrupts or
hardware interrupts.

1. Software Interrupts

A sort of interrupt called a software interrupt is one that is produced by


software or a system as opposed to hardware. Traps and exceptions are
other names for software interruptions. They serve as a signal for the
operating system or a system service to carry out a certain function or
respond to an error condition. Generally, software interrupts occur as a result
of specific instructions being used or exceptions in the operation. In our
system, software interrupts often occur when system calls are made. In
contrast to the fork() system call, which also generates a software interrupt,
division by zero throws an exception that results in the software interrupt.
A particular instruction known as an “interrupt instruction” is used to create
software interrupts. When the interrupt instruction is used, the processor
stops what it is doing and switches over to a particular interrupt handler
code. The interrupt handler routine completes the required work or handles
any errors before handing back control to the interrupted application.

2. Hardware Interrupts

In a hardware interrupt, all the devices are connected to the Interrupt


Request Line. A single request line is used for all the n devices. To request an
interrupt, a device closes its associated switch. When a device requests an
interrupt, the value of INTR is the logical OR of the requests from individual
devices.

Hardware interrupts are further divided into two types of interrupt

● Maskable Interrupt: Hardware interrupts can be selectively enabled

and disabled thanks to an inbuilt interrupt mask register that is

commonly found in processors. A bit in the mask register

corresponds to each interrupt signal; on some systems, the interrupt

is enabled when the bit is set and disabled when the bit is clear, but

on other systems, the interrupt is deactivated when the bit is set.

● Spurious Interrupt: A hardware interrupt for which there is no

source is known as a spurious interrupt. This phenomenon might

also be referred to as phantom or ghost interrupts. When a

wired-OR interrupt circuit is connected to a level-sensitive processor

input, spurious interruptions are typically an issue. When a system

performs badly, it could be challenging to locate these interruptions.


Sequences of Events Involved in Handling an IRQ(Interrupt Request)

● Devices raise an IRQ.

● The processor interrupts the program currently being executed.

● The device is informed that its request has been recognized and the

device deactivates the request signal.

● The requested action is performed.

● An interrupt is enabled and the interrupted program is resumed.

Flowchart of Interrupt Handling Mechanism


The Image below depicts the flowchart of interrupt handling mechanism

Step 1:- Any time that an interrupt is raised, it may either be an I/O interrupt
or a system interrupt.

Step 2:- The current state comprising registers and the program counter is
then stored in order to conserve the state of the process.

Step 3:- The current interrupt and its handler is identified through the
interrupt vector table in the processor.
Step 4:- This control now shifts to the interrupt handler, which is a function
located in the kernel space.

Step 5:- Specific tasks are performed by Interrupt Service Routine (ISR) which
are essential to manage interrupt.

Step 6:- The status from the previous session is retrieved so as to build on
the process from that point.

Step 7:- The control is then shifted back to the other process that was
pending and the normal process continues.

Managing Multiple Devices


When more than one device raises an interrupt request signal, then
additional information is needed to decide which device to be considered
first. The following methods are used to decide which device to select:
Polling, Vectored Interrupts, and Interrupt Nesting. These are explained
below.

● Polling: In polling, the first device encountered with the IRQ bit set

is the device that is to be serviced first. Appropriate ISR is called to

service the same. It is easy to implement but a lot of time is wasted

by interrogating the IRQ bit of all devices.

● Vectored Interrupts: In vectored interrupts, a device requesting an

interrupt identifies itself directly by sending a special code to the

processor over the bus. This enables the processor to identify the

device that generated the interrupt. The special code can be the

starting address of the ISR or where the ISR is located in memory

and is called the interrupt vector.


● Interrupt Nesting: In this method, the I/O device is organized in a

priority structure. Therefore, an interrupt request from a

higher-priority device is recognized whereas a request from a

lower-priority device is not. The processor accepts interrupts only

from devices/processes having priority.

Processors’ priority is encoded in a few bits of PS (Process Status register). It


can be changed by program instructions that are written into the PS. The
processor is in supervised mode only while executing OS routines. It switches
to user mode before executing application programs.

What is Interrupt Latency?


The amount of time between the generation of an interrupt and its handling
is known as interrupt latency. The number of created interrupts, the number
of enabled interruptions, the number of interrupts that may be handled, and
the time required to handle each interrupt all affect interrupt latency. When
the device generating the interrupt needs a specific length of time to
generate the interrupt, interrupt latency is required. For instance, if a printer is
printing paper, the computer needs to stop the printing program and wait for
the document to finish printing. The interrupt latency is the amount of time
the computer has to stop the program from operating.

How CPU React when Interrupt occurs?


● Interrupt Detection: The CPU continuously video displays unit

interrupt lines or alerts from diverse resources, consisting of

hardware gadgets or software program commands, to hit upon

interrupt requests.
● Interrupt Acknowledgment: Upon detecting an interrupt request,

the CPU acknowledges the interrupt using sending an

acknowledgment sign to the interrupting device or software

program.

● Interrupt Handling: The CPU identifies the form of interrupt

primarily based on its supply, together with a hardware interrupt

from a device or a software interrupt from a training. It then seems

the cope with the corresponding interrupt handler habitual within

the interrupt vector desk.

● Context Saving: Before moving manipulate to the interrupt handler

ordinary, the CPU saves the present-day execution context, inclusive

of the program counter (PC), processor state, and any applicable

sign-in contents, onto the stack or in the devoted garage.

● Transfer Control: The CPU transfers manipulation to the interrupt

handler ordinary with the aid of placing this system counter (PC) to

the address of the handler habitual retrieved from the interrupt

vector desk.

● Interrupt Servicing: The interrupt handler habitual executes to

carrier the interrupt. It plays responsibilities to interrupt, such as

reading facts from a device, processing enter/output operations, or

coping with a software program request.


Triggering Methods
Every interrupt signal input is intended to be activated by a certain signal
edge (level change) or a logic signal level. Level-sensitive inputs make
constant requests for processor attention as long as they are treated with a
specific logic level (high or low). Edge-sensitive inputs are responsive to
signal edges; a service request will latch on to a specific (rising or falling)
edge. When the interrupt handler runs, the CPU resets the latch.

● Level-Trigger: The interrupt signal must be held at its specific active

logic level (high or low) to request a level-triggered interrupt. A

level-triggered interrupt is triggered when a device drives the signal

to the active level and maintains it there. When the CPU instructs it

to do so, usually after the device has been serviced, it denies the

signal.

● Edge-Trigger: An interrupt that is caused by a level change on the

interrupt line—either a rising or lowering edge—is known as an

edge-triggered interrupt (low to high). A pulse is driven onto the

line and released to its inactive state by a device that wishes to

indicate an interrupt. It can be necessary to use specialized

hardware to detect the pulse if polled I/O is unable to pick it up due

to its short duration.

Benefits of Interrupt
● Real-time Responsiveness: Interrupts permit a system to reply

promptly to outside events or signals, permitting real-time

processing.

● Efficient Resource usage: Interrupt-driven structures are more

efficient than system that depend on busy-waiting or polling

strategies. Instead of continuously checking for the incidence of

event, interrupts permit the processor to remain idle until an event

occurs, conserving processing energy and lowering energy intake.

● Multitasking and Concurrency: Interrupts allow multitasking with

the aid of allowing a processor to address multiple tasks

concurrently.

● Improved system Throughput: By coping with occasions

asynchronously, interrupts allow a device to overlap computation

with I/O operations or other responsibilities, maximizing system

throughput and universal overall performance.

Conclusion
● The events known as interrupts alert the CPU to handle the request.

● Both software and hardware can create interruptions.

● Maskable and non-maskable interrupts are the two categories of

hardware interrupts.

● Generally speaking, exceptions and special instructions like fork()

are what trigger software interrupts.


● After completing the service request and handling the interruption,

the CPU continues the process where it left off.

Auxiliary memory

An Auxiliary memory is referred to as the lowest-cost, highest-space, and


slowest-approach storage in a computer system. It is where programs and
information are preserved for long-term storage or when not in direct use. The
most typical auxiliary memory devices used in computer systems are magnetic
disks and tapes.

Magnetic Disks

A magnetic disk is a round plate generated of metal or plastic coated with


magnetized material. There are both sides of the disk are used and multiple
disks can be stacked on one spindle with read/write heads accessible on each
surface.

All disks revolve together at high speed and are not stopped or initiated for
access purposes. Bits are saved in the magnetized surface in marks along
concentric circles known as tracks. The tracks are frequently divided into areas
known as sectors.
In this system, the lowest quantity of data that can be sent is a sector. The
subdivision of one disk surface into tracks and sectors is displayed in the figure.

Magnetic Tape

Magnetic tape transport includes the robotic, mechanical, and electronic


components to support the methods and control structure for a magnetic tape
unit. The tape is a layer of plastic coated with a magnetic documentation
medium.

Bits are listed as a magnetic stain on the tape along various tracks. There are
seven or nine bits are recorded together to form a character together with a
parity bit. Read/write heads are mounted one in each track therefore that
information can be recorded and read as a series of characters.
Magnetic tape units can be stopped, initiated to move forward, or in the
opposite, or it can be reversed. However, they cannot be initiated or stopped
fast enough between single characters. For this reason, data is recorded in
blocks defined as records. Gaps of unrecorded tape are added between records
where the tape can be stopped.

The tape begins affecting while in a gap and achieves its permanent speed by
the time it arrives at the next record. Each record on tape has a recognition bit
design at the starting and end. By reading the bit design at the starting, the
tape control recognizes the data number.

What is Virtual Address Space in an Operating

System?
Virtual address space refers to the room of addresses which usually refers

to the reference to the different slots of virtual memory allotted to different

processes. Operating systems allocate this set of addresses for the processes

to use in order to access their designated virtual memory. The address space

is divided into many regions, each of which serves a specific function. An

operating system’s processes each have their own distinct virtual memory

space, where all of their addresses are kept. Every process, therefore, creates
the illusion that they have dedicated physical memory as a result of this

characteristic.

Key Terminologies of Virtual Address Space in

Operating System
● Page: A page is a fixed-size memory block that is used to manage

virtual memory.

● Code segment: A part of a virtual address that contains the

executable instructions of the process.

● Data Segment: The part of a virtual address that contains the

allocated memory and process variables.

● Page Table: It is a data structure that the operating system manages

to keep track of the relationship between virtual pages and actual

memory frames.

● Page Fault: This is a case scenario where the page which is

requested is not present in the physical memory.

Characteristics of Virtual Address Space


● Virtual address space enables dynamic memory allocation as it is

mainly needed to carry out the task of assigning memory blocks to

the processes when they request dynamically.


● A page table is used to maintain the mapping of the Virtual address

to the corresponding Physical address which can be referred to as

address translation which is used by the Virtual address space to

maintain the mapping.

● The Virtual address space also contains the different access

specifiers for specific virtual memory blocks that specify whether a

space will be read-only, read-write access, or no access. This

ensures that the memory or data is safe from any misdoings.

● Using Virtual Address Space to give the processes are independent

of any running process, as they have noninterfering virtual address

space.

● This technique when used to enable memory sharing as helps to

map the specific virtual memory addresses to the same physical

memory so that two/more processes can use the same memory

space to make more efficient use of it.

Paging

Paging is a memory management scheme that eliminates the need for a

contiguous allocation of physical memory. The process of retrieving

processes in the form of pages from the secondary storage into the main

memory is known as paging. The basic purpose of paging is to separate each

procedure into pages. Additionally, frames will be used to split the main
memory. This scheme permits the physical address space of a process to be

non – contiguous.

In paging, the physical memory is divided into fixed-size blocks called page

frames, which are the same size as the pages used by the process. The

process’s logical address space is also divided into fixed-size blocks called

pages, which are the same size as the page frames. When a process requests

memory, the operating system allocates one or more page frames to the

process and maps the process’s logical pages to the physical page frames.

The mapping between logical pages and physical page frames is maintained

by the page table, which is used by the memory management unit to

translate logical addresses into physical addresses. The page table maps

each logical page number to a physical page frame number.

Terminologies Associated with Memory Control


● Logical Address or Virtual Address: This is a deal that is generated

through the CPU and used by a technique to get the right of entry to

reminiscence. It is known as a logical or digital deal because it isn’t

always a physical vicinity in memory but an opportunity for a

connection with a place inside the device’s logical address location.

● Logical Address Space or Virtual Address Space: This is the set of

all logical addresses generated via a software program. It is


normally represented in phrases or bytes and is split into

regular-duration pages in a paging scheme.

● Physical Address: This is a cope that corresponds to a bodily place

in reminiscence. It is the actual cope with this that is available on the

memory unit and is used by the memory controller to get admission

to the reminiscence.

● Physical Address Space: This is the set of all bodily addresses that

correspond to the logical addresses inside the way’s logical deal

with place. It is usually represented in words or bytes and is cut up

into fixed-size frames in a paging scheme.

In a paging scheme, the logical deal with the region is cut up into

steady-duration pages, and every internet web page is mapped to a

corresponding body within the physical deal with the vicinity. The going for

walks tool keeps a web internet web page desk for every method, which

maps the system’s logical addresses to its corresponding bodily addresses.

When a method accesses memory, the CPU generates a logical address, that

is translated to a bodily address using the net page table. The reminiscence

controller then uses the physical cope to get the right of entry to the

reminiscence.

Important Features of Paging in PC Reminiscence

Management
● Logical to bodily address mapping: In paging, the logical address

area of a technique is divided into constant-sized pages, and each

web page is mapped to a corresponding physical body within the

main reminiscence. This permits the working gadget to manipulate

the memory in an extra flexible way, as it is able to allocate and

deallocate frames as needed.

● Fixed web page and frame length: Paging makes use of a set web

page length, which is usually identical to the size of a frame within

the most important memory. This facilitates simplifying the

reminiscence control technique and improves device performance.

● Page desk entries: Each page within the logical address area of a

method is represented through a page table entry (PTE), which

contains facts approximately the corresponding bodily body in the

predominant memory. This consists of the frame range, in addition

to other manipulate bits which can be used by the running machine

to manage the reminiscence.

● A number of page desk entries: The range of page desk entries in a

manner’s page desk is identical to the wide variety of pages inside

the logical deal with the area of the technique.

● Page table stored in important memory: The web page desk for

each system is typically saved in important reminiscence, to allow

for green get right of entry to and change by the operating device.
However, this could additionally introduce overhead, because the

web page table must be updated on every occasion a system is

swapped in or out of the main memory.

How Paging Works?


Paging is a method used by operating systems to manage memory efficiently.

It breaks physical memory into fixed-size blocks called “frames” and logical

memory into blocks of the same size called “pages.” When a program runs,

its pages are loaded into any available frames in the physical memory.

This approach prevents fragmentation issues by keeping memory allocation

uniform. Each program has a page table, which the operating system uses to

keep track of where each page is stored in physical memory. When a

program accesses data, the system uses this table to convert the program’s

address into a physical memory address.

Paging allows for better memory use and makes it easier to manage. It also

supports virtual memory, letting parts of programs be stored on disk and

loaded into memory only when needed. This way, even large programs can

run without fitting entirely into main memory.

● If Logical Address = 31 bit, then Logical Address Space = 231 words

= 2 G words (1 G = 230)
● If Logical Address Space = 128 M words = 27 * 220 words, then

Logical Address = log2 227 = 27 bits

● If Physical Address = 22 bit, then Physical Address Space = 222

words = 4 M words (1 M = 220)

● If Physical Address Space = 16 M words = 24 * 220 words, then

Physical Address = log2 224 = 24 bits

The mapping from virtual to physical address is done by the Memory

Management Unit (MMU) which is a hardware device and this mapping is

known as the paging technique.

● The Physical Address Space is conceptually divided into a number

of fixed-size blocks, called frames.

● The Logical Address Space is also split into fixed-size blocks, called

pages.

● Page Size = Frame Size

Example
● Physical Address = 12 bits, then Physical Address Space = 4 K

words

● Logical Address = 13 bits, then Logical Address Space = 8 K words

● Page size = frame size = 1 K words (assumption)


Paging

The address generated by the CPU is divided into

● Page number(p): Number of bits required to represent the pages in

Logical Address Space or Page number

● Page offset(d): Number of bits required to represent a particular

word in a page or page size of Logical Address Space or word

number of a page or page offset.

In a paging scheme, the physical cope with the area is divided into

fixed-length frames, each of which contains some bytes or words. When a

manner is running, its logical address space is split into constant-size pages,
which might be mapped to corresponding frames within the physical address

space.

Physical Address is divided into:

To represent a physical address in this scheme, parts are commonly used:

Frame Range: This is the variety of the frame within the physical cope with

the area that consists of the byte or phrase being addressed. The wide

variety of bits required to represent the body range relies upon the scale of

the physical cope with the area and the size of each frame. For instance, if the

physical cope with area carries 2^20 frames and each frame is 4KB (2^12

bytes) in size, then the frame range could require 20-12 = 8 bits.

Frame Offset: This is the wide variety of the byte or word within the body

this is being addressed. The number of bits required to represent the frame

offset relies upon the size of every frame. For instance, if everybody is 4KB in

size, then the frame offset could require 12 bits. So, a physical address in this

scheme may be represented as follows:

Physical Address = (Frame Number << Number of Bits in Frame Offset) +

Frame Offset, where “<<” represents a bitwise left shift operation.

● The TLB is associative, high-speed memory.

● Each entry in TLB consists of two parts: a tag and a value.


● When this memory is used, then an item is compared with all tags

simultaneously. If the item is found, then the corresponding value is

returned.

Paging is a memory management technique used in operating systems to

manage memory and allocate memory to processes. In paging, memory is

divided into fixed-size blocks called pages, and processes are allocated

memory in terms of these pages. Each page is of the same size, and the size

is typically a power of 2, such as 4KB or 8 KB.

Important Points About Paging in Operating Systems


● Reduces internal fragmentation: Paging facilitates lessening

internal fragmentation by using allocating memory in fixed-size

blocks (pages), which might be usually a whole lot smaller than the

size of the process’s facts segments. This lets in for greater efficient

use of memory in view that there are fewer unused bytes in each

block.

● Enables reminiscence to be allotted on call for: Paging enables

memory to be allocated on call for, this means that memory is most

effectively allocated when it’s far needed. This allows for extra

efficient use of memory in view that only the pages that are

absolutely used by the manner want to be allocated inside the

physical memory.
● Protection and sharing of memory: Paging allows for the

protection and sharing of reminiscence between methods, as each

procedure has its own web page table that maps its logical deal

with area to its physical address space. This permits techniques to

proportion facts at the same time as preventing unauthorized get

right of entry to every other’s memory.

● External fragmentation: Paging can result in outside fragmentation,

wherein memory turns fragmented into small, non-contiguous

blocks. This can make it difficult to allocate massive blocks of

reminiscence to a method seeing that there may not be enough

contiguous free memory to be had.

● Overhead: Paging involves overhead because of the renovation of

the web page table and the translation of logical addresses to

physical addresses. The working device must maintain the page

table for each manner and perform a deal with translation whenever

a procedure accesses memory, which can slow down the machine.

What is Memory Management Unit (MMU)?


A memory management unit (MMU) is a technique used to convert logical

address to physical address. Logical address is the address generated by

CPU for each page and physical address is the real address of the frame

where page is going to be stored.


Whenever a page has to be accessed by CPU using the logical address, it

requires physical address for accessing the page. Logical address comprises

of two parts: Page Number and Offset.

Conclusion
In conclusion, paging is a memory management technique that helps

computers in storing data efficiently and it also helps in retrieve data as it

breaks the memory into small, fixed size chunks called pages. It helps in

handling larger amount of data without the issue of fragmentation that

improves the performance and usability.


Virtual Address Space

How Does Virtual Address Space Works in Operating

System?
● The Virtual Address Space’s working starts with the allocation of

the virtual address space’s single page to the individual process as

soon as a process is created.

● The Virtual Address Space has two spaces and their individual jobs.

● The instruction statements which are attached to the process are

stored in the code segment of the address space to execute them

when needed.
● All the process variables and data of the process are stored in the

Data segment of the address space to make them more accessible.

● The operating system uses the Page Table to get the virtual address

to access the virtual page frame which is linked to the Physical

address in the Physical memory using the Page table.

● The Virtual Addresses have both the virtual page number of the

individual pages and the page offset which is used to combine with

the physical page number from the page table to get the actual

physical address.

● When the required page is not present in the Physical memory the

OS fetched it from the secondary memory which is the hard disk and

swapped it to any available page frame in the memory. This function

is executed using the Page Replacement Algorithms in Operating

Systems.

1.3 CPU Architecture

CPU [Central Processing Unit]. It is the brain of the computer. It is the part

that does most of the work in a computer system. Just like how our brain

controls our body and processes information, the CPU carries out instructions

from programs and performs calculations. It’s made up of smaller


components that work together to execute tasks, making it the heart of any

computing device.

A Central Processing Unit is the most important component of a computer

system. A CPU is hardware that performs data input/output, processing, and

storage functions for a computer system. A CPU can be installed into a CPU

socket. These sockets are generally located on the motherboard. CPU can

perform various data processing operations. CPU can store data, instructions,

programs, and intermediate results.

Different Parts of CPU


Now, the CPU consists of 3 major units, which are:

● Memory or Storage Unit

● Control Unit

● ALU(Arithmetic Logic Unit)

Let us now look at the block diagram of the computer:


Here, in this diagram, the three major components are also shown. So, let us

discuss these major components in detail.

Memory or Storage Unit

As the name suggests this unit can store instructions, data, and intermediate

results. The memory unit is responsible for transferring information to other

units of the computer when needed. It is also known as an internal storage

unit or the main memory or the primary storage or Random Access Memory

(RAM) as all these are storage devices.


Its size affects speed, power, and performance. There are two types of

memory in the computer, which are primary memory and secondary memory.

Some main functions of memory units are listed below:

● Data and instructions are stored in memory units which are required

for processing.

● It also stores the intermediate results of any calculation or task

when they are in process.

● The final results of processing are stored in the memory units before

these results are released to an output device for giving the output

to the user.

● All sorts of inputs and outputs are transmitted through the memory

unit.

Control Unit

As the name suggests, a control unit controls the operations of all parts of

the computer but it does not carry out any data processing operations.

Executing already stored instructions, It instructs the computer by using the

electrical signals to instruct the computer system. It takes instructions from

the memory unit and then decodes the instructions after that it executes

those instructions. So, it controls the functioning of the computer. Its main

task is to maintain the flow of information across the processor. Some main

functions of the control unit are listed below:


● Controlling of data and transfer of data and instructions is done by

the control unit among other parts of the computer.

● The control unit is responsible for managing all the units of the

computer.

● The main task of the control unit is to obtain the instructions or data

that is input from the memory unit, interpret them, and then direct

the operation of the computer according to that.

● The control unit is responsible for communication with Input and

output devices for the transfer of data or results from memory.

● The control unit is not responsible for the processing of data or

storing data.

ALU (Arithmetic Logic Unit)

ALU (Arithmetic Logic Unit) is responsible for performing arithmetic and

logical functions or operations. It consists of two subsections, which are:

● Arithmetic Section: By arithmetic operations, we mean operations

like addition, subtraction, multiplication, and division, and all these

operations and functions are performed by ALU. Also, all the

complex operations are done by making repetitive use of the

mentioned operations by ALU.


● Logic Section: By Logical operations, we mean operations or

functions like selecting, comparing, matching, and merging the data,

and all these are performed by ALU.

Note: The CPU may contain more than one ALU and it can be used for

maintaining timers that help run the computer system.

What Does a CPU Do?


The main function of a computer processor is to execute instructions and

produce an output. CPU work Fetch, Decode, and Execute are the

fundamental functions of the computer.

● Fetch: the first CPU gets the instruction. That means binary

numbers that are passed from RAM to CPU.

● Decode: When the instruction is entered into the CPU, it needs to

decode the instructions. with the help of ALU(Arithmetic Logic Unit),

the process of decoding begins.

● Execute: After the decode step the instructions are ready to execute.

● Store: After the execute step the instructions are ready to store in

the memory.
Parallel processing

Parallel processing is used to increase the computational speed of computer

systems by performing multiple data-processing operations simultaneously.

For example, while an instruction is being executed in ALU, the next

instruction can be read from memory. The system can have two or more

ALUs and be able to execute multiple instructions at the same time. In

addition, two or more processing is also used to speed up computer

processing capacity and increases with parallel processing, and with it, the

cost of the system increases. But, technological development has reduced

hardware costs to the point where parallel processing methods are

economically possible. Parallel processing derives from multiple levels of

complexity. It is distinguished between parallel and serial operations by the

type of registers used at the lowest level.

Shift registers

work one bit at a time in a serial fashion, while parallel registers work

simultaneously with all bits of the word. At high levels of complexity, parallel

processing derives from having a plurality of functional units that perform

separate or similar operations simultaneously. By distributing data among

several functional units, parallel processing is installed. As an example,

arithmetic, shift and logic operations can be divided into three units and

operations are transformed into a teach unit under the supervision of a


control unit. One possible method of dividing the execution unit into eight

functional units operating in parallel is shown in figure. Depending on the

operation specified by the instruction, operands in the registers are

transferred to one of the units, associated with the operands. In each

functional unit, the operation performed is denoted in each block of the

diagram. The arithmetic operations with integer numbers are performed by

the adder and integer multiplier.

Floating-point operations

can be divided into three circuits operating in parallel. Logic, shift, and

increment operations are performed concurrently on different data. All units

are independent of each other, therefore one number is shifted while another

number is being incremented. Generally, a multi-functional organization is

associated with a complex control unit to coordinate all the activities

between the several components.


The main advantage of parallel processing is that it provides better utilization

of system resources by increasing resource multiplicity which overall system

throughput.

Complex Instruction Set Architecture (CISC)


The main idea is that a single instruction will do all loading, evaluating, and

storing operations just like a multiplication command will do stuff like loading

data, evaluating, and storing it, hence it’s complex.


Characteristics of CISC

● Complex instruction, hence complex instruction decoding.

● Instructions are larger than one-word size.

● Instruction may take more than a single clock cycle to get executed.

● Less number of general-purpose registers as operations get

performed in memory itself.

● Complex Addressing Modes.

● More Data types.

Advantages of CISC

● Reduced code size: CISC processors use complex instructions that

can perform multiple operations, reducing the amount of code

needed to perform a task.

● More memory efficient: Because CISC instructions are more

complex, they require fewer instructions to perform complex tasks,

which can result in more memory-efficient code.

● Widely used: CISC processors have been in use for a longer time

than RISC processors, so they have a larger user base and more

available software.

Disadvantages of CISC
● Slower execution: CISC processors take longer to execute

instructions because they have more complex instructions and need

more time to decode them.

● More complex design: CISC processors have more complex

instruction sets, which makes them more difficult to design and

manufacture.

● Higher power consumption: CISC processors consume more power

than RISC processors because of their more complex instruction

sets.

Reduced Instruction Set Architecture (RISC)

The main idea behind this is to simplify hardware by using an instruction set

composed of a few basic steps for loading, evaluating, and storing operations

just like a load command will load data, a store command will store the data.

Characteristics of RISC

● Simpler instruction, hence simple instruction decoding.

● Instruction comes undersize of one word.

● Instruction takes a single clock cycle to get executed.

● More general-purpose registers.


● Simple Addressing Modes.

● Fewer Data types.

● A pipeline can be achieved.

Advantages of RISC

● Simpler instructions: RISC processors use a smaller set of simple

instructions, which makes them easier to decode and execute

quickly. This results in faster processing times.

● Faster execution: Because RISC processors have a simpler

instruction set, they can execute instructions faster than CISC

processors.

● Lower power consumption: RISC processors consume less power

than CISC processors, making them ideal for portable devices.

Disadvantages of RISC

● More instructions required: RISC processors require more

instructions to perform complex tasks than CISC processors.

● Increased memory usage: RISC processors require more memory to

store the additional instructions needed to perform complex tasks.

● Higher cost: Developing and manufacturing RISC processors can be

more expensive than CISC processors.


RISC vs CISC

RISC CISC

Focus on software Focus on hardware

Uses both hardwired and


Uses only Hardwired control unit
microprogrammed control unit
Transistors are used for storing
Transistors are used for more complex
registers
Instructions

Fixed sized instructions Variable sized instructions

Can perform only Register to Can perform REG to REG or REG to

Register Arithmetic operations MEM or MEM to MEM

Requires more number of


Requires less number of registers
registers

Code size is large Code size is small


An instruction executed in a Instruction takes more than one clock

single clock cycle cycle

Instructions are larger than the size of


An instruction fit in one word.
one word

Simple and limited addressing


Complex and more addressing modes.
modes.

RISC is Reduced Instruction


CISC is Complex Instruction Cycle.
Cycle.

The number of instructions are The number of instructions are more

less as compared to CISC. as compared to RISC.


It consumes the low power. It consumes more/high power.

RISC is highly pipelined. CISC is less pipelined.

RISC required more RAM. CISC required less RAM.

Here, Addressing modes are more.


Here, Addressing modes are less.

What is a Control Unit?


The Control Unit is the part of the computer’s central processing unit (CPU),

which directs the operation of the processor. It was included as part of the

Von Neumann Architecture by John von Neumann. It is the responsibility of

the control unit to tell the computer’s memory, arithmetic/logic unit, and
input and output devices how to respond to the instructions that have been

sent to the processor. It fetches internal instructions of the programs from the

main memory to the processor instruction register, and based on this register

contents, the control unit generates a control signal that supervises the

execution of these instructions. A control unit works by receiving input

information which it converts into control signals, which are then sent to the

central processor. The computer’s processor then tells the attached hardware

what operations to perform. The functions that a control unit performs are

dependent on the type of CPU because the architecture of the CPU varies

from manufacturer to manufacturer.

Examples of devices that require a CU are:

● Control Processing Units(CPUs)

● Graphics Processing Units(GPUs)


Functions of the Control Unit
● It coordinates the sequence of data movements into, out of, and

between a processor’s many sub-units.

● It interprets instructions.

● It controls data flow inside the processor.

● It receives external instructions or commands to which it converts to

sequence of control signals.

● It controls many execution units(i.e. ALU, data buffers and registers)

contained within a CPU.

● It also handles multiple tasks, such as fetching, decoding, execution

handling and storing results.


Types of Control Unit
There are two types of control units:

● Hardwired

● Micro programmable control unit.

Hardwired Control Unit

In the Hardwired control unit, the control signals that are important for

instruction execution control are generated by specially designed hardware

logical circuits, in which we can not modify the signal generation method

without physical change of the circuit structure. The operation code of an

instruction contains the basic data for control signal generation. In the

instruction decoder, the operation code is decoded. The instruction decoder

constitutes a set of many decoders that decode different fields of the

instruction opcode.

As a result, few output lines going out from the instruction decoder obtains

active signal values. These output lines are connected to the inputs of the

matrix that generates control signals for execution units of the computer.

This matrix implements logical combinations of the decoded signals from the

instruction opcode with the outputs from the matrix that generates signals

representing consecutive control unit states and with signals coming from
the outside of the processor, e.g. interrupt signals. The matrices are built in a

similar way as a programmable logic arrays.

Control signals for an instruction execution have to be generated not in a

single time point but during the entire time interval that corresponds to the

instruction execution cycle. Following the structure of this cycle, the suitable

sequence of internal states is organized in the control unit. A number of

signals generated by the control signal generator matrix are sent back to

inputs of the next control state generator matrix.

This matrix combines these signals with the timing signals, which are

generated by the timing unit based on the rectangular patterns usually


supplied by the quartz generator. When a new instruction arrives at the

control unit, the control units is in the initial state of new instruction fetching.

Instruction decoding allows the control unit enters the first state relating

execution of the new instruction, which lasts as long as the timing signals

and other input signals as flags and state information of the computer remain

unaltered.

A change of any of the earlier mentioned signals stimulates the change of the

control unit state. This causes that a new respective input is generated for

the control signal generator matrix. When an external signal appears, (e.g. an

interrupt) the control unit takes entry into a next control state that is the

state concerned with the reaction to this external signal (e.g. interrupt

processing).

The values of flags and state variables of the computer are used to select

suitable states for the instruction execution cycle. The last states in the cycle

are control states that commence fetching the next instruction of the

program: sending the program counter content to the main memory address

buffer register and next, reading the instruction word to the instruction

register of computer. When the ongoing instruction is the stop instruction

that ends program execution, the control unit enters an operating system

state, in which it waits for a next user directive.

Micro Programmable control unit


The fundamental difference between these unit structures and the structure

of the hardwired control unit is the existence of the control store that is used

for storing words containing encoded control signals mandatory for

instruction execution. In microprogrammed control units, subsequent

instruction words are fetched into the instruction register in a normal way.

However, the operation code of each instruction is not directly decoded to

enable immediate control signal generation but it comprises the initial

address of a microprogram contained in the control store.

● With a single-level control store: In this, the instruction opcode

from the instruction register is sent to the control store address

register. Based on this address, the first microinstruction of a

microprogram that interprets execution of this instruction is read to

the microinstruction register. This microinstruction contains in its

operation part encoded control signals, normally as few bit fields. In

a set microinstruction field decoders, the fields are decoded. The

microinstruction also contains the address of the next

microinstruction of the given instruction microprogram and a control

field used to control activities of the microinstruction address

generator.
The last mentioned field decides the addressing mode (addressing

operation) to be applied to the address embedded in the ongoing

microinstruction. In microinstructions along with conditional

addressing mode, this address is refined by using the processor

condition flags that represent the status of computations in the

current program. The last microinstruction in the instruction of the

given microprogram is the microinstruction that fetches the next

instruction from the main memory to the instruction register.

● With a two-level control store: In this, in a control unit with a

two-level control store, besides the control memory for

microinstructions, a nano-instruction memory is included. In such a


control unit, microinstructions do not contain encoded control

signals. The operation part of microinstructions contains the address

of the word in the nano-instruction memory, which contains

encoded control signals. The nano-instruction memory contains all

combinations of control signals that appear in microprograms that

interpret the complete instruction set of a given computer, written

once in the form of nano-instructions.

In this way, unnecessary storing of the same operation parts of

microinstructions is avoided. In this case, microinstruction word can

be much shorter than with the single level control store. It gives a

much smaller size in bits of the microinstruction memory and, as a


result, a much smaller size of the entire control memory. The

microinstruction memory contains the control for selection of

consecutive microinstructions, while those control signals are

generated at the basis of nano-instructions. In nano-instructions,

control signals are frequently encoded using 1 bit/ 1 signal method

that eliminates decoding.

Advantages of a Well-Designed Control Unit


● Efficient instruction execution: A well-designed control unit can

execute instructions more efficiently by optimizing the instruction

pipeline and minimizing the number of clock cycles required for each

instruction.

● Improved performance: A well-designed control unit can improve

the performance of the CPU by increasing the clock speed, reducing

the latency, and improving the throughput.

● Support for complex instructions: A well-designed control unit can

support complex instructions that require multiple operations,

reducing the number of instructions required to execute a program.

● Improved reliability: A well-designed control unit can improve the

reliability of the CPU by detecting and correcting errors, such as

memory errors and pipeline stalls.


● Lower power consumption: A well-designed control unit can

reduce power consumption by optimizing the use of resources, such

as registers and memory, and reducing the number of clock cycles

required for each instruction.

● Better branch prediction: A well-designed control unit can improve

branch prediction accuracy, reducing the number of branch

mispredictions and improving performance.

● Improved scalability: A well-designed control unit can improve the

scalability of the CPU, allowing it to handle larger and more

complex workloads.

● Better support for parallelism: A well-designed control unit can

better support parallelism, allowing the CPU to execute multiple

instructions simultaneously and improve overall performance.

● Improved security: A well-designed control unit can improve the

security of the CPU by implementing security features such as

address space layout randomization and data execution prevention.

● Lower cost: A well-designed control unit can reduce the cost of the

CPU by minimizing the number of components required and

improving manufacturing efficiency.

Disadvantages of a Poorly-Designed Control Unit


● Reduced performance: A poorly-designed control unit can reduce

the performance of the CPU by introducing pipeline stalls,

increasing the latency, and reducing the throughput.

● Increased complexity: A poorly-designed control unit can increase

the complexity of the CPU, making it harder to design, test, and

maintain.

● Higher power consumption: A poorly-designed control unit can

increase power consumption by inefficiently using resources, such as

registers and memory, and requiring more clock cycles for each

instruction.

● Reduced reliability: A poorly-designed control unit can reduce the

reliability of the CPU by introducing errors, such as memory errors

and pipeline stalls.

● Limitations on instruction set: A poorly-designed control unit may

limit the instruction set of the CPU, making it harder to execute

complex instructions and limiting the functionality of the CPU.

● Inefficient use of resources: A poorly-designed control unit may

inefficiently use resources such as registers and memory, leading to

wasted resources and reduced performance.

● Limited scalability: A poorly-designed control unit may limit the

scalability of the CPU, making it harder to handle larger and more

complex workloads.
● Poor support for parallelism: A poorly-designed control unit may

limit the ability of the CPU to support parallelism, reducing the

overall performance of the system.

● Security vulnerabilities: A poorly-designed control unit may

introduce security vulnerabilities, such as buffer overflows or code

injection attacks.

● Higher cost: A poorly-designed control unit may increase the cost of

the CPU by requiring additional components or increasing the

manufacturing complexity.

1.4

I/O Interface (Interrupt and DMA Mode)

The method that is used to transfer information between internal storage and

external I/O devices is known as I/O interface. The CPU is interfaced using

special communication links by the peripherals connected to any computer

system. These communication links are used to resolve the differences

between CPU and peripheral. There exists special hardware components

between CPU and peripherals to supervise and synchronize all the input and

output transfers that are called interface units.

Mode of Transfer:
The binary information that is received from an external device is usually

stored in the memory unit. The information that is transferred from the CPU

to the external device is originated from the memory unit. CPU merely

processes the information but the source and target is always the memory

unit. Data transfer between CPU and the I/O devices may be done in different

modes. Data transfer to and from the peripherals may be done in any of the

three possible ways

1. Programmed I/O.

2. Interrupt- initiated I/O.

3. Direct memory access( DMA).

Now let’s discuss each mode one by one.

1. Programmed I/O: It is due to the result of the I/O instructions that

are written in the computer program. Each data item transfer is

initiated by an instruction in the program. Usually the transfer is

from a CPU register and memory. In this case it requires constant

monitoring by the CPU of the peripheral devices.

Example of Programmed I/O: In this case, the I/O device does not

have direct access to the memory unit. A transfer from I/O device to

memory requires the execution of several instructions by the CPU,

including an input instruction to transfer the data from device to the

CPU and store instruction to transfer the data from CPU to memory.
In programmed I/O, the CPU stays in the program loop until the I/O

unit indicates that it is ready for data transfer. This is a time

consuming process since it needlessly keeps the CPU busy. This

situation can be avoided by using an interrupt facility. This is

discussed below.

2. Interrupt- initiated I/O: Since in the above case we saw the CPU is

kept busy unnecessarily. This situation can very well be avoided by

using an interrupt driven method for data transfer. By using interrupt

facility and special commands to inform the interface to issue an

interrupt request signal whenever data is available from any device.

In the meantime the CPU can proceed for any other program

execution. The interface meanwhile keeps monitoring the device.

Whenever it is determined that the device is ready for data transfer

it initiates an interrupt request signal to the computer. Upon

detection of an external interrupt signal the CPU stops momentarily

the task that it was already performing, branches to the service

program to process the I/O transfer, and then return to the task it

was originally performing.

1. The I/O transfer rate is limited by the speed with which the

processor can test and service a device.


2. The processor is tied up in managing an I/O transfer; a

number of instructions must be executed for each I/O

transfer.

3. Terms:

○ Hardware Interrupts: Interrupts present in

the hardware pins.

○ Software Interrupts: These are the

instructions used in the program whenever

the required functionality is needed.

○ Vectored interrupts: These interrupts are

associated with the static vector address.

○ Non-vectored interrupts: These interrupts

are associated with the dynamic vector

address.

○ Maskable Interrupts: These interrupts can

be enabled or disabled explicitly.

○ Non-maskable interrupts: These are always

in the enabled state. we cannot disable

them.

○ External interrupts: Generated by external

devices such as I/O.


○ Internal interrupts: These devices are

generated by the internal components of

the processor such as power failure, error

instruction, temperature sensor, etc.

○ Synchronous interrupts: These interrupts

are controlled by the fixed time interval. All

the interval interrupts are called as

synchronous interrupts.

○ Asynchronous interrupts: These are initiated

based on the feedback of previous

instructions. All the external interrupts are

called as asynchronous interrupts.

3. Direct Memory Access: The data transfer between a fast storage

media such as magnetic disk and memory unit is limited by the

speed of the CPU. Thus we can allow the peripherals directly

communicate with each other using the memory buses, removing

the intervention of the CPU. This type of data transfer technique is

known as DMA or direct memory access. During DMA the CPU is

idle and it has no control over the memory buses. The DMA

controller takes over the buses to manage the transfer directly

between the I/O devices and the memory unit.

1. Bus grant request time.


2. Transfer the entire block of data at transfer rate of device

because the device is usually slow than the speed at which

the data can be transferred to CPU.

3. Release the control of the bus back to CPU So, total time

taken to transfer the N bytes = Bus grant request time + (N)

* (memory transfer rate) + Bus release control time.

4. Buffer the byte into the buffer

5. Inform the CPU that the device has 1 byte to transfer (i.e. bus grant

request)

6. Transfer the byte (at system bus speed)

7. Release the control of the bus back to CPU.

Advantages:

Standardization: I/O interfaces provide a standard way of communicating

with external devices. This means that different devices can be connected to

a computer using the same interface, which makes it easier to swap out

devices and reduces the need for specialized hardware.

Modularity: With I/O interfaces, different devices can be added or removed

from a computer without affecting the other components. This makes it easier

to upgrade or replace a faulty device without affecting the rest of the system.

Efficiency: I/O interfaces can transfer data between the computer and the
external devices at high speeds, which allows for faster data transfer and

processing times.

Compatibility: I/O interfaces are designed to be compatible with a wide

range of devices, which means that users can choose from a variety of

devices that are compatible with their computer’s I/O interface.

Disadvantages:

Cost: I/O interfaces can be expensive, especially if specialized hardware is

required to connect a particular device to a computer system.

Complexity: Some I/O interfaces can be complex to configure and require

specialized knowledge to set up and maintain. This can be a disadvantage for

users who are not familiar with the technical aspects of computer hardware.

Compatibility issues: While I/O interfaces are designed to be compatible

with a wide range of devices, there can still be compatibility issues with

certain devices. In some cases, device drivers may need to be installed to

ensure proper functionality.

Security risks: I/O interfaces can be a security risk if they are not properly

configured or secured. Hackers can exploit vulnerabilities in I/O interfaces to

gain unauthorized access to a computer system or steal data.


Introduction to Input-Output Interface

Input-Output Interface is used as a method which helps in transferring of

information between the internal storage devices i.e. memory and the

external peripheral device . A peripheral device is that which provide input

and output for the computer, it is also called Input-Output devices. For

Example: A keyboard and mouse provide Input to the computer are called

input devices while a monitor and printer that provide output to the computer

are called output devices. Just like the external hard-drives, there is also

availability of some peripheral devices which are able to provide both input

and output.

Input-Output Interface

In micro-computer base system, the only purpose of peripheral devices is just

to provide special communication links for the interfacing them with the
CPU. To resolve the differences between peripheral devices and CPU, there is

a special need for communication links.

The major differences are as follows:

1. The nature of peripheral devices is electromagnetic and

electro-mechanical. The nature of the CPU is electronic. There is a

lot of difference in the mode of operation of both peripheral devices

and CPU.

2. There is also a synchronization mechanism because the data

transfer rate of peripheral devices are slow than CPU.

3. In peripheral devices, data code and formats are differ from the

format in the CPU and memory.

4. The operating mode of peripheral devices are different and each

may be controlled so as not to disturb the operation of other

peripheral devices connected to CPU.

There is a special need of the additional hardware to resolve the differences

between CPU and peripheral devices to supervise and synchronize all input

and output devices.

Functions of Input-Output Interface:


1. It is used to synchronize the operating speed of CPU with respect to

input-output devices.

2. It selects the input-output device which is appropriate for the

interpretation of the input-output signal.

3. It is capable of providing signals like control and timing signals.

4. In this data buffering can be possible through data bus.

5. There are various error detectors.

6. It converts serial data into parallel data and vice-versa.

7. It also convert digital data into analog signal and vice-versa.

I/O Request

I/O request packets are basically used for communications between the device
drivers and the operating system. It allows a particular process to get unblocked
and be completely executed.

In the first step, a process is initiated that issues a blocking read on the file
descriptor of a previously used file. The code of the operating system or the
kernel has a system-call code that works towards checking the accuracy of the
parameters. If the buffer cache already has the data, then the data is returned
and the request is completed. In the situation that the data is not found in the
buffer cache, a physical I/O is performed. This ensures that the process is
removed from the run queue and placed in the wait queue. Thereafter, the
device driver receives the request through the I/O subsystem. It is up to the
device driver then to make space for the incoming data and schedule I/O. The
device controller then works on the device hardware to carry out the process of
data transfer. The DMA controller manages and operates the transfer of data to
the kernel memory. When the transfer is finished, this creates an interrupt which
is received by an interrupt handler through the interrupt-vector table. It scans
the data for important information and then returns the interrupt. This signal is
then received by the device driver, which completes the request and also
determines the status of the request. Lastly, it is up to the kernel to remove the
process from the wait queue into the ready queue and the data is transferred to
the address space. This step unblocks the process. So now, when the process is
assigned to the CPU, it resumes work and is completed.

Input and Output Devices


An input/output device, often known as an IO device, is any hardware that

allows a human operator or other systems to interface with a computer.

Input/output devices, as the name implies, are capable of delivering data

(output) to and receiving data from a computer (input). An input/output (I/O)

device is a piece of hardware that can take, output, or process data. It

receives data as input and provides it to a computer, as well as sends

computer data to storage media as a storage output.


Input Devices

Input devices are the devices that are used to send signals to the computer

for performing tasks. The receiver at the end is the CPU (Central Processing

Unit), which works to send signals to the output devices. Some of the

classifications of Input devices are:

● Keyboard Devices

● Pointing Devices

● Composite Devices

● Game Controller

● Visual Devices

● Audio Input Devices

Some of the input devices are described below.

Keyboard

The keyboard is the most frequent and widely used input device for entering

data into a computer. Although there are some additional keys for performing

other operations, the keyboard layout is similar to that of a typical typewriter.

Generally, keyboards come in two sizes: 84 keys or 101/102 keys but

currently keyboards with 104 keys or 108 keys are also available for

Windows and the Internet.


Keyboard

Types of Keys

● Numeric Keys: It is used to enter numeric data or move the cursor. It

usually consists of a set of 17 keys.

● Typing Keys: The letter keys (A-Z) and number keys (09) are among

these keys.

● Control Keys: These keys control the pointer and the screen. There

are four directional arrow keys on it. Home, End, Insert,

Alternate(Alt), Delete, Control(Ctrl), etc., and Escape are all control

keys (Esc).

● Special Keys: Enter, Shift, Caps Lock, NumLk, Tab, etc., and Print

Screen are among the special function keys on the keyboard.

● Function Keys: The 12 keys from F1 to F12 are on the topmost row

of the keyboard.
Mouse

The most common pointing device is the mouse. The mouse is used to move

a little cursor across the screen while clicking and dragging. The cursor will

stop if you let go of the mouse. The computer is dependent on you to move

the mouse; it won’t move by itself. As a result, it’s an input device.

A mouse is an input device that lets you move the mouse on a flat surface to

control the coordinates and movement of the on-screen cursor/pointer.

The left mouse button can be used to select or move items, while the right

mouse button when clicked displays extra menus.

Mouse

Joystick
A joystick is a pointing device that is used to move the cursor on a computer

screen. A spherical ball is attached to both the bottom and top ends of the

stick. In a socket, the lower spherical ball slides. You can move the joystick in

all four directions.

Joystick

The joystick’s function is comparable to that of a mouse. It is primarily used in

CAD (Computer-Aided Design) and playing video games on the computer.

Track Ball

Track Ball is an accessory for notebooks and laptops, which works on behalf

of a mouse. It has a similar structure to a mouse. Its structure is like a


half-inserted ball and we use fingers for cursor movement. Different shapes

are used for this like balls, buttons, or squares.

Light Pen

A light pen is a type of pointing device that looks like a pen. It can be used to

select a menu item or to draw on the monitor screen. A photocell and an

optical system are enclosed in a tiny tube. When the tip of a light pen is

moved across a monitor screen while the pen button is pushed, the photocell

sensor element identifies the screen location and provides a signal to the

CPU.

Light Pen

Scanner
A scanner is an input device that functions similarly to a photocopier. It’s

employed when there’s information on paper that needs to be transferred to

the computer’s hard disc for subsequent manipulation. The scanner collects

images from the source and converts them to a digital format that may be

saved on a disc. Before they are printed, these images can be modified.

Scanner

Optical Mark Reader (OMR)

An Optical Mark Reader is a device that is generally used in educational

institutions to check the answers to objective exams. It recognizes the marks

present by pencil and pen.

Optical Character Reader (OCR)


OCR stands for optical character recognition, and it is a device that reads

printed text. OCR optically scans the text, character by character turns it into

a machine-readable code, and saves it to the system memory.

Magnetic Ink Card Reader (MICR)

It is a device that is generally used in banks to deal with the cheques given to

the bank by the customer. It helps in reading the magnetic ink present in the

code number and cheque number. This process is very fast compared to any

other process.

Bar Code Reader

A bar code reader is a device that reads data that is bar-coded (data that is

represented by light and dark lines).Bar-coded data is commonly used to

mark things, number books, and so on. It could be a handheld scanner or part

of a stationary scanner. A bar code reader scans a bar code image, converts it

to an alphanumeric value, and then sends it to the computer to which it is

connected.
Bar Code Reader

Web Camera

Because a web camera records a video image of the scene in front of it, a

webcam is an input device. It is either built inside the computer (for example,

a laptop) or attached through a USB connection. A webcam is a

computer-connected tiny digital video camera. It’s also known as a web

camera because it can take images and record video. These cameras come

with software that must be installed on the computer in order to broadcast

video in real-time over the Internet. It can shoot images and HD videos,

however, the video quality isn’t as good as other cameras (In Mobiles or other

devices or normal cameras).


Web Camera

Digitizer

Digitizer is a device that is used to convert analog signals to digital signals. it

converts signals into numeric values. An example of a Digitizer is Graphic

Tablet, which is used to convert graphics to binary data.

Microphone

The microphone works as an input device that receives input voice signals

and also has the responsibility of converting it also to digital form. It is a very

common device that is present in every device which is related to music.


Output Devices

Output Devices are the devices that show us the result after giving the input

to a computer system. Output can be of many different forms like image,

graphic audio, video, etc. Some of the output devices are described below.

Monitor

Monitors, also known as Visual Display Units (VDUs), are a computer’s

primary output device. It creates images by arranging small dots, known as

pixels, in a rectangular pattern. The amount of pixels determines the image’s

sharpness.

The two kinds of viewing screens used for monitors are described below.

● Cathode-Ray Tube (CRT) Monitor: Pixels are minuscule visual

elements that make up a CRT display. The higher the image quality

or resolution, the smaller the pixels.

● Flat-Panel Display Monitor: In comparison to the CRT, a flat-panel

display is a type of video display with less volume, weight, and

power consumption. They can be hung on the wall or worn on the

wrist.

Flat-panel displays are currently used in calculators, video games, monitors,

laptop computers, and graphical displays.


Monitor

Television

Television is one of the common output devices which is present in each and

every house. It portrays video and audio files on the screen as the user

handles the television. Nowadays, we are using plasma displays as

compared to CRT screens which we used earlier.

Printer

Printers are output devices that allow you to print information on paper.

There are certain types of printers which are described below.

● Impact Printers
● Character Printers

● Line Printers

● Non-Impact Printers

● Laser Printers

● Inkjet Printers

Printer

Impact Printer

Characters are printed on the ribbon, which is subsequently crushed against

the paper, in impact printers. The following are the characteristics of impact

printers:

● Exceptionally low consumable cost.

● Quite noisy

● Because of its low cost, it is ideal for large-scale printing.

● To create an image, there is physical contact with the paper.


Character Printers

Character Printer has the capability to print only one character at a time. It is

of two types.

● Dot Matrix Printer

● Daisy Wheel

Line Printers

Line Printers are printers that have the capability to print one line at a time. It

is of two types.

● Drum Printer

● Chain Printer

Non-Impact Printers

Characters are printed without the need for a ribbon in non-impact printers.

Because these printers print a full page at a time, they’re also known as Page

Printers. The following are the characteristics of non-impact printers:

● Faster

● They don’t make a lot of noise.

● Excellent quality

● Supports a variety of typefaces and character sizes

Laser Printers
Laser Printers use laser lights for producing dots which will produce

characters on the page.

Inkjet Printers

Inkjet printers are printers that use spray technology for printing papers.

High-quality papers are produced in an Inkjet printer. They also do color

printing.

Speakers

Speakers are devices that produce sound after getting a command from a

computer. Nowadays, speakers come with wireless technology also like

Bluetooth speakers.

Projector

Projectors are optical devices that have the work to show visuals on both

types of screens, stationary and moving both. It helps in displaying images on

a big screen. Projectors are generally used in theatres, auditoriums, etc.

Plotter
Plotter is a device that helps in making graphics or other images to give a real

view. A graphic card is mandatorily required to use these devices. These are

the pen-like devices that help in generating exact designs on the computer.

Braille Reader

Braille Reader is a very important device that is used by blind users. It helps

people with low vision or no vision to recognize the data by running their

fingers over the device to understand easily. It is a very important device for

blind persons as it gives them the comfort to understand the letters,

alphabets, etc which helps them in study.

Video Card

A video Card is a device that is fitted into the motherboard of the computer. It

helps in improvising digital content in output devices. It is an important tool

that helps people in using multiple devices.

Global Positioning System (GPS)

Global Positioning System helps the user in terms of directions, as it uses

satellite technology to track the geometrical locations of the users. With


continuous latitudinal and longitudinal calculations, GPS gives accurate

results. Nowadays, all smart devices have inbuilt GPS.

Headphones

Headphones are just like a speaker, which is generally used by a single

person or it is a single-person usable device and is not commonly used in

large areas. These are also called headsets having a lower sound frequency.

The Input and Output Devices of a Computer

There are so many devices that contain the characteristics of both input and

output. They can perform both operations as they receive data and provide

results. Some of them are mentioned below.

USB Drive

USB Drive is one of the devices which perform both input and output

operations as a USB Drive helps in receiving data from a device and sending

it to other devices.

Modem
Modems are one of the important devices that helps in transmitting data

using telephonic lines.

CD and DVD

CD and DVD are the most common device that helps in saving data from one

computer in a particular format and send data to other devices which works

as an input device to the computer.

Headset

The headset consists of a speaker and microphone where a speaker is an

output device and a microphone works as an input device.

Facsimile

A facsimile is a fax machine that consists of a scanner and printer, where the

scanner works as an input device and the printer works as an output device.

You might also like