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

5 Coa

Uploaded by

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

5 Coa

Uploaded by

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

Chapter 4

Cache Memory

Characteristics

• Location

• Capacity

• Unit of transfer

• Access method

• Performance

• Physical type

• Physical characteristics

• Organisation

Location: CPU , Internal , External

Access Methods
Random
Individual addresses identify locations exactly
Access time is independent of location or previous access
e.g. RAM
Associative
Data is located by a comparison with contents of a portion of the store
Access time is independent of location or previous access
e.g. cache

Access Methods (2)


Random
Individual addresses identify locations exactly
Access time is independent of location or previous access
e.g. RAM
Associative
Data is located by a comparison with contents of a portion of the store
Access time is independent of location or previous access
e.g. cache
Memory Hierarchy
• Registers

In CPU
• Internal or Main memory

May include one or more levels of cache


“RAM”
• External memory

Backing store

Performance
• Access time
Time between presenting the address and getting the valid data
• Memory Cycle time
Time may be required for the memory to “recover” before next access
Cycle time is access + recovery
• Transfer Rate
Rate at which data can be moved

Physical Types Physical Characteristic


• Semiconductor
RAM
• Magnetic
Disk & Tape
• Optical
CD & DVD
• Others
Bubble
Hologram

Cache
Small amount of fast memory
Sits between normal main memory and CPU
May be located on CPU chip or module
Cache operation – overview
CPU requests contents of memory location
Check cache for this data
If present, get from cache (fast)
If not present, read required block from main memory to cache
Then deliver from cache to CPU
Cache includes tags to identify which block of main memory is in each cache slot

Direct Mapping pros & cons


Simple

Inexpensive

Fixed location for given block

If a program accesses 2 blocks that map to the same line repeatedly, cache misses are very high

Replacement Algorithms (1)


Direct mapping
• No choice

• Each block only maps to one line

• Replace that line

Replacement Algorithms (2)


Associative & Set Associative
• Hardware implemented algorithm (speed)

• Least Recently used (LRU)

• e.g. in 2 way set associative

— Which of the 2 block is lru?

• First in first out (FIFO)

— replace block that has been in cache longest

• Least frequently used

— replace block which has had fewest hits

• Random
Write Policy
• Must not overwrite a cache block unless main memory is up to date

• Multiple CPUs may have individual caches

• I/O may address main memory directly

Write through
• All writes go to main memory as well as cache

• Multiple CPUs can monitor main memory traffic to keep local (to CPU) cache up to date

• Lots of traffic

• Slows down writes

• Remember bogus write through caches!

Write back
• Updates initially made in cache only

• Update bit for cache slot is set when update occurs

• If block is to be replaced, write to main memory only if update bit is set

• Other caches get out of sync

• I/O must access main memory through cache

• N.B. 15% of memory references are writes

Chapter 5
Internal memory
MEMORY
• he term memory identifies data storage that comes in the form of chips, and the word storage
is used for memory that exists on tapes or disks. Moreover, the term memory is usually used
as a shorthand for physical memory, which refers to the actual chips capable of holding data.
Some computers also use virtual memory, which expands physical memory onto a hard disk.
Every computer comes with a certain amount of physical memory, usually referred to as main
memory or RAM. A computer that has 1 megabyte of memory, therefore, can hold about 1
million bytes (or characters) of information
The place or location where data and programs are stored called Memory. There are two
types of Memory.
Primary Memory and Secondary Memory.

PRIMARY MEMORY
• The memory where data and programs are stored for the purpose of processing called Primary
Memory. Primary Memory Stored Data for Temporary Time.

• it is also called Internal Memory or Main Memory. Primary storage has a limited storage
capacity because it is very expensive.

• There are three Types Of Primary Memory.

• RAM, ROM, Cache Memory

RAM
• RAM Stand for Random Access Memory because we can access data directly from any
memory location of RAM.

• It is also called Volatile Memory because it stored data whenever power is On and Lost data if
power is Off.

• It is a Temporary Memory. it is also called Read/Write Memory.

