0% found this document useful (0 votes)
2 views11 pages

Intro Computer

Uploaded by

vasef63935
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)
2 views11 pages

Intro Computer

Uploaded by

vasef63935
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

🔹 Definition

 Bus: A set of wires/lines that connects various computer components (CPU, memory, I/O devices) for
communication.

 It transfers data, addresses, and control signals between devices.

🔹 Types of Buses

🟢 1. Address Bus

 Carries memory addresses during read/write operations.

 Determines the location (address) in memory or I/O port.

 Earlier systems → Unidirectional (only CPU sends addresses).

 Modern systems → Bidirectional.

Important Terms:

 Memory address → Specifies location of data/instruction.

 I/O port address → Identifies peripheral devices.

🟢 2. Data Bus

 Carries actual data between CPU, memory, and I/O devices.

 Bidirectional – data can flow both ways.

 Transfers:

o Instructions from memory to CPU.

o Results of operations from CPU to memory/I/O.

o Commands to and from controllers.

Important Terms:

 Instruction fetch → Getting instruction from memory.

 I/O data transfer → Exchange of data with devices.

🟢 3. Control Bus

 Carries control signals to coordinate operations among CPU, memory, and I/O.

 Examples of control signals:

o Memory Read / Write → Issued by CPU or DMA during memory access.

o I/O Read / Write → Issued by CPU for input/output ports.

o Ready Signal → Synchronizes slow devices with fast CPU.


Important Terms:

 DMA (Direct Memory Access) → Allows data transfer without CPU intervention.

 Synchronization → Ensures timing match between CPU and devices.

🔹 Example of Modern Bus

 USB (Universal Serial Bus):

o A fast serial bus used for connecting external devices.

o Commonly used in PCs, mobiles, video games, etc.

🧭 Quick Recap Table

Bus Type Direction Carries Issued By Examples/Notes

Unidirectional /
Address Bus Memory/I/O addresses CPU Determines data location
Bidirectional

Data Bus Bidirectional Data & instructions CPU ↔ Memory/I/O Transfers actual data

Control Bus Mixed Control signals (read/write) CPU/DMA Coordinates operations

🔹 BASIC I/O (Input-Output System)

 Provides communication between CPU (central system) and the external environment.

 Manages all input and output operations in a computer system.

🟢 Peripheral Devices

 Peripheral Devices: External devices connected to a computer that perform input/output operations under
CPU control.

 Examples: Keyboard, Mouse, Monitor, Printer, Touchscreen, etc.

🔸 Types of Peripherals

Type Function Examples

Input Devices Send user input to the computer. Keyboard, Mouse

Output Devices Display or output data from the computer. Monitor, Printer

Input-Output Devices Perform both input and output. Touchscreen

🟢 Modes of I/O Data Transfer

Three ways data is transferred between CPU (Central Unit) and I/O devices:
🔸 1. Programmed I/O

 Simplest method of I/O communication.

 CPU directly controls I/O operations by executing instructions.

 CPU waits until the I/O device completes operation.

 Drawback: Causes busy waiting (CPU time wasted in waiting loop).

Key Term:

 Busy waiting → CPU continuously checks device status, reducing efficiency.

🔸 2. Interrupt Driven I/O

 CPU does not wait continuously for I/O device.

 When the device is ready, it sends an interrupt signal to CPU.

 CPU pauses current task, handles I/O operation, then resumes previous work.

 Advantage: Saves CPU time, increases efficiency.

Key Term:

 Interrupt → A signal from a device requesting CPU attention.

🔸 3. Direct Memory Access (DMA)

 Data transfer bypasses CPU → device communicates directly with memory.

 DMA Controller manages transfer between memory and peripherals.

 Faster than other methods.

 Used in disk drives, graphics cards, network cards, sound cards, etc.

Key Term:

 DMA Controller → Special hardware unit that controls direct data transfer between devices and memory.

🧭 Quick Recap Table

