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

ICT Assignment 02ali

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

ICT Assignment 02ali

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

University of Engineering and Technology

Lahore , Faisalabad Campus

Assignment 02

Submitted to: Mr. Umer Khan


Submitted by: Ali Haider
2024-CS-836

Course name : Application of information


and communication technology

Date : November 14,2024

Department of Computer Science


Main Memory
Main memory refers to the primary storage area in a
computer where data and instructions that are actively being
used or processed by central processing unit are stored
temporarily.
 It is also known as RAM (Random Access Memory).
 It is a volatile memory (loses all stored data when power
is turned off.)

1. Types of Main Memory

 RAM (Random Access Memory):


 Dynamic RAM (DRAM): This is the most common type of
RAM. It stores each bit of data in a capacitor, which needs to
be refreshed periodically. DRAM is slower but cheaper
compared to SRAM.
 Static RAM (SRAM): SRAM uses flip-flops to store data,
which doesn't require refreshing. It is faster but more
expensive and consumes more power.
 Cache Memory: Although technically a form of very high-
speed memory located between the CPU and main RAM,
cache memory is often considered part of the main memory
hierarchy. Cache is faster than RAM and stores frequently
used data to reduce CPU access time.
 Read-Only Memory (ROM): ROM is non-volatile memory
used to store firmware or permanent instructions that are
required during the boot-up process. It cannot be written to
during normal operations, unlike RAM.

2. Key Characteristics

 Volatility: Main memory is volatile, meaning it loses all


stored data when the computer is powered off. This is in
contrast to non-volatile memory like ROM or hard drives that
retain data without power.
 Access Speed: Main memory is much faster than secondary
storage (e.g., hard drives or SSDs). This speed is crucial for
the smooth functioning of a computer system.
 Size: Main memory is typically measured in gigabytes (GB) or
terabytes (TB) for modern systems. The amount of RAM
directly impacts the system's ability to run multiple
applications simultaneously.

3. Structure of Main Memory

 Memory Cells: Main memory is organized into a series of


memory cells, each of which stores a single bit of data. These
cells are grouped into words, which are the basic units of
data that the CPU processes.
 Memory Addresses: Each memory cell has a unique address,
allowing the CPU to access data directly. Memory is typically
addressed in bytes, with each byte consisting of 8 bits.
 Memory Bus: A communication pathway that connects the
CPU with the memory. It carries data to and from the main
memory.
4. Functions of Main Memory

 Temporary Storage of Instructions and Data: The CPU


requires fast access to both program instructions and data,
which are loaded into RAM from secondary storage before
execution.
 Execution of Programs: When a program is run, it is loaded
from disk storage into RAM. The CPU fetches instructions
from RAM and processes them, making it a critical part of
program execution.
 Context Switching: Main memory is involved in the process
of context switching in multitasking systems. Each running
process has its own area in memory, and the operating
system manages the switching between processes.

5. Memory Hierarchy

 Main memory is part of a memory hierarchy, which is a


structure that arranges different types of memory based on
speed, cost, and size. At the top of the hierarchy is the CPU
registers and L1 cache, followed by L2 and L3 cache,
then main memory (RAM), and finally secondary storage like
HDDs or SSDs.
 Cache memory helps reduce the time the CPU spends
accessing data from the slower main memory.
6. Memory Management

 Address Space: Modern systems use virtual memory


management, allowing programs to use more memory than
is physically available in RAM by swapping data in and out of
secondary storage. The operating system
uses paging or segmentation to manage memory.
 Memory Allocation: The operating system is responsible for
allocating and deallocating memory to programs and
processes. Memory management units (MMUs) control
access to memory and enforce protection mechanisms.

Conclusion

Main memory plays an essential role in the performance of a


computer system. It serves as a fast and temporary storage
medium for data and instructions, ensuring that the CPU can
operate efficiently. As technology advances, new memory
types and techniques continue to improve the speed,
capacity, and efficiency of main memory, which in turn
enhances overall system performance.
Mass Storage
Mass storage refers to the large-scale storage devices used in
computers to store data permanently. Unlike main memory (RAM),
which is temporary and volatile, mass storage retains data even when the
power is turned off.

Common types of mass storage devices include:

1. Hard Disk Drives (HDDs):


HDDs use magnetic disks to store data. They are commonly used for
long-term data storage and offer large capacities at relatively low prices.
However, they are slower than modern alternatives like SSDs.
2. Solid-State Drives (SSDs):
SSDs store data on flash memory chips, offering faster access times than
HDDs. While SSDs are more expensive, their speed makes them ideal for
operating systems and high-performance applications.
3. Optical Storage (CDs/DVDs):
These are used for media storage, software distribution, and backups.
They are slower and have smaller capacities compared to HDDs and
SSDs.
4. Magnetic Tape:
Primarily used for large-scale backups and archival storage, magnetic
tapes are slower but inexpensive for storing vast amounts of data.
5. Network-Attached Storage (NAS):
A file-based storage solution that connects to a network, allowing
multiple users to access data remotely. NAS is commonly used in
enterprises for centralized data storage.

Mass storage devices are essential for retaining data that needs to be
accessed over time, such as system files, user data, and backups.
Storing Integers
Storing integers refers to the process of saving whole numbers (without
fractions) in a computer’s memory or mass storage.

Integers are represented in binary format, with different sizes depending on


the system and programming language. There are various ways to store
integers in memory:

1. Binary Representation: Integers are represented as sequences of 0s and 1s in


binary. For example, the integer 5 is represented as 101 in binary.
2. Data Types:
 Signed Integers: Used to represent both positive and negative numbers. They
use one bit to indicate the sign (0 for positive, 1 for negative) and the
remaining bits to represent the magnitude.
 Unsigned Integers: Represent only non-negative numbers. They use all bits to
represent the value, allowing for a larger range of positive values.
3. Integer Sizes:
 Common integer sizes include 8 bits (1 byte), 16 bits (2 bytes), 32 bits (4
bytes), and 64 bits (8 bytes). The size determines the range of values the
integer can represent.
 8-bit: Values from -128 to 127 (signed) or 0 to 255 (unsigned).
 32-bit: Values from -2,147,483,648 to 2,147,483,647 (signed) or 0 to
4,294,967,295 (unsigned).
4. Overflow and Underflow:
 When an integer exceeds its maximum or minimum value, it causes an
overflow (for unsigned integers) or an underflow (for signed integers), leading
to incorrect values.

In computing, efficient storage and manipulation of integers are crucial for


arithmetic operations, indexing, and database management.

You might also like