ROM
• ROM Stands for Read Only Memory. It is also called Non Volatile Memory because it store
data and programs if power is on or Off. It store Bios Setup Program.
• In ROM Data and Programs are stored by manufacturer during Manufacturing. And we can not
erase or change the data stored in Rom
It stands for Read Only Memory. Information can be read from ROM but not change or write
information into it. It can not accept any input data or instructions from the users.

• The data stored in the ROM is permanent and is not lost due to light failure. So, it is called
permanent memory.

• It is non-volatile memory. It cannot be lost if power supply is switched-off. Program are stored
in ROM by manufacturers.

PROM
• PROM is stand for programmable Read Only Memory

• In the beginning PROM are empty, nothing programmed or recorded on them.

• The data is recorded on them with special programming device which them become
permanent like Rom.

• These ROMs are also programmed by the manufacturer.

EPROM

• EPROM stand for Erasable Programmable Read Only Memory.

• It is also empty chips like PROM.

• The data is also recorded on them with a special programming device but the difference is
that the data can be erased and reprogrammed when ever it is required.

• The data is erased with ultraviolet light.

EEPROM
• EEPROM is stand for Electrically Erasable Programmable Read Only Memory.

• The Characteristics of this EEPROM are same as EPROM but the only difference is that it uses
electrical pulses instead of ultraviolet light for erasing.

Chapter 6
External Memory
External memory
• Primary memory has limited storage capacity and is volatile.

• Secondary memory overcomes this limitation by providing permanent storage of data and in
bulk quantity.

• Secondary memory is also termed external memory and refers to the various storage media
on which a computer can store data and programs.

• The Secondary storage media can be fixed or removable.

Example of external memory


examples of secondary memory devices include:

• hard disk drives (HDDs)

• solid-state drives (SSDs)

• magnetic tapes

• optical discs such as CDs and DVDs

• flash memory such as USB drives and memory cards.

Difference between Primary Memory and Secondary Memory:

Uses of external Media:


• Permanent Storage: Primary Memory (RAM) is volatile, i.e. it loses all information when the
electricity is turned off, so in order to secure the data permanently in the device, Secondary
storage devices are needed.

• Portability: Storage mediums, like CDs, flash drives can be used to transfer the data from one
device to another

Types of External Memory


• Magnetic Disk

fixed
Removable
• Optical

CD-ROM
CD-Recordable (CD-R)
CD-R/W
DVD
• Magnetic Tape

Magnetic Disk Memory


• A magnetic Disk is a type of secondary memory that is a flat disc covered with a magnetic
coating to hold information. It is used to store various programs and files.

Pros and cons of magnetic disk


• Advantages:-
These are economical memory
Easy and direct access to data is possible.
It can store large amounts of data.
It has a better data transfer rate than magnetic tapes.
It has less data to corruption of data as compared to tapes.

• Disadvantages:-
These are less expensive than RAM but more expensive than magnetic tape memories.
It needs a clean and dust-free environment to store.
These are not suitable for sequential access.

Magnetic disk read write

• Platters: These are the ‘disks’ in a disk drive. They are typically made of aluminum or glass and
are coated with a thin layer of magnetic material.

• Read/Write Heads: These are the devices that interpret or modify the magnetic field on the
platters. When writing data, the heads produce a magnetic field that changes the orientation
of the magnetic particles on the platters.

• Actuator Arm: This is the component that moves the read/write heads across the surface of
the platters.

• Spindle: This is the axis that the platters spin around. The speed of the spin, measured in RPM
(Revolutions Per Minute), is a significant factor in the performance of the drive

• Magnetic disk is a storage device that is used to write, rewrite and access data.
• It uses a magnetization process

• The entire disk is divided into platters.

• Each platter consists of concentric circles called as tracks.

• These tracks are further divided into sectors which are the smallest divisions in the disk.

Disk Read Write

• Read-Write(R-W) head moves over the rotating hard disk. It is this Read-
Write head that performs all the read and writes operations on the disk
and hence, the position of the R-W head is a major concern.
• To perform a read or write operation on a memory location, we need to
place the R-W head over that position.

Some important terms must be noted


