Download Computer Systems: Number Systems, Operating Systems, and Software Overview and more Schemes and Mind Maps Computer science in PDF only on Docsity!
COMPUTER SYSTEMS SARTAJ AZIZ KHAN
Computer system: A computer system is a complete setup that includes the computer, its hardware, software, and other connected devices. It works together to take input, process data, store information, and give output. Machine-level representation of data It means storing all information in the form of binary digits (0s and 1s). Computers use these binary codes to represent numbers, text, images, and sounds internally. Binary number system: It uses only two digits: 0 and 1. It is the language of computers, where all data is stored and processed using these two digits. Binary is based on powers of 2. Example: ( 101 )2 n binary means: → (1 × 2²) + (0 × 2¹) + (1 × 2⁰) → (1 × 4) + (0 × 2) + (1 × 1) = ( 5 ) Octal Number System (Base-8): The octal number system uses 8 digits : 0 to 7. It is based on powers of 8 and is often used as a shorter way to represent binary numbers. Example: Octal Number: ( 17 ) Convert to Decimal: = (1 × 8¹) + (7 × 8⁰) = (1 × 8) + (7 × 1) = 8 + 7 = ( 15 )10 (in Decimal) Floating point number: Number= 25. 25 = (11001) Multiply repeatedly by 2, keep the integer part: (.6 is integral part)
- 0.6 × 2 = 1.2 → 1
- 0.2 × 2 = 0.4 → 0
- 0.4 × 2 = 0.8 → 0
- 0.8 × 2 = 1.6 → 1
- 0.6 × 2 = 1.2 → 1 (repeats…) → 0.6 in binary = (.100110011001... (repeating)) By combining 25.6 in binary ≈ (11001.100110011001...) 2 Decimal Number System (Base-10): The decimal number system is the most common number system, which uses 10 digits: 0, 1, 2, 3, 4, 5 , 7, 8, and 9. It is based on powers of 10, and we use it in everyday life for counting and performing arithmetic. eg: The decimal number 345 can be broken down as (3 × 10²) + (4 × 10¹) + (5 × 10⁰), which equals 300 + 40 + 5. Hexadecimal (Base 16): The hexadecimal number system is a way to represent numbers using 16 digits: 0 to 9 and A to F (where A = 10, B = 11, ..., F = 15). It is often used in computers to make long binary numbers shorter and easier to read.
Hexadecimal: 0 1 2 3 4 5 6 7 8 9 A B C D E F Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Example: Convert ( 1C ) 16 to decimal.
- 1C = (1 × 16¹) + (C × 16⁰)
- C = 12 in decimal
- = (1 × 16) + (12 × 1)
- = 16 + 12 = ( 28 ) Conversion of one number system to another Conversion of any base to base 10: To convert a number from any base to base 10, multiply each digit by the base raised to the power of its position (right to left, starting from 0). Then add all the results to get the decimal (base 10) value. OR To convert a number from any base to base 10 (left to right), start from the leftmost digit and multiply it by the base. Add the next digit and repeat the process for all digits—this is called Horner's method. Binary (Base 2) to decimal (Base 10) From decimal (Base 10) Binary (Base 2): Number: ( 1011 )2 Number: (73) Start with leftmost digit:
- (1 × 2^3 ) + (0× 22 ) +(1× 21 ) + (1× 20 ) = 8 + 0 + 2 + 1 ( 1011 )2 = ( 11 ) Octal (Base 8) to decimal (Base 10) From decimal (Base 10) to Octal (Base 8): Number: (25) 8 Number: (1032) Use powers of 8: =(2×8^1 )+(5×8^0 ) =16+5 ● (1032)10 = (2010) (25) 8 =( 21 ) Hexadecimal (Base 16) to decimal (Base 10) From decimal (Base 10) to hexadecimal (Base 16) Number: (1C) 16 ●(Note: C = 12 in decimal) Number: ( 765 ) 10 ● 15=F & 13=D Use powers of 16: (1×16^1 ) + (12×16^0 ) =16+12=28 ● ( 765 )10 = (02FD) 16 (1C) 16 = (28) 10 Conversion of integer and fractional part to binary (Base 2): 1. Start with a decimal number (e.g., 12.375). 2. Separate the integer part (12) and the fractional part (0.375). 3. Convert the integer part to binary by repeated division by 2. 4. Convert the fractional part to binary by repeated multiplication by 2. 5. Combine both binary parts to get the final binary number (e.g., 1100.011).
- Write the octal digits together : 2 3 7
- Final octal number is : 237 So, binary 010011111 = octal 237 Hexadecimal to Binary Conversion Let’s take an example: Hexadecimal number = 2F
- Write the given hexadecimal number : 2F
- Split into individual hex digits : 2, F
- Convert each hex digit to 4-bit binary using a table: o 2 → 0010 o F → 1111
- Write all binary groups together : 0010 1111
- Final binary number : 00101111 Binary to Hexadecimal Conversion
- Now convert binary 00101111 back to hexadecimal:
- Write the given binary number : 00101111
- Group binary digits in 4s from right to left : 0010 1111
- Convert each 4-bit group to hexadecimal using a table :
- 0010 → 2
- 1111 → F
- Write the hex digits together : 2 F Conversion of Octal to Hexadecimal
- Step 1: First, read the given octal number clearly — here, it's 2- 3 - 7.
- Step 2: Convert the octal number to binary. o Each octal digit becomes a 3-digit binary number: ▪ 2 → 010 ▪ 3 → 011 ▪ 7 → 111 o Combine them: 010011111
- Step 3: Now convert this binary number to hexadecimal. o Group the binary digits in sets of 4 from right to left: 0010 1111
- Step 4: Convert each group into a hexadecimal digit: o 0010 → 2 o 1111 → F
- Step 5: Read the final hexadecimal number as: 2F So, Octal 237 becomes Hexadecimal 2F Convert Hexadecimal 2F to Octal
Conversion of Hexadecimal to Octal:
- Step 1: Start with the given hexadecimal number — in this case, "2-F".
- Step 2: Convert each hexadecimal digit to its 4 - bit binary form: o 2 → 0010 o F → 1111 o Combined binary: 00101111
- Step 3: Group the binary digits in 3s from right to left to prepare for octal conversion: o Grouped as: 000 010 111 111 (add leading zeros if needed to make complete 3-bit groups) o Remove extra leading zero if not needed: 010 011 111
- Step 4: Convert each 3-bit group to its octal digit : o 010 → 2 o 011 → 3 o 111 → 7
- Step 5: Read the final octal number as: 237 Binary arithmetic: It is a method of performing math operations like addition, subtraction, multiplication, and division using only two digits: 0 and 1. It follows the same basic rules as decimal arithmetic but works in the base-2 number system. It is used by computers to process and calculate data. Binary Addition Steps
- Write the binary numbers one below the other, just like in normal addition.
- Start adding from the rightmost bit (just like decimal addition).
- Use these binary addition rules : o 0 + 0 = 0 o 0 + 1 = 1 o 1 + 0 = 1 o 1 + 1 = 10 (write 0 and carry 1) o 1 + 1 + 1 = 11 (write 1 and carry 1)
- Continue adding each bit , carrying over as needed. Binary Subtraction Steps
- Write the binary numbers one below the other, just like in normal subtraction.
- Start subtracting from the rightmost bit , just like decimal subtraction.
- Use these binary subtraction rules : o 0 - 0 = 0 o 1 - 0 = 1 o 1 - 1 = 0 o 0 - 1 = borrow (borrow 1 from the next higher bit and add 10 to the current bit)
- When borrowing , reduce the next higher bit by 1 and add 10 to the current bit.
1's Complement (Simple Definition):
- 1's Complement is a method where you flip all the bits of a binary number — change every 0 to 1 and every 1 to 0. It's mainly used to represent negative numbers in early computer systems. Example: Let's take a 4-bit binary number: Original (Positive): 1010. Now, flip all bits: 1's Complement: 0101 So, the 1's complement of 1010 is 0101 2's Complement (Simple Definition): 2's Complement is a way to represent negative numbers in binary by:
- First taking the 1's complement (flip all bits),
- Then add 1 to the result. It is the most used method for signed binary numbers in modern computers. Example: Let’s take a 4-bit binary number: Original (Positive): 1010 Step 1 – 1's Complement: Flip all bits: 0101 Step 2 – Add 1: 0101
- 0001 0110 So, the 2's complement of 1010 is 0110 Steps for Binary Subtraction Using 1's Complement:
- Write A and B in binary (same number of bits).
- Find the 1's complement of B (flip all bits of B).
- Add the 1’s complement of B to A.
- If there is a carry , add it back to the result (end-around carry).
- If no carry , the result is negative — take 1’s complement of the result and put a minus sign. Example: Subtract 5 - 3 using 4 - bit binary
- A = 5 → 0101
- B = 3 → 0011 Step 1: 1’s complement of B = 1100 Step 2: Add to A: Step 3: Carry is 1 → Add it back: Answer: 0010 (which is 2)
0001 (ignore overflow 5th bit)
0010
Binary Subtraction Using 2's Complement (Definition): In this method, to subtract B from A (A - B) , you add the 2's complement of B to A instead of subtracting directly. If there's a carry, it's discarded, and the result is positive. If there's no carry, the result is negative (in 2's complement form). Example: Subtract 5 - 3 using 4-bit binary
- A = 5 → 0101
- B = 3 → 0011 Step 1: Find 2's complement of B
- 1’s complement of 0011 = 1100
- Add 1: 1100 + 0001 = 1101 Step 2: Add to A Step 3: Discard the overflow bit (5th bit): Result = 0010 → which is 2 in decimal Final Answer: 2 Signed Numbers & Unsigned Numbers Representation: Signed Numbers
- Use one bit (the leftmost) to show sign: o 0 means positive o 1 means negative
- Example (4 bits using 2’s complement): 1111 = - 1, 0111 = + Unsigned Numbers
- Use all bits to show the number.
- Can only be positive or zero.
- Example (4 bits): 1111 = 15 (just a number, no sign) Main difference :
- Unsigned = Only positive
- Signed = Positive and negative using sign bit Floating-Point Representation:
- Floating-point numbers are stored like this:
- ± mantissa × baseexponent
- In binary, this looks like:
8. Error Detection and Handling 1. Process Management Controls the execution of running programs. It handles starting, pausing, resuming, and stopping processes efficiently. 2. Memory Management Manages computer memory (RAM) by allocating and freeing space as needed. Ensures each program has enough memory without affecting others. 3. File Management Handles creation, storage, organization, and access of files and folders. Keeps track of file names, types, locations, and permissions. 4. Device Management Manages input and output devices like keyboard, mouse, printer, etc. Uses drivers to communicate between hardware and software. 5. Security and Access Control Protects the system from unauthorized access. Ensures only authorized users and programs can access certain data or resources. 6. User Interface Provides a way for users to interact with the system (like GUI or command line). Makes the system easy and friendly to use. 7. Job Scheduling Decides the order in which programs run. Helps in multitasking and gives CPU time to each process efficiently. 8. Error Detection and Handling Monitors the system for errors and takes action to fix or report them. Helps the system stay stable and reliable. 9. Network Management Network management refers to how the operating system controls, monitors, and manages network connections. It helps the computer communicate with other devices , share files, access the internet, and manage data flow across a network. Types of operating system: 1.Batch operating system
- Multiprogramming operating system
- Multitasking operating system
- Timesharing operating system
- Real-time operating system
- Multiprocessor operating system
- Distributed operating system
- Embedded operating system 1. Batch Operating System In this system, jobs are collected in batches and processed together without user interaction. It was used in early computers where tasks were executed one after another automatically. 2. Multiprogramming Operating System It allows multiple programs to stay in memory at the same time. The CPU switches between them to increase efficiency and reduce idle time. 3. Multitasking Operating System Allows the user to run more than one task at the same time (e.g., typing in Word while listening to music). It quickly switches between tasks, making it look like they run simultaneously. 4. Time-Sharing Operating System Gives each user a small slice of time to use the system. It allows multiple users to share the same computer at the same time. 5. Real-Time Operating System (RTOS) Designed to respond quickly to inputs or events without delay. Used in critical systems like medical devices, robots, or traffic control. 6. Multiprocessor Operating System Supports computers with multiple CPUs (processors) working together. Improves speed and performance by running tasks in parallel. 7. Distributed Operating System Controls a group of computers connected over a network. Looks like a single system to the user , even though it's using multiple machines. 8. Embedded Operating System Runs on small devices like washing machines, ATMs, or smart TVs. It is built into the hardware and performs specific tasks efficiently. How Operating System Manages to Run Applications: The operating system loads the application into memory , assigns it the needed resources (CPU time, memory, files, etc.), and manages its execution. It also handles switching between apps, so multiple programs can run smoothly at the same time. Example of How OS Runs an application: When you open MS Word , the operating system:
- Loads Word into memory (RAM)
- Gives it CPU time to run instructions
- Allows access to files , like opening or saving documents
- Displays output on the screen and takes your input (like typing)
Interrupt: An interrupt is a signal sent to the CPU from hardware or software, telling it to stop its current task and perform a different, more urgent task. It helps the operating system respond quickly to important events (like input from a keyboard or a hardware failure). Deadlock: A deadlock is a situation in computing where two or more processes get stuck because they are each waiting for resources that the other processes hold, causing a cycle of dependency. This means that none of the processes can proceed or finish. Computer system resources managed by an Operating System: The operating system (OS) manages various computer system resources to ensure smooth operation and multitasking. These resources include:
1. Processor (CPU) - The OS manages CPU time among multiple processes using scheduling algorithms. - It ensures efficient execution of processes and handles context switching between them. 2. Memory Management: Memory management is a key function of the operating system (OS) that handles or manages the computer’s main memory (RAM). It keeps track of each byte in memory, allocates memory to programs when needed, and deallocates it when no longer in use. 3. Storage Devices (Hard Drives, SSDs): - The OS handles reading/writing data from/to storage devices. - It organizes files into directories using a file system (e.g., FAT32, NTFS). 4. Input/Output (I/O) Devices - The OS controls and manages devices like keyboard, mouse, printer, and display. - It uses device drivers to communicate with hardware. The structure and organization of file management system: The structure and organization of a file management system helps store and manage files on a computer. It organizes files into folders and directories for easy access. It controls how files are created, saved, opened, and deleted. It also protects files with permission and access rules. File System Components: 1. Files – A file is a basic unit where data is stored, like documents, pictures, or videos. It holds information that a computer can read or write. 2. Directories/Folders – These are containers used to store and organize files. They help keep your computer data neat and easy to find. 3. File Metadata – Metadata gives details about a file like its name, size, and creation date. It's like a file's ID card, helping the system manage it. 4. Directory or Folder Structure is a tree-like system to organize files. It starts from a main folder (root) and branches into subfolders and files. Root/ ├── Documents/ │ ├── School/ │ │ └── Notes.docx │ └── Work/ │ └── Report.pdf ├── Pictures/ │ └── Family.jpg
5. Single-Level Directory / Folder: A single-level directory means all files are stored in one main folder. **There are no subfolders; every file is in the same place.
- Two-Level Directory:** Each user has their own folder under the main (root) directory. Files are stored inside each user’s personal folder. 7. Three-Level Directory: Each user folder can have subfolders (like Documents, Pictures, etc.). This adds another level for better file organization. File Allocation System: A file allocation system manages how and where files are stored on a disk. It keeps track of each file’s location to quickly access or update it. Purpose: Without it, the computer wouldn’t know where a file starts, ends, or if space is free or used. 1. Contiguous Allocation – File is stored in one continuous block. Fast access but wastes space. 2. Linked Allocation – File is stored in scattered blocks linked together. Saves space but slower access. 3. Indexed Allocation – An index stores all block addresses of the file. Fast and flexible but needs extra space. File System Types: FAT (File Allocation Table):
- Simple and old system used in many devices.
- Common in USB drives and older operating systems. NTFS (New Technology File System)
- Modern system used by Windows.
- Supports large files, security, and permissions. ext (Extended File System)
- Commonly used in Linux-based systems.
- Includes features like journaling and high performance. File operations: File Operation refers to the actions that can be performed on a file in a computer system, such as creating, reading, writing, or deleting.
- Create – Making a new file on the system.
- Open – Accessing a file to read or edit it.
- Read – Getting data from a file.
- Write – Adding or changing data in a file.
- Delete – Removing a file from the system.
- Rename – Changing the file’s name. Computer Software: This refers to a collection of programs and instructions that tell a computer how to perform tasks. It helps the computer carry out operations, like writing documents, browsing the internet, or running games. Computer software can be divided into two main categories:
- System Software – Helps the computer run and manage hardware.
- Application Software – Performs specific tasks for the user.
Microsoft Excel Spreadsheet Used for data analysis, calculations, and creating spreadsheets. Microsoft PowerPoint Presentation Software Used for creating presentations with text, images, and videos. Google Docs Word Processing (Cloud) Used for online document creation, editing, and collaboration. Google Sheets Spreadsheet (Cloud) Used for online spreadsheet creation, data analysis, and collaboration. Google Slides Presentation Software (Cloud) Used for online presentation creation and real-time collaboration. LibreOffice Writer Word Processing (Open-source) Open-source alternative to Word for creating documents. LibreOffice Calc Spreadsheet (Open-source) Open-source spreadsheet software for data handling and analysis. Trello Project Management Used for project management and task organization. Slack Communication Software Used for team communication and collaboration in real-time. Zoom Communication Software Used for video conferencing and virtual meetings. Evernote Note-taking Software Used for organizing notes and syncing them across devices. Application Patch: An application patch is a small update or fix released for a software program. It corrects bugs, improves security, or adds minor features without reinstalling the full software. Example: If a game has a bug causing crashes, the developer may release a patch to fix that issue. Let me know if you want a table or examples of types of patches! Key Functions of an Application Patch: Function Description Bug Fixing Fixes errors or problems in the software. Security Update Fixes vulnerabilities to protect against hackers or viruses. Performance Improvement Makes the software run faster or more smoothly. Feature Update Adds small new features or improves existing ones. Compatibility Fix Helps the software work better with new hardware or systems. Software Hosting: Software hosting means storing and running software on a server so that users can access it over the internet.
1. On-Premises Hosting On-premises hosting means the software or server is installed and run on computers within your own office or building. Pros:
- Full control over your data and servers.
- More customizable to your needs. Cons:
- High cost for hardware, maintenance, and IT staff.
- Harder to scale (increase size or power). 2. Shared Hosting Definition: In shared hosting, many websites or software share the same server and its resources (like CPU, RAM, etc.). Pros:
- Very cheap.
- Easy to use for beginners. Cons:
- Slower performance due to sharing.
- Less secure because of other users on the same server. 3. Dedicated Hosting In dedicated hosting, you get the whole server for your website or software. Pros:
- Fast performance.
- More secure.
- Full control over server settings. Cons:
- Expensive.
- Requires technical knowledge or hiring IT experts. 4. Cloud Hosting Cloud hosting uses multiple servers on the internet to store and run software. It allows you to scale resources easily. Pros:
- Scalable: You can increase or decrease resources as needed.
- Reliable: If one server fails, another can take over.
- Pay-as-you-go pricing. Cons:
- Monthly costs can add up if not managed.
- Requires good internet connection. Here’s a simple explanation for each term: Programming Software Programming software is a type of software that helps people (usually programmers) to write, test, and fix computer programs. Example: Python, C++, and Java all need programming software to write and run programs. Components of Programming Software:
Project Management in IDE: Project management in an IDE (Integrated Development Environment) means organizing and managing your programming work (like files, folders, code, and tasks) within the IDE to build a complete software project. "Hello World!" Project in VS Code: Step 1: Open VS Code
- Launch Visual Studio Code. Step 2: Create a New Folder
- Go to File > Open Folder.
- Create a new folder and name it: HelloWorldWeb. Step 3: Create Project Files Inside the folder, create these three files:
- index.html
- style.css
- script.js Step 4: Write Code in Each File index.html
Hello World Project
Hello, World! Click Me
style.css script.js Output: You’ll see:
- A green "Hello, World!" message.
- A button. When you click it, the message changes to: "You clicked the button!" body { text-align: center; margin-top: 100px; font-family: Arial, sans-serif; background-color: #f0f8ff;} h1 { color: green; } button { padding: 10px 20px; font-size: 16px; } function changeText() { document.getElementById("greeting").innerText = "You clicked the button!"; }