Mode CPU Role Data Transfer Path Speed Drawback / Advantage

Programmed I/O Actively controls and waits CPU ↔ I/O Slow Busy waiting

Interrupt Driven I/O Responds to interrupt CPU ↔ I/O Moderate CPU time saved

DMA Not involved Device ↔ Memory Fast Requires DMA controller

🔹 SUBROUTINES

🟢 Definition
 A subroutine is a small program or block of instructions designed to perform a specific subtask repeatedly
with different inputs.

 Examples: Calculating factorial, checking prime number, etc.

🟢 Purpose

 Avoids repetition of code.

 Saves memory space — only one copy of the subroutine exists in memory.

 Makes program modular and easier to debug.

🟢 Key Operations and Terms

Term Meaning / Function

Calling Program The main program that requests the subroutine.

Subroutine The block of code that performs the task and returns a result.

Call Instruction Transfers control from main program to the subroutine.

Return Instruction Transfers control back to the main program after execution.

Program Counter (PC) Holds the address of the next instruction to be executed.

Link Register Stores the return address (content of PC) before branching to the subroutine.

Subroutine Linkage Mechanism to call and return from subroutines safely.

🟢 Process Flow

1. Call instruction stores the return address (PC) in the link register.

2. Control transfers to the start of the subroutine.

3. Subroutine executes its instructions.

4. Return instruction transfers control back to the calling program (using address from link register).

🔹 INTERRUPTS

🟢 Definition

 An interrupt is a signal sent to the CPU requesting it to pause current execution and perform a specific task
(interrupt service).

 After completing the task, CPU resumes the previous process.

🟢 Key Terms

Term Meaning / Function

Interrupt Service Routine (ISR) A small routine executed by CPU to handle an interrupt.
Term Meaning / Function

Interrupt Request (IRQ) Signal sent by device to request CPU attention.

Servicing the Interrupt Executing the ISR and completing the interrupt task.

🟢 Types of Interrupts

🔸 1. Hardware Interrupts

 Generated by external I/O devices.

 Two types:

o Maskable Interrupt: Can be ignored or delayed by CPU if busy.

o Non-Maskable Interrupt (NMI): Cannot be ignored; handled immediately.

🔸 2. Software Interrupts

 Generated by program instructions or system calls within the CPU.

 Often used for system-level operations or error handling.

🟢 Interrupt Nesting

 Occurs when an interrupt happens while another interrupt is being serviced.

 Normally, CPU disables interrupts during ISR execution to prevent overlap.

 If multiple interrupts occur:

o They are handled according to priority.

o If the CPU can manage multiple interrupts properly → it supports multiple interrupt processing.

🧭 Quick Recap Table

Concept Purpose / Definition Key Point

Subroutine Reusable block of code Saves memory, modularizes code

Call Instruction Transfers control to subroutine Stores return address in link register

Return Instruction Returns control to main program Uses stored address

Interrupt Signal to CPU to pause and service event Improves responsiveness

Hardware Interrupt From external device Can be maskable or non-maskable

Software Interrupt From software/system call Triggered internally

Interrupt Nesting Handling multiple interrupts Based on priority

🔹 DIRECT MEMORY ACCESS (DMA)

🟢 Definition

 DMA (Direct Memory Access) allows data transfer between memory and I/O devices without CPU
involvement.
 Used for fast, large-block data transfers.

 Overcomes the drawbacks of Programmed I/O and Interrupt-Driven I/O, where the CPU remains busy during
transfer.

🟢 Working Principle

 A DMA Controller manages the transfer directly via system buses.

 CPU is temporarily released from data transfer tasks.

🟢 Types of DMA Transfer

Mode Description CPU Role

DMA controller takes full control of system buses to transfer a CPU waits until DMA releases
Burst Mode
block of data continuously. the bus.

Cycle Stealing CPU execution is paused briefly


DMA steals one clock cycle per data byte transfer.
Mode each time.