• Seek time – The time taken by the R-W head to reach the desired track
from its current position.
• Rotational latency – Time is taken by the sector to come under the R-W
head.
• Data transfer time – Time is taken to transfer the required amount of
data. It depends upon the rotational speed.
• Controller time – The processing time taken by the controller.
• Average Access time – seek time + Average Rotational latency + data
transfer time + controller time.
Example:
• Consider a hard disk with:
• 4 surfaces
• 64 tracks/surface
• 128 sectors/track
• 256 bytes/sector
What is the capacity of the hard disk?
Disk capacity = surfaces * tracks/surface * sectors/track * bytes/sector
Disk capacity = 4 * 64 * 128 * 256
Disk capacity = 8 MB

• The disk is rotating at 3600 RPM, what is the data transfer rate?
60 sec -> 3600 rotations
1 sec -> 60 rotations
Data transfer rate = surfaces * Rotation per second * sectors/track *
bytes/sector

Data transfer rate = 60 * 128 * 256 * 4


Data transfer rate = 7.5 MB/sec

Chapter 7
Input/output
Input/Output Problems

• Wide variety of peripherals are the problems input/ output that


are follow:
 Delivering different amounts of data
 At different speeds
 In different formats
• All the top case more slower than CPU and RAM
• for this problem we have Need I/O modules which are define
by:
 Interface to CPU and Memory
 Interface to one or more peripherals

Introduction to Input-Output Interface

• Input-Output Interface is used as an 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.
Input-output peripheral
• Input or output devices that are connected to computer are
called peripheral devices. These devices are designed to read
information into or out of the memory unit upon command from
the CPU and are considered to be the part of computer system.
These devices are also called peripherals.
• For example: Keyboards, display units and printers are common
peripheral devices.
• There are three types of peripherals:
• Input peripherals : Allows user input, from the outside world to
the computer. Example: Keyboard, Mouse etc.
• Output peripherals: Allows information output, from the
computer to the outside world. Example: Printer, Monitor etc
• Input-Output peripherals: Allows both input(from outsied world to
computer) as well as, output(from computer to the outside world).
Example: Touch screen etc.
External Devices
• Human readable
— Screen, printer, keyboard
• Machine readable
— Monitoring and control
• Communication
— Modem
— Network Interface Card (NIC)
• 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:


• 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.
• There is also a synchronization mechanism because the data transfer rate
of peripheral devices are slow than CPU.
• In peripheral devices, data code and formats are differ from the format in
the CPU and memory.
• 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.
• The main purpose of using Interface:
• Speed
• Signal converting
• Data format
• Changing logic
Functions of Input-Output Interface:
• It is used to synchronize the operating speed of CPU with respect to input-
output devices.
• It selects the input-output device which is appropriate for the
interpretation of the input-output device.
• It is capable of providing signals like control and timing signals.
• In this data buffering can be possible through data bus.
• There are various error detectors.
• It converts serial data into parallel data and vice-versa.
• It also convert digital data into analog signal and vice-versa.

Interfaces

• Interface is a shared boundary between two separate components of the


computer system which can be used to attach two or more components
to the system for communication purposes.
• There are two types of interface:
 CPU Interface
 I/O Interface
• Let's understand the I/O Interface in details,

Input-Output Interface
• Peripherals connected to a computer need special communication links
for interfacing with CPU. In computer system, there are special hardware
components between the CPU and peripherals to control or manage the
input-output transfers.
• These components are called input-output interface units because they
provide communication links between processor bus and peripherals.
• They provide a method for transferring information between internal
system and input-output devices.
Direct Memory Access
• Removing the CPU from the path and letting the peripheral device
manage the memory buses directly would improve the speed of transfer.
This technique is known as DMA.
• In this, the interface transfer data to and from the memory through
memory bus. A DMA controller manages to transfer data between
peripherals and memory unit
• Many hardware systems use DMA such as disk drive controllers, graphic
cards, network cards and sound cards etc. It is also used for intra chip
data transfer in multicore processors.
• In DMA, CPU would initiate the transfer, do other operations while the
transfer is in progress and receive an interrupt from the DMA controller
when the transfer has been completed.
Input/ Output Processor
• An input-output processor (IOP) is a processor with direct memory access
capability. In this, the computer system is divided into a memory unit and
number of processors.
• Each IOP controls and manage the input-output tasks. The IOP is similar to
CPU except that it handles only the details of I/O processing. The IOP can
fetch and execute its own instructions. These IOP instructions are
designed to manage I/O transfers only.
I/O Steps
• CPU checks I/O module device status
• I/O module returns status
• If ready, CPU requests data transfer
• I/O module gets data from device
• I/O module transfers data to CPU
• Variations for output, DMA, etc.
Chapter 9
Operating System Support

