Computer Organization (Autosaved)
Computer Organization (Autosaved)
College of Science
Dept. of Forensic Science
Computer Science
By Mohammad Hassan
&
2025-2024
What is computer?
• A computer is an electronic device that can process data and perform
tasks according to a set of instructions called a program. It can take
input, store and process information, and output results. Essentially, it
helps us perform calculations, store and retrieve data, and run various
applications to make tasks easier and more efficient.
Computers has two kinds of components:
• Hardware, consisting of its physical devices (CPU, memory, bus,
storage devices, ...)
• Software, consisting of the programs it has (Operating system,
applications, utilities, ...)
Types of computers
The most important types of computers can be categorized based on their size,
performance, and intended purpose. Here are the main types:
1.Personal Computers (PCs): These are general-purpose computers used by
individuals for a variety of tasks such as browsing the internet, word processing,
gaming, and more. They include:
1. Desktops: Stationary computers typically used in offices or homes.
2. Laptops: Portable computers offering similar functionality as desktops but with mobility.
3. Tablets: Mobile, touch-screen devices that are used for lighter tasks, such as browsing, media
consumption, and note-taking.
2.Supercomputers: Extremely powerful machines designed to perform complex
calculations at incredibly high speeds. They are used for tasks such as climate
modeling, scientific simulations, and research in fields like physics and chemistry.
3.Mainframe Computers: Large, powerful systems that handle and process vast
amounts of data for large organizations, particularly in sectors like banking,
healthcare, and government. Mainframes are highly reliable and capable of running
multiple applications simultaneously.
Types of computers
4.Minicomputers (Mid-range computers): These are smaller and less powerful than
mainframes but still capable of supporting multiple users at the same time. They are often
used in smaller business environments or specific departments within larger organizations.
5.Workstations: High-performance computers typically used for specialized tasks such as
graphic design, video editing, scientific computing, and software development. They are
more powerful than personal computers but less so than supercomputers.
6 .Embedded Systems: Specialized computers built into other devices or systems to
perform specific tasks. These are found in products like cars, appliances, medical devices,
and industrial machines.
7.Servers: Computers designed to provide services, data, or resources to other computers
over a network. Examples include web servers, database servers, and file servers.
Each type of computer is designed to address specific needs based on factors like
processing power, size, cost, and the scope of tasks to be handled.
Devices classification:
• Input devices
Input devices allow you to input information to the computer and
include things such as the keyboard and mouse.
• Output devices
Output devices allow you to output information from the computer
and include the printer and the monitor.
• Peripheral device
A peripheral device is any device which you can attach to your
computer. Thus, you could attach a scanner or modem to the back of
your system unit.
Main Parts of a Personal Computer:
1) The System (Mother) Board
The system (mother) board is contained
within your system unit and all the vital
computer systems plug directly into the
system board. The CPU is normally
housed on your system board along with
all the other electronic components.
Other items such as the hard disk are
attached to the system board, either
directly or via cables.
2) CPU
Used for temporary storage of data and Used for permanent storage of firmware or
instructions. software.
Read and write operations are possible. Typically only read operations are possible.
How does these components connect and exchange data?
This done by the system bus, which is a communication pathway that connects
various components inside a computer system. It serves as a highway through
which data and control signals travel between the CPU, memory, and other
peripheral devices.
buses types:
• Address Bus: This bus carries memory addresses generated by the CPU. Each
address corresponds to a specific location in memory or a peripheral device. The
width of the address bus determines the maximum amount of memory that can
be addressed by the CPU. Unidirectional
• Data Bus: The data bus is used to transfer data between the CPU, memory, and
peripheral devices. It carries binary information in the form of data bytes or
words. The width of the data bus determines how many bits can be transferred
simultaneously. Bidirectional
• Control Bus: The control bus carries control signals that coordinate the activities
of various components within the computer system. These signals include
read/write signals, interrupt signals, clock signals, and bus control signals.
Bidirectional
System Bus
CPU components
The CPU (Central Processing Unit) contains several key components that work together to execute
instructions and perform calculations. Here are the main components found inside a CPU:
• Arithmetic Logic Unit (ALU): This is the part of the CPU responsible for performing arithmetic
operations (like addition and subtraction) and logical operations (like AND, OR, and NOT).
• Control Unit (CU): The Control Unit manages the execution of instructions by controlling the flow
of data within the CPU and between the CPU and other parts of the computer system. It decodes
instructions and generates control signals to coordinate the activities of other CPU components.
• Registers: Registers are small, high-speed storage locations inside the CPU that hold data
temporarily during processing. They include the following types:
• Program Counter (PC): Holds the memory address of the next instruction to be fetched.
• Instruction Register (IR): Holds the current instruction being executed.
• General-Purpose Registers: Used for various computational tasks and data manipulation.
• Cache Memory: Cache memory is a small, high-speed memory that stores frequently accessed
data and instructions to speed up processing. It helps reduce the time the CPU spends waiting for
data from the slower main memory (RAM).
• Clock: The CPU contains a clock that generates electrical signals to synchronize the operation of its
components. The clock signal determines the speed at which instructions are executed, measured
in cycles per second (Hertz).
These components work together to fetch, decode, execute, and store instructions and data,
allowing the CPU to perform the tasks required by software programs and the operating system.
What is program ?
Program:
• A program is a set of instructions written in a programming language that tells
a computer what to do. It is a sequence of instructions that are executed by
the computer's CPU to perform specific tasks.
Process:
• A process is an instance of a program that is currently running on a computer.
When you execute a program, the operating system creates a process for it. A
process includes the program code, data, and resources needed to execute
the program. Each process has its own memory space and runs independently
of other processes. Multiple processes can run concurrently on a computer,
allowing it to perform multiple tasks simultaneously.
Execution of an Instruction:
The execution of an instruction by the CPU typically
involves several steps, which collectively form the
instruction cycle. Here's a simplified overview of
these steps:
• Fetch: Retrieve an instruction from memory using
the program counter (PC) to determine its Instruction cycle
memory address.
• Decode: The fetched instruction is decoded to
understand what actions are needed`
• Execute: The CPU performs the operation
specified by the instruction. This step may involve
fetching additional data from memory or
registers.
Pipelining
• Pipelining is a technique used in the design of CPUs and other digital circuits to improve performance by overlapping the
execution of instructions. In a pipelined processor, multiple instructions are simultaneously processed at different stages of
their execution.
Pipeline Stages
The typical stages of a pipeline in the context of the instruction cycle are:
• Fetch: Retrieve the instruction from memory.
• Decode: Translate the instruction into signals that control other parts of the CPU.
• Execute: Perform the operation specified by the instruction.
How Pipelining Works
• Instead of waiting for one instruction to complete all stages before starting the next, pipelining allows the CPU to start
executing a new instruction in the next stage of the pipeline as soon as the previous stage is free. In this way, multiple
instructions are being processed simultaneously, with each one at a different stage of the pipeline.
Benefits of Pipelining
• Increased Throughput: More instructions are completed in a given period of time.
• Efficient Use of CPU Resources: Different parts of the CPU are utilized simultaneously.
Memory Capacity
• Bit: All computers work on a binary numbering system, i.e. they
process data in ones or zeros. This 1 or 0 level of storage is called a
bit. Often hardware is specified as a 32-bit computer, which means
that the hardware can process 32 bits at a time. Software is also
described as 16 bit, 32 bit or 64 bit software.
• CPU process only 0s and 1s, all data are translated through computer
languages into series of these binary digits, or bits.
• Eight bits are needed to represent a character. This 8-bit string is
known as a byte.
The hierarchy of byte memory capacity is as follows:
• Utility Programs: Tools that perform maintenance tasks like antivirus software, disk
cleanup tools, and backup software.
• Device Drivers: Specialized programs that allow the operating system to communicate
with hardware devices like printers, graphics cards, and network adapters.
Application Software
Application software is designed to help users perform specific tasks or
activities. It includes programs like:
• Word Processors: Such as Microsoft Word, which are used for
creating and editing documents.
• Web Browsers: Like Google Chrome or Firefox, used for browsing the
internet.
• Media Players: Such as VLC or Windows Media Player, used for
playing audio and video files.
• Games: Software designed for entertainment.
In simple words: Application software is the software you use to get
specific tasks done, like writing a document, browsing the internet, or
playing a game.
interrupt
• An interrupt is a signal sent to the CPU by hardware or software indicating an
event that needs immediate attention. It temporarily halts the current CPU
operations, saves its state, and executes a function called an interrupt
handler to deal with the event. After the interrupt handler completes, the
CPU resumes its previous operations.
Types of Interrupts:
• Hardware Interrupts: Generated by hardware devices like keyboards, mice,
printers, or network cards to signal that they need processing.
• Example: Pressing a key on the keyboard generates an interrupt to signal the CPU to
read the key press.
• Software Interrupts: Generated by programs or the operating system to
signal that a certain event has occurred.
• Example: A program may generate a software interrupt to request a service from the
operating system, like file reading or writing.
• Timer Interrupts: Generated by a timer within the CPU at regular intervals to
manage time-critical operations like multitasking.
How Interrupts Work
• Interrupt Signal: The device or software generates an interrupt signal.
• CPU Response: The CPU stops its current operations and saves its state (program
counter, registers, etc.).
• Interrupt Handler: The CPU executes a special function called the interrupt handler or
interrupt service routine (ISR) to handle the event.
• Return to Normal Operation: After the interrupt handler completes, the CPU restores its
saved state and resumes the interrupted task.
In simple words: An interrupt is like a tap on the shoulder for the CPU, telling it to pause its
current work and handle an important task immediately.
Core:
What is CPU core?
• A core is the part of a CPU (Central Processing Unit) that performs the actual computation and execution of instructions. It contains an
ALU (Arithmetic Logic Unit), control unit, and registers, which work together to process data and execute instructions. Essentially, each
core is capable of performing its own set of instructions independently.
A single-core processor has only one core. It can execute one instruction at a time, and tasks are handled sequentially. This was the
standard in earlier computer systems.
• Advantages:
• Simplicity: Easier to design and manufacture.
• Cost: Generally less expensive than multi-core processors.
• Disadvantages:
• Performance: Limited by the single core's ability to handle only one task at a time. As demands for processing power increased,
this became a bottleneck for performance.
A multi-core processor has two or more cores on the same chip. Each core can run its own thread of execution, allowing the CPU to
handle multiple tasks simultaneously.
• Advantages:
• Increased Performance: Multiple cores can execute multiple instructions at the same time, significantly improving performance,
especially for multitasking and parallel processing applications.
• Energy Efficiency: Multiple cores can run at lower frequencies than a single high-speed core, often resulting in better energy
efficiency for the same performance.
• Better Multitasking: More cores mean better handling of multiple applications and background processes.
• Disadvantages:
• Complexity: More complex to design and manage, both in hardware and in software (e.g., writing efficient multi-threaded
programs).
• Cost: Generally more expensive than single-core processors.
Examples:
• Single-Core Processor:
• Intel Pentium 4
• AMD Athlon XP
• Multi-Core Processor:
• Dual-Core: Intel Core 2 Duo, AMD Athlon X2
• Quad-Core: Intel Core i5, AMD Ryzen 5
• Octa-Core: Intel Core i7, AMD Ryzen 7
• Higher-Core: Intel Core i9, AMD Ryzen 9 (up to 16 or more cores)
In simple words:
• Core: A core is a unit within a CPU that processes data.
• Single-Core: A CPU with one core, doing one task at a time.
• Multi-Core: A CPU with multiple cores, handling several tasks at once, making
it faster and better for multitasking.
Multitasking and Multithreading
Multitasking refers to the ability of an operating system to manage the execution
of multiple tasks or processes at the same time. It allows multiple programs or
processes to run concurrently, sharing the system's resources such as CPU,
memory, and I/O devices.
• In simple words: Multitasking is like having multiple people working at different
tasks in a room, taking turns to use a single tool, so everyone gets a chance to
work.
Multi-threading refers to the ability of a CPU, or a single process, to manage its
execution using multiple threads. A thread is the smallest unit of execution within a
process, and multi-threading allows different parts of a program to run
concurrently.
• In simple words: Multi-threading is like having multiple workers (threads) inside a
single department (process), each performing different tasks at the same time,
sharing the same workspace and resources.
How can the system perform multitasking on
a single core ?
Context switching is the process by which a computer's operating system
switches the CPU from executing one process (or thread) to another. This
allows multiple processes to share a single CPU, creating the illusion of
parallelism in a single-core system.
Steps in Context Switching:
• Save the State: The current state of the running process is saved. This
includes the program counter, registers, and other process-specific
information.
• Load the State: The saved state of the next process to be executed is loaded
into the CPU. This involves restoring the program counter, registers, and
other information.
• Update Data Structures: The operating system updates its internal data
structures to reflect the change in process states.
Why Context Switching Happens
• Multitasking: To allow multiple processes to run seemingly simultaneously.
• Interrupt Handling: When the CPU must handle an interrupt, it saves the
current state of the running process, processes the interrupt, and then
resumes the process.
In simple words: Context switching is when the CPU changes from working
on one task to another, ensuring that all tasks get a chance to run.
What is a Kernel in an Operating System?
The kernel is the core part of an operating system (OS). It manages the system's resources and acts as a bridge
between the hardware and software applications. The kernel is responsible for critical tasks such as managing
memory, processes, and hardware devices, ensuring that software applications can function smoothly and
efficiently.
Key Functions of the Kernel:
1. Process Management:
• Scheduling: Determines which processes run at any given time.
• Creation and Termination: Manages the lifecycle of processes, including creation, execution, and termination.
• Context Switching: Switches between processes to ensure multitasking.
2. Memory Management:
• Allocation: Allocates memory to processes and ensures they do not interfere with each other.
• Virtual Memory: Provides processes with a virtual memory space that may be larger than the physical memory.
3. Device Management:
• Drivers: Interacts with hardware devices through device drivers.
• Communication: Provides a standardized way for software to communicate with hardware devices.
4. File System Management:
• File Operations: Manages files on storage devices, including reading, writing, and organizing files.
• Permissions: Controls access to files and directories.
5. Interrupt Handling:
• Event Handling: Responds to interrupts from hardware and software to ensure timely processing of events.
6. Security and Access Control:
• User Authentication: Ensures that only authorized users can access the system.
• Permissions: Manages access rights to system resources.
What is DMA?
Direct Memory Access (DMA) is a feature that allows certain hardware
components within a computer system to access the system memory
independently of the CPU. This enables data to be transferred directly
between memory and peripherals without involving the CPU for each byte of
data, significantly improving the efficiency and speed of data transfer.
Key Functions and Benefits of DMA:
• Offloading the CPU:
• By handling data transfers independently, DMA frees up the CPU to perform other
tasks, improving overall system performance.
• Speed and Efficiency:
• DMA can transfer data faster than if the CPU were involved in every step, especially
for large blocks of data.
• Reduced Latency:
• Peripherals can send or receive data more quickly since they do not have to wait for
CPU intervention.
How DMA Works
• DMA Controller:
• A special hardware component called the DMA controller manages DMA
operations. It handles the data transfer between memory and the I/O devices.
• Initiation:
• The CPU sets up the DMA controller by providing it with details about the
data transfer, such as the source and destination addresses and the amount
of data to be transferred.
• Transfer:
• Once initiated, the DMA controller takes over the data transfer process. It
moves data directly between memory and the peripheral device without
involving the CPU.
• Completion:
• After the transfer is complete, the DMA controller sends an interrupt signal to
the CPU, indicating that the data transfer is finished.
Windows
The Windows operating system is a graphical user interface (GUI) based operating system developed
by Microsoft. It's one of the most widely used operating systems for personal computers.
How Windows Works
At its core, Windows acts as a bridge between the hardware components of your computer (like the
processor, memory, and storage) and the software applications you use (like web browsers, word
processors, and games).
1. Hardware Interaction:
o Windows manages the computer's resources, ensuring that different programs can access the
hardware they need without interfering with each other.
o It controls the flow of data between the hardware components.
Windows
2.User Interface:
o Windows provides a visual interface with icons, menus, and windows that allow users to interact
with the computer easily.
o It enables users to open and run applications, manage files, and control various settings.
Windows
3 .Software Management:
o Windows manages the installation, updates, and removal of software applications.
o It provides a platform for software developers to create applications that are compatible with the
Windows environment.
Windows
4 .File System:
o Windows organizes files and folders on the computer’s
storage devices, making it easy to find and access them.
o It provides features like search, sorting, and filtering to
help users manage their files efficiently.
5.Security:
o Windows includes built-in security features like firewalls, antivirus protection, and user account
controls to protect the computer from malware and unauthorized access.
o In essence, Windows acts as the central nervous system of your computer, managing its resources,
providing a user-friendly interface, and ensuring that everything runs smoothly.
Numbering System