Transparent
DMA transfers data only when CPU is idle. CPU works normally otherwise.
Mode

🟢 Advantages

 Reduces CPU overhead during I/O transfer.

 Faster read/write operations for large data blocks.

 Efficient use of clock cycles.

🔴 Disadvantages

 Cache coherence problem — DMA may access unsynchronized (outdated) data if caches are not properly
managed.

 Costly to implement (requires dedicated hardware controller).

🧭 Quick Recap Table

Feature DMA Programmed I/O / Interrupt I/O

CPU Involvement No Yes

Data Transfer Speed High Low

Efficiency Very High Moderate

Best For Large Data Blocks Small Data Transfers


🔹 RAM AND ROM

🟢 Definition

 Primary Memory stores data and instructions currently in use by the CPU.

 It is volatile — data is lost when power is off.

 Divided into: RAM (Random Access Memory) and ROM (Read-Only Memory).

🟢 Random Access Memory (RAM)

 Volatile, read/write memory used by CPU for temporary storage.

 Data is randomly accessible and erased on power off.

 Used for program execution and data processing.

🔸 Types of RAM

Type Description Use

Static RAM Retains data as long as power is supplied. Built with 6-transistor cells
Used in cache memory.
(SRAM) (no capacitors). No refreshing needed. High cost, very fast.

Dynamic RAM Must be periodically refreshed to retain data. Uses capacitors. Used in main system memory
(DRAM) Cheaper and slower than SRAM. (primary memory).

🟢 Read-Only Memory (ROM)

 Non-volatile memory — retains data even when power is off.

 Data is pre-programmed during manufacturing; cannot be modified easily.

 Stores bootstrap (startup) instructions needed to start the computer.

🔸 Types of ROM

Type Description

PROM Programmable once after manufacturing.

EPROM Erasable using UV light and reprogrammable.

EEPROM Electrically erasable and programmable multiple times.

🧭 Difference Between RAM and ROM

Feature RAM ROM

Volatility Volatile (data lost on power off) Non-volatile (data retained)

Operation Read & Write Read-only

Usage Stores temporary data/programs Stores permanent instructions (bootstrap)

Location/Use CPU Cache, Primary Memory Firmware, Microcontrollers


Feature RAM ROM

Speed & Cost High speed, expensive Slower, cheaper

🔹 PIPELINE

🟢 Definition

 Pipelining is a technique used to execute multiple instructions simultaneously by dividing them into smaller
sub-tasks.

 It helps increase throughput (number of instructions executed per unit time).

 Each sub-task performs a dedicated operation — e.g., fetch, decode, execute.

🟢 Types of Pipeline

Type Description Example / Use

Arithmetic Used for arithmetic operations such as floating-point Used in math processors and ALU
Pipeline addition, subtraction, multiplication, etc. operations.

Instruction Overlaps fetch–decode–execute phases of different Used in modern CPUs for simultaneous
Pipeline instructions to improve CPU efficiency. instruction execution.

🟢 Advantages

 Increases system throughput.

 Reduces cycle time of the processor.

 Makes the system faster and more reliable.

🔴 Disadvantages

 Increases instruction latency (delay before first result).

 Design and implementation are complex and costly.

🧭 Quick Recap Table

Feature Benefit / Limitation

Throughput Increases due to parallel execution

Cycle Time Reduced

Latency Increased

Design Complex

Example Instruction execution pipeline (Fetch → Decode → Execute)


🔹 SYSTEM CALLS

🟢 Definition

 System Calls provide an interface between a user process and the operating system kernel.

 They are the only way for a program to request services (like file operations, process creation, or device
access) from the OS.

🟢 Working Principle

Mode Description

User Mode Process starts here — has limited access to hardware.

Kernel Mode When a system call is made, control transfers here; OS performs the requested operation.

Return to User Mode After completion, the process resumes in user mode.

Flow:
User Process → System Call → Kernel Mode (service) → Back to User Mode

🟢 Need for System Calls