Layers and Views of a Computer System

Operating system
• Operating system is a software that acts as an intermediary between the
user and computer hardware. It is a program with the help of which we
are able to run various applications.
• It is the only one program that is running all the time.
• Every computer must have an operating system to smoothly execute
other programs.
• The OS coordinates the use of the hardware and application programs for
various users
• It provides a platform for other application programs to work.
• The operating system is a set of special programs that run on a computer
system that allows it to work properly.
• It controls input-output devices, execution of programs, managing files,
etc.
Services of Operating System
• Program execution
• Input Output Operations
• Communication between Process
• File Management
• Memory Management
• Process Management
Operating system service
• Security and Privacy
• Resource Management
• User Interface
• Networking
• Error handling
• Time Management
Program Execution
• It is the Operating System that manages how a program is going to be
executed. It loads the program into the memory after which it is
executed.
• The order in which they are executed depends on the CPU Scheduling
Algorithms.
• A few are FCFS, SJF, etc. When the program is in execution, the Operating
System also handles deadlock i.e. no two processes come for execution at
the same time.
• The Operating System is responsible for the smooth execution of both
user and system programs.
• The Operating System utilizes various resources available for the efficient
running of all types of functionalities.
Input Output Operations
• Operating System manages the input-output operations and establishes
communication between the user and device drivers.
• Device drivers are software that is associated with hardware that is being
managed by the O/S so that the sync between the devices works
properly.
• It also provides access to input-output devices to a program when
needed.
Communication between Processes
• The Operating system manages the communication between processes.
• Communication between processes includes data transfer among them.
• If the processes are not on the same computer but connected through a
computer network, then also their communication is managed by the
Operating System itself.
File Management
• The operating system helps in managing files also. If a program needs
access to a file, it is the operating system that grants access.
• These permissions include read-only, read-write, etc.
• It also provides a platform for the user to create, and delete files.
• The Operating System is responsible for making decisions regarding the
storage of all types of data or files, i.e, floppy disk/hard disk/pen drive,
etc. The Operating System decides how the data should be manipulated
and stored.
Memory Management
• Let’s understand memory management by OS in simple way.
• Imagine a cricket team with limited number of player .
• The team manager (OS) decide whether the upcoming player will be in
playing 11 ,playing 15 or will not be included in team , based on his
performance .
• In the same way, OS first check whether the upcoming program fulfil all
requirement to get memory space or not ,if all things good, it checks how
much memory space will be sufficient for program and then load the
program into memory at certain location. And thus , it prevents program
from using unnecessary memory.
Process Management
• Let’s understand the process management in unique way.
• Imagine, our kitchen stove as the (CPU) where all cooking(execution) is
really happen and chef as the (OS) who uses kitchen-stove(CPU) to cook
different dishes(program).
• The chef(OS) has to cook different dishes(programs) so he ensure that any
particular dish(program) does not take long time(unnecessary time) and
all dishes(programs) gets a chance to cooked(execution) .
• The chef(OS) basically scheduled time for all dishes(programs) to run
kitchen(all the system) smoothly and thus cooked(execute) all the
different dishes(programs) efficiently.
Security and Privacy
• Security : OS keep our computer safe from an unauthorized user by
adding security layer to it.
• Basically, Security is nothing but just a layer of protection which protect
computer from bad guys like viruses and hackers.
• OS provide us defenses like firewalls and anti-virus software and ensure
good safety of computer and personal information
Privacy
• OS give us facility to keep our essential information hidden like having a
lock on our door, where only you can enter and other are not allowed .
• Basically , it respect our secrets and provide us facility to keep it safe.
Resource Management
• System resources are shared between various processes. It is the
Operating system that manages resource sharing.
• It also manages the CPU time among processes using CPU Scheduling
Algorithms.
• It also helps in the memory management of the system. It also controls
input-output devices.
• The OS also ensures the proper use of all the resources available by
deciding which resource to be used by whom
User Interface
• User interface is essential and all operating systems provide it. Users
either interface with the operating system through the command-line
interface or graphical user interface or GUI.
• The command interpreter executes the next user-specified command.
• A GUI offers the user a mouse-based window and menu system as an
interface
Networking
• This service enables communication between devices on a network, such
as connecting to the internet, sending and receiving data packets, and
managing network connections.
Error Handling
• The Operating System also handles the error occurring in the CPU, in
Input-Output devices, etc. It also ensures that an error does not occur
frequently and fixes the errors.
• It also prevents the process from coming to a deadlock.
• It also looks for any type of error or bugs that can occur while any task.
The well-secured OS sometimes also acts as a countermeasure for
preventing any sort of breach of the Computer System from any external
source and probably handling them.
Time Management

• Imagine traffic light as (OS), which indicates all the cars(programs)


whether it should be stop(red)=>(simple queue) , start(yellow)=>(ready
queue),move(green)=>(under execution) and this light (control) changes
after a certain interval of time at each side of the road(computer system)
so that the cars(program) from all side of road move smoothly without
traffic.

Types of Operating system


• An Operating System performs all the basic tasks like managing files,
processes, and memory. Thus operating system acts as the manager of all
the resources, i.e. resource manager. Thus, the operating system becomes
an interface between the user and the machine. It is one of the most
required software that is present in the device.
• Operating System is a type of software that works as an interface
between the system program and the hardware. There are several types
of Operating Systems in which many of which are mentioned below. Let’s
have a look at them.
Types of Operating Systems
• There are several types of Operating Systems which are mentioned
below.
 Batch Operating system
 Multi-programming system
 Interactive Operating system
 Single –Programming Operating system
1. Batch Operating System
This type of operating system does not interact with the computer
directly. There is an operator which takes similar jobs having the same
requirement and groups them into batches. It is the responsibility of the
operator to sort jobs with similar needs.

Advantages of Batch Operating System


• It is very difficult to guess or know the time required for any job to
complete.
• Processors of the batch systems know how long the job would be when it
is in the queue.
• Multiple users can share the batch systems.
• The idle time for the batch system is very less.
• It is easy to manage large work repeatedly in batch systems.
Disadvantages of Batch Operating System
• The computer operators should be well known with batch systems.
• Batch systems are hard to debug.
• It is sometimes costly.
• The other jobs will have to wait for an unknown time if any job fails.
• Examples of Batch Operating Systems: Payroll Systems, Bank Statements,
etc.
2. Multi-Programming Operating System
3. Multi-programming operating system can be simply illustrated as more
than one program is present in the main memory and any one of them
can be kept in execution. This is basically used for better execution of
resources.

• Advantages of Multi-Programming Operating System


• Multi Programming increases the Throughput of the System.
• It helps in reducing the response time.
• Disadvantages of Multi-Programming Operating System
• There is not any facility for user interaction of system resources with the
system
Interactive operating system
• An interactive operating system refers to an operating system that allows
users to interact with the computer or device in real time. It is a general
term that encompasses various types of operating systems, including both
command-line and graphical user interface (GUI) based systems.
• In an interactive operating system, users can provide input and receive
output from the system in a direct and immediate manner. This means
that users can interact with the operating system through input devices
like keyboards, mice, or touchscreens, and instantly see the system's
response on the display.

single-program (Uni-programming)
• A single-program (uni-programming) operating system is a
simple type of operating system that only allows one program to
run at a time.
• In this type of operating system, the central processing unit
(CPU) is dedicated to executing a single program until it
completes or encounters an input/output (I/O) operation that
requires waiting for external devices.
uni-programming operating system
• In a uni-programming operating system, when a program is
executed, it occupies the entire system's resources until it
finishes or is interrupted. This means that the CPU remains idle
while waiting for I/O operations to complete.
• Once the I/O operation is finished, the CPU can resume
executing the program.
• since only one program can run at a time in a uni-programming
system, the overall system performance may be inefficient. The
system may experience significant idle time, especially when the
running program is performing I/O operations.

You might also like