Used when a process needs to:

 Create, read, write, or delete files.

 Create or manage processes.

 Send or receive network data packets.

 Handle I/O devices (keyboard, printer, etc.).

 Access or control hardware.

🟢 Types of System Calls

Type Function / Description

File Management Create, read, write, delete files.

Process Management Create and manage processes.

Device Management Handle hardware devices.

Information Maintenance Get/set system data or time.

Communication Exchange data between processes or systems.

🟢 Examples of System Calls


Type Windows Linux/Unix

CreateProcess(), fork(),
Process Control ExitProcess(), exit(),
WaitForSingleObject() wait()

CreateFile(), open(),
ReadFile(), read(),
File Manipulation
WriteFile(), write(),
CloseHandle() close()

ioctl(),
SetConsoleMode(),
Device Manipulation read(),
ReadConsole()
write()

GetCurrentProcessID(), getpid(),
Information Maintenance SetTimer(), alarm(),
Sleep() sleep()

pipe(),
CreatePipe(),
Communication shmget(),
MapViewOfFile()
mmap()

chmod(),
SetFileSecurity(),
Protection umask(),
InitializeSecurityDescriptor()
chown()

🧭 Quick Recap Table

Aspect System Calls

Purpose Interface between process and OS kernel

Execution Mode Switches from User Mode → Kernel Mode → back

Uses File, Process, Device, Communication handling

Advantage Secure and controlled access to OS resources

Example (Linux) fork(), read(), write(), wait()

Questions

1. RAM is of __________ types. A. 1 B. 2 C. 3 D. 4


2. Which type of ROM is used for erasing purposes only ?
A. PROM B. EPROM C. EEPROM D. Both B and C
3. The DMA differs from the interrupt mode by __________. A. The involvement of the
processor for the operation B. The method of accessing the I/O devices C. The amount of
data transfer possible D. None of the mentioned
4. The DMA controller has __________ registers. A. 4 B. 1 C. 2 D. 3
5. When dealing with multiple devices interrupts, which mechanism is easy to implement? A.
Polling method B. Vectored interrupts C. Interrupt nesting D. None of the mentioned
6. Which of the following groups are only input devices? A. Mouse, Keyboard, Monitor,
Joystick B. Mouse, Keyboard, Printer, Light Pen C. Mouse, Keyboard, Scanner, Joystick,
Light Pen D. Mouse, Keyboard, Trackball, Touch Screen, Microphone
7. Which of the following is not a pointing device ? A. Mouse B. Joystick C. Light pen D.
Digitizer
8. The given hexadecimal number is ( 1 E .53 )16 equivalent to __________.
A. ( 35.684 )8 B. ( 36.246 )8 C. ( 34.340 )8 D. ( 35.599 )8
9. Which of the following groups are only input devices?
A. Mouse, Keyboard, Monitor, Joystick B. Mouse, Keyboard, Printer, Light
Pen C. Mouse, Keyboard, Scanner, Joystick, Light Pen
D. Mouse, Keyboard, Trackball, Touch Screen, Microphone
10. Which of the following is not a pointing device ?
A. Mouse B. Joystick C. Light pen D. Digitizer
11. The given hexadecimal number (1E.53)16 is equivalent to ______________.
A. ( 35.684 )8 B. ( 36.246 )8 C. ( 34.340 )8 D. (35.599)8
12. The octal equivalent of the decimal number (417)10 is ______________.
13. A. (641)8
14. B. (619)8
15. C. (640)8
16. D. (598)8
17. On multiplication of (10.10) and (01.01), we get ______________.
18. A. 101.0010
19. B. 0010.101
20. C. 011.0010
21. D. 110.0011
22. 1's complement of 1011101 is ______________.
23. A. 0101110
24. B. 1001101
25. C. 0100010
26. D. 1100101
27. 2's complement of 11001011 is ______________.
28. A. 0101111
29. B. 11010100
30. C. 00110101
31. D. 11100010
32.

You might also like