SlideShare a Scribd company logo
By Mohamed Gamal
Lecture 3: Deep Dive into
the Operating System
Operating System
– What’s DMA (Direct Memory Access)?
– What’re the different layers of a computer system?
– Mention three types of storage structure along with their
advantages.
– What’re the three basic logic gates found?
– What’s the difference between a file and a directory?
– What’re the following extensions used for?
o .exe, .png, .mp3, .mp4, .c, .jpg
Test your knowledge ?
– Find the one’s complement of the binary number 1001001
– Conversion:
• 5 Megabytes to Bytes.
• 12 Terabytes to Megabytes.
• 1024 Kilobytes to Gigabytes.
• 5 Bytes to bits.
Test your knowledge ?
The topics of today’s lecture:
Agenda
Introduction to Operating System - Lecture 3
– Simple Structure (MS-DOS)
– More Complex (UNIX – monolithic)
– Layered (Conceptual)
– Microkernel (Mach)
– Modular (modules)
OS Design Structure
Simple Structure – MS-DOS
-MS-DOS is written to provide the most
functionality in the least space
• Higher performance
• Smaller size
• Not divided into modules
• Interfaces and levels of functionality
are not well separated
• Very complex to maintain later
• Hardware dependent
More Complex Structure – UNIX
- Advantages:
• Higher performance
• Adds some protection
- Disadvantages:
• Very complex to maintain later
• Still Hardware dependent
Examples: Windows XP – Monolithic
More Complex Structure – UNIX (Cont.)
Layered Approach (Conceptual)
-The operating system is divided into a
number of layers (levels), each built on top
of lower layers.
-The bottom layer (layer 0), is the
hardware; the highest (layer N) is the
user interface.
-With modularity, layers are selected such
that each uses functions (operations) and
services of only lower-level layers
- Advantages:
• Modularity
• Debugging
• Modification
- Disadvantages:
• Layering overhead to the system call
Layered Approach (Cont.)
Microkernel System Structure
- Advantages:
• Easier to extend
• More reliable
• More secure
- Disadvantages:
• Performance overhead of user space to kernel space communication
✓ That’s why Windows XP designed almost as monolithic again!
Microkernel System Structure (Cont.)
- Many modern operating systems implement loadable kernel modules
• Uses object-oriented approach
• Each core component is separate
• Each talks to the others over known interfaces
• Each is loadable as needed within the kernel
- Similar to layers but with more flexibility (any module can call another module)
• Linux, Solaris … etc.
Modular System Structure
Modular System Structure (Cont.)
Solaris User Interface (GUI)
Modular System Structure (Cont.)
- Advantages:
• Resembles a layered system
• More flexibility
✓ any module can call any other module
• Similar to microkernel approach but more efficient
✓ modules do not need to invoke message passing to communicate
– Most modern operating systems are actually not one pure model
• Hybrid combines multiple approaches to address performance, security,
usability needs
• Linux and Solaris kernels:
✓ monolithic, plus modular
• Windows:
✓ monolithic, plus microkernel
Hybrid Systems
Introduction to Operating System - Lecture 3
Process Concept
- Program: a passive entity stored on disk (executable file – .exe).
- Process: a program in execution; process execution must progress in
sequential fashion.
- Program becomes a process when executable file loaded into memory.
- One program can be several processes.
Process in Memory
– Text section
• Program instructions
– Program counter
• Next instruction
– Stack
• Local variables
• Return addresses
• Method parameters
– Data section
• Global variables
Process State
Process State (Cont.)
– As a process executes, it changes state
• new: The process is being created
• running: Instructions are being executed (time slice)
• Waiting (suspended): The process is waiting for some event to occur
• ready: The process is waiting to be assigned to a processor
• terminated: The process has finished execution
Process Control Block (PCB)
– Information associated with each process:
• Process state (running, waiting/suspended, … etc.)
• Program counter (location of next instruction to execute)
• CPU registers
• CPU scheduling information
• Memory-management information
• Accounting information (CPU used, clock time elapsed since start, time limits)
• I/O status information
Process Control Block (PCB)
Pointer Process state
Process number
Program counter
CPU registers
Memory management info
I/O status information
Accounting Information
Context Switching
– When CPU switches to another process, the system must save the state
of the old process and load the saved state for the new process via a
context switch.
– Context Switching is for Multitasking.
– Context-switch time is overhead; the system does no useful work while
switching.
– The more complex the OS and the PCB, the longer the context switch
– Time dependent on hardware support
Context Switching (Cont.)
Process Example
Google Chrome Browser
Question: why did they do this?
Introduction to Operating System - Lecture 3
Threads Concept
- Most modern applications are multithreaded.
- Multiple tasks with the application can be implemented by separate
threads.
- Process creation is heavy-weight.
- Thread creation is light-weight.
• Only Program Counter is needed
- Threads simplify code and increase efficiency
+ PCB
Single and Multithreaded Processes
Benefits of using threads
- Responsiveness – may allow continued execution if part of process is blocked
• especially important for user interfaces
- Resource Sharing – threads share resources of process
• easier than shared memory or message passing
- Economy – cheaper than process creation
• thread switching lower overhead than context switching
- Scalability – process can take advantage of multiprocessor architectures
Concurrency vs. Parallelism
- Concurrent execution on single-core system:
- Parallelism on a multi-core system:
Introduction to Operating System - Lecture 3
Is this Deadlock?
- A set of blocked processes each holding a resource and waiting to acquire a
resource held by another process in the set.
- Example
• System has 2 tape drives.
• P1 and P2 each hold one tape drive and each needs another one.
P1 P2
wait (A); wait(B)
wait (B); wait(A)
The Deadlock Problem
One-lane Crossing Example
- Traffic only in one direction.
- Each section of a bridge can be viewed as a resource.
- If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback).
- Several cars may have to be backed up if a deadlock occurs.
- Starvation is possible!
- Ensure that the system will never enter a deadlock state.
- Allow the system to enter a deadlock state and then recover.
- Ignore the problem and pretend that deadlocks never occur in
the system
• used by most operating systems, including UNIX
• lets the user handle it
• Deadlock prevention is not completely guaranteed and is incredibly
hard!
Methods for Handling Deadlocks
Introduction to Operating System - Lecture 3
- Combination of bits are used to represent:
• alphabetic data
• numeric data
• Symbols
• sound and video data
- Binary Coding schemes are used for this purpose
• EBCDIC (Extended Binary Coded Decimal Interchange Code)
• ASCII (American Standard Code for Information Interchange)
• Unicode (UTF-8)
Binary Coding Schemes
Introduction to Operating System - Lecture 3
Introduction to Operating System - Lecture 3
- Binary System
- Octal System
- Decimal System
- Hexadecimal System
› Computers use binary system
› Decimal system is used in general
› Octal and Hexadecimal systems are also used in computer systems
Numbering System
Numbering
System
Base Range
Binary Base 2 0 – 1
Octal Base 8 0 – 7
Decimal Base 10 0 – 9
Hexadecimal Base 16 0 – 9, A – F
Decimal Binary Octal Hexadecimal
0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1101 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F
- 12510
› 5 x 100 = 5
› 2 x 101 = 20
› 1 x 102 = 100
12510
Decimal Numbering System (Base 10)
+
+
- Technique:
• Multiply each bit by 2n, where n is the weight of the bit
• Add the results
– Convert the binary number 110012 to decimal
› 24 23 22 21 20
› 1 1 0 0 1
› 16 8 0 0 1 +
› 16 + 8 + 0 + 0 + 1 = 25
Binary to Decimal (Base 2)
×
Result: 2510
- Technique:
• Divide the number repeatedly by 2, while keeping track of the remainders.
• Arrange the remainders in reverse order.
– Convert the decimal number 2510 to binary
Decimal to Binary (Base 10)
Number Remainder
÷ 2 25 1
÷ 2 12 0
÷ 2 6 0
÷ 2 3 1
÷ 2 1 1
÷ 2 0 —
Result:
110012
- Technique:
• Group the binary digits into sets of four.
• Convert each group to its corresponding hexadecimal digit.
– Convert the binary number 110110112 to hexadecimal
› 23 22 21 20 23 22 21 20
› 1 1 0 1 1 0 1 1
› 8+4+0+1 8+0+2+1
› D B
Binary to Hexadecimal (Base 2)
A: 10 D: 13
B: 11 E: 14
C: 12 F: 15
Result: DB16
- Technique:
• Convert each hexadecimal digit to its binary representation.
• Similar to binary to hexadecimal but in a reversed way.
– Convert the hexadecimal number DB16 to binary
› D B
› 23 22 21 20 23 22 21 20
› 8 + 4 + 0 + 1 8 + 0 + 2 + 1
› 1 1 0 1 1 0 1 1
Hexadecimal to Binary (Base 16)
B: 11 , D: 13
Result:
110110112
- Technique:
• Sum of the positional values of each hexadecimal digit.
– Convert the hexadecimal number DB16 to decimal
› D B
› 13 x 161 + 11 x 160
› 208 + 11
Hexadecimal to Decimal (Base 16)
B: 11 , D: 13
Result: 21910
Note: another way is to first convert the hexadecimal number to
binary and then convert the binary number to decimal.
Decimal to Hexadecimal (Base 10)
- Technique:
• Divide the number repeatedly by 16, while keeping track of the remainders.
• Multiply the quotient by 16 to get the first result
• Divide the integer by 16 again …
• Arrange the remainders in reverse order.
– Convert the decimal number 21910 to hexadecimal
Number Remainder
÷ 16 219 0.6875 x 16 = 11 ( B )
÷ 16 13 0.8125 x 16 = 13 ( D )
÷ 16 0 —
Result:
DB16
Introduction to Operating System - Lecture 3
Binary Addition
0
0
0
1
0
1
0
1
1
1
1
10
+ + + +
1
1
1
1
11
+
1
1
1
10
+
10
1
11
+
1
Binary Addition (Cont.)
– Add the two binary numbers 10112 and 11012
1 1 1 1
– 1111
1 0 1 1
› 1 1 0 1
› 1 1 0 0 0
+
Result: 110002
Least Significant bit
(LSB)
Most Significant bit
(MSB)
Note: you can verify your
answer by converting to
decimal.
1110 1310
2410
Try yourself !
– Add the following binary numbers.
1) 1002 and 12
2) 111102 and 101012
3) 10010012 and 1101102
4) 1000002 and 111112
1
Binary Subtraction
0
0
0
1
0
1
0
1
1
1
1
0
– – – –
0 2
Binary Subtraction (Cont.)
– Subtract the two binary numbers 11012 and 10112
0 2
– 1111
› 1 1 0 1
› 1 0 1 1
› 0 0 1 0
–
Result: 00102
Note: you can verify your
answer by converting to
decimal.
Try yourself !
– Subtract the following binary numbers.
1) 1002 and 12
2) 111102 and 101012
3) 10010012 and 1101102
4) 1000002 and 111112
Binary Multiplication
– Multiply the two binary numbers 10112 and 11012
– 1111
› 0 1 1
› 1 0 1
› 0 1 1
› 0 0 0 0
› 0 1 1 0 0
› 0 1 1 1 1
×
Result: 011112
Note: you can verify your
answer by converting to
decimal.
Try yourself !
– multiply the following binary numbers.
1) 10112 and 1102
2) 100102 and 1012
3) 11102 and 102
4) 110012 and 112
Introduction to Operating System - Lecture 3
– Negative numbers are stored in two's complement notation.
– Represents the additive Inverse
• If you add the number to its additive inverse, the sum is zero.
Two’s Complement
Note that 00000001 + 11111111 = 00000000
– Add the two decimal numbers – 9 and 4.
Two’s Complement – Example
9 = 00001001 → Two’s Complement: 11110111
4 = 00000100
11110111
00000100
+
11111001
1 Represents a
negative number
Most Significant
bit (MSB)
1 -128 64 32 16 8 4 2 1
1 1 1 1 1 0 1 1
-128 + 64 + 32 + 16 + 8 + 0 + 2 + 1 = -5
– CMD
– OS
– OS Types (VM)
– Storage Structure
– Caching concept
– Difference between files and directories
– Viruses types
– API Concept
– Logic Gates
– Fetch-decode Cycle
– Multiprocessor/Multicores vs. Multiprogramming
– Grid and its derivatives
– Real-time systems
– LAN vs. WAN
Revision
End of lecture 3
ThankYou!

More Related Content

PDF
Mike Bartley - Innovations for Testing Parallel Software - EuroSTAR 2012
PPTX
Unit-1_Digital Computers, number systemCOA[1].pptx
PPT
Top schools in gudgao
PPT
Top schools in gudgao
PPT
Top schools in noida
PPTX
CSC718 Operating Systems and Parallel Programming
PPTX
The Power of Determinism in Database Systems
PPTX
Exascale Capabl
Mike Bartley - Innovations for Testing Parallel Software - EuroSTAR 2012
Unit-1_Digital Computers, number systemCOA[1].pptx
Top schools in gudgao
Top schools in gudgao
Top schools in noida
CSC718 Operating Systems and Parallel Programming
The Power of Determinism in Database Systems
Exascale Capabl

Similar to Introduction to Operating System - Lecture 3 (20)

PPT
Pdc lecture1
PPTX
CSA unit5.pptx
PPT
RISC.ppt
PPT
13 risc
PPTX
CSC204PPTNOTES
PDF
High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...
DOCX
Bcc201
PDF
Designs, Lessons and Advice from Building Large Distributed Systems
PPT
intro.ppt
PDF
Software Engineering Advice from Google's Jeff Dean for Big, Distributed Systems
PDF
engage 2019 - 15 Domino v10 Admin features we LOVE
PPTX
1. An Introduction to Embed Systems_DRKG.pptx
PPT
Principle of Computer Operation.ppt
PPTX
Programmable Exascale Supercomputer
PPT
Computer organization and architecture -
PPTX
Topic02-Architecture.pptx
PDF
10 replication
PDF
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
PDF
lecture04_Overview of a Cloud architecture.pdf
PDF
High Performance Computer Architecture
Pdc lecture1
CSA unit5.pptx
RISC.ppt
13 risc
CSC204PPTNOTES
High Performance & High Throughput Computing - EUDAT Summer School (Giuseppe ...
Bcc201
Designs, Lessons and Advice from Building Large Distributed Systems
intro.ppt
Software Engineering Advice from Google's Jeff Dean for Big, Distributed Systems
engage 2019 - 15 Domino v10 Admin features we LOVE
1. An Introduction to Embed Systems_DRKG.pptx
Principle of Computer Operation.ppt
Programmable Exascale Supercomputer
Computer organization and architecture -
Topic02-Architecture.pptx
10 replication
A Reimplementation of NetBSD Based on a Microkernel by Andrew S. Tanenbaum
lecture04_Overview of a Cloud architecture.pdf
High Performance Computer Architecture
Ad

More from Faculty of Computers and Informatics, Suez Canal University, Ismailia, Egypt (20)

PDF
PDF
PDF
PDF
Understanding Convolutional Neural Networks (CNN)
PDF
PDF
Complier Design - Operations on Languages, RE, Finite Automata
PDF
Object Oriented Programming (OOP) using C++ - Lecture 5
PDF
Object Oriented Programming (OOP) using C++ - Lecture 2
PDF
Object Oriented Programming (OOP) using C++ - Lecture 1
PDF
Object Oriented Programming (OOP) using C++ - Lecture 3
PDF
Object Oriented Programming (OOP) using C++ - Lecture 4
Understanding Convolutional Neural Networks (CNN)
Complier Design - Operations on Languages, RE, Finite Automata
Object Oriented Programming (OOP) using C++ - Lecture 5
Object Oriented Programming (OOP) using C++ - Lecture 2
Object Oriented Programming (OOP) using C++ - Lecture 1
Object Oriented Programming (OOP) using C++ - Lecture 3
Object Oriented Programming (OOP) using C++ - Lecture 4
Ad

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Getting Started with Data Integration: FME Form 101
PPTX
1. Introduction to Computer Programming.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPT
Teaching material agriculture food technology
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Electronic commerce courselecture one. Pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectroscopy.pptx food analysis technology
A comparative analysis of optical character recognition models for extracting...
Assigned Numbers - 2025 - Bluetooth® Document
Getting Started with Data Integration: FME Form 101
1. Introduction to Computer Programming.pptx
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Approach and Philosophy of On baking technology
Programs and apps: productivity, graphics, security and other tools
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Teaching material agriculture food technology
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Unlocking AI with Model Context Protocol (MCP)
Electronic commerce courselecture one. Pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm

Introduction to Operating System - Lecture 3

  • 1. By Mohamed Gamal Lecture 3: Deep Dive into the Operating System Operating System
  • 2. – What’s DMA (Direct Memory Access)? – What’re the different layers of a computer system? – Mention three types of storage structure along with their advantages. – What’re the three basic logic gates found? – What’s the difference between a file and a directory? – What’re the following extensions used for? o .exe, .png, .mp3, .mp4, .c, .jpg Test your knowledge ?
  • 3. – Find the one’s complement of the binary number 1001001 – Conversion: • 5 Megabytes to Bytes. • 12 Terabytes to Megabytes. • 1024 Kilobytes to Gigabytes. • 5 Bytes to bits. Test your knowledge ?
  • 4. The topics of today’s lecture: Agenda
  • 6. – Simple Structure (MS-DOS) – More Complex (UNIX – monolithic) – Layered (Conceptual) – Microkernel (Mach) – Modular (modules) OS Design Structure
  • 7. Simple Structure – MS-DOS -MS-DOS is written to provide the most functionality in the least space • Higher performance • Smaller size • Not divided into modules • Interfaces and levels of functionality are not well separated • Very complex to maintain later • Hardware dependent
  • 9. - Advantages: • Higher performance • Adds some protection - Disadvantages: • Very complex to maintain later • Still Hardware dependent Examples: Windows XP – Monolithic More Complex Structure – UNIX (Cont.)
  • 10. Layered Approach (Conceptual) -The operating system is divided into a number of layers (levels), each built on top of lower layers. -The bottom layer (layer 0), is the hardware; the highest (layer N) is the user interface. -With modularity, layers are selected such that each uses functions (operations) and services of only lower-level layers
  • 11. - Advantages: • Modularity • Debugging • Modification - Disadvantages: • Layering overhead to the system call Layered Approach (Cont.)
  • 13. - Advantages: • Easier to extend • More reliable • More secure - Disadvantages: • Performance overhead of user space to kernel space communication ✓ That’s why Windows XP designed almost as monolithic again! Microkernel System Structure (Cont.)
  • 14. - Many modern operating systems implement loadable kernel modules • Uses object-oriented approach • Each core component is separate • Each talks to the others over known interfaces • Each is loadable as needed within the kernel - Similar to layers but with more flexibility (any module can call another module) • Linux, Solaris … etc. Modular System Structure
  • 17. Modular System Structure (Cont.) - Advantages: • Resembles a layered system • More flexibility ✓ any module can call any other module • Similar to microkernel approach but more efficient ✓ modules do not need to invoke message passing to communicate
  • 18. – Most modern operating systems are actually not one pure model • Hybrid combines multiple approaches to address performance, security, usability needs • Linux and Solaris kernels: ✓ monolithic, plus modular • Windows: ✓ monolithic, plus microkernel Hybrid Systems
  • 20. Process Concept - Program: a passive entity stored on disk (executable file – .exe). - Process: a program in execution; process execution must progress in sequential fashion. - Program becomes a process when executable file loaded into memory. - One program can be several processes.
  • 21. Process in Memory – Text section • Program instructions – Program counter • Next instruction – Stack • Local variables • Return addresses • Method parameters – Data section • Global variables
  • 23. Process State (Cont.) – As a process executes, it changes state • new: The process is being created • running: Instructions are being executed (time slice) • Waiting (suspended): The process is waiting for some event to occur • ready: The process is waiting to be assigned to a processor • terminated: The process has finished execution
  • 24. Process Control Block (PCB) – Information associated with each process: • Process state (running, waiting/suspended, … etc.) • Program counter (location of next instruction to execute) • CPU registers • CPU scheduling information • Memory-management information • Accounting information (CPU used, clock time elapsed since start, time limits) • I/O status information
  • 25. Process Control Block (PCB) Pointer Process state Process number Program counter CPU registers Memory management info I/O status information Accounting Information
  • 26. Context Switching – When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process via a context switch. – Context Switching is for Multitasking. – Context-switch time is overhead; the system does no useful work while switching. – The more complex the OS and the PCB, the longer the context switch – Time dependent on hardware support
  • 28. Process Example Google Chrome Browser Question: why did they do this?
  • 30. Threads Concept - Most modern applications are multithreaded. - Multiple tasks with the application can be implemented by separate threads. - Process creation is heavy-weight. - Thread creation is light-weight. • Only Program Counter is needed - Threads simplify code and increase efficiency + PCB
  • 32. Benefits of using threads - Responsiveness – may allow continued execution if part of process is blocked • especially important for user interfaces - Resource Sharing – threads share resources of process • easier than shared memory or message passing - Economy – cheaper than process creation • thread switching lower overhead than context switching - Scalability – process can take advantage of multiprocessor architectures
  • 33. Concurrency vs. Parallelism - Concurrent execution on single-core system: - Parallelism on a multi-core system:
  • 36. - A set of blocked processes each holding a resource and waiting to acquire a resource held by another process in the set. - Example • System has 2 tape drives. • P1 and P2 each hold one tape drive and each needs another one. P1 P2 wait (A); wait(B) wait (B); wait(A) The Deadlock Problem
  • 37. One-lane Crossing Example - Traffic only in one direction. - Each section of a bridge can be viewed as a resource. - If a deadlock occurs, it can be resolved if one car backs up (preempt resources and rollback). - Several cars may have to be backed up if a deadlock occurs. - Starvation is possible!
  • 38. - Ensure that the system will never enter a deadlock state. - Allow the system to enter a deadlock state and then recover. - Ignore the problem and pretend that deadlocks never occur in the system • used by most operating systems, including UNIX • lets the user handle it • Deadlock prevention is not completely guaranteed and is incredibly hard! Methods for Handling Deadlocks
  • 40. - Combination of bits are used to represent: • alphabetic data • numeric data • Symbols • sound and video data - Binary Coding schemes are used for this purpose • EBCDIC (Extended Binary Coded Decimal Interchange Code) • ASCII (American Standard Code for Information Interchange) • Unicode (UTF-8) Binary Coding Schemes
  • 43. - Binary System - Octal System - Decimal System - Hexadecimal System › Computers use binary system › Decimal system is used in general › Octal and Hexadecimal systems are also used in computer systems Numbering System Numbering System Base Range Binary Base 2 0 – 1 Octal Base 8 0 – 7 Decimal Base 10 0 – 9 Hexadecimal Base 16 0 – 9, A – F
  • 44. Decimal Binary Octal Hexadecimal 0 0000 0 0 1 0001 1 1 2 0010 2 2 3 0011 3 3 4 0100 4 4 5 0101 5 5 6 0110 6 6 7 0111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1101 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F
  • 45. - 12510 › 5 x 100 = 5 › 2 x 101 = 20 › 1 x 102 = 100 12510 Decimal Numbering System (Base 10) + +
  • 46. - Technique: • Multiply each bit by 2n, where n is the weight of the bit • Add the results – Convert the binary number 110012 to decimal › 24 23 22 21 20 › 1 1 0 0 1 › 16 8 0 0 1 + › 16 + 8 + 0 + 0 + 1 = 25 Binary to Decimal (Base 2) × Result: 2510
  • 47. - Technique: • Divide the number repeatedly by 2, while keeping track of the remainders. • Arrange the remainders in reverse order. – Convert the decimal number 2510 to binary Decimal to Binary (Base 10) Number Remainder ÷ 2 25 1 ÷ 2 12 0 ÷ 2 6 0 ÷ 2 3 1 ÷ 2 1 1 ÷ 2 0 — Result: 110012
  • 48. - Technique: • Group the binary digits into sets of four. • Convert each group to its corresponding hexadecimal digit. – Convert the binary number 110110112 to hexadecimal › 23 22 21 20 23 22 21 20 › 1 1 0 1 1 0 1 1 › 8+4+0+1 8+0+2+1 › D B Binary to Hexadecimal (Base 2) A: 10 D: 13 B: 11 E: 14 C: 12 F: 15 Result: DB16
  • 49. - Technique: • Convert each hexadecimal digit to its binary representation. • Similar to binary to hexadecimal but in a reversed way. – Convert the hexadecimal number DB16 to binary › D B › 23 22 21 20 23 22 21 20 › 8 + 4 + 0 + 1 8 + 0 + 2 + 1 › 1 1 0 1 1 0 1 1 Hexadecimal to Binary (Base 16) B: 11 , D: 13 Result: 110110112
  • 50. - Technique: • Sum of the positional values of each hexadecimal digit. – Convert the hexadecimal number DB16 to decimal › D B › 13 x 161 + 11 x 160 › 208 + 11 Hexadecimal to Decimal (Base 16) B: 11 , D: 13 Result: 21910 Note: another way is to first convert the hexadecimal number to binary and then convert the binary number to decimal.
  • 51. Decimal to Hexadecimal (Base 10) - Technique: • Divide the number repeatedly by 16, while keeping track of the remainders. • Multiply the quotient by 16 to get the first result • Divide the integer by 16 again … • Arrange the remainders in reverse order. – Convert the decimal number 21910 to hexadecimal Number Remainder ÷ 16 219 0.6875 x 16 = 11 ( B ) ÷ 16 13 0.8125 x 16 = 13 ( D ) ÷ 16 0 — Result: DB16
  • 53. Binary Addition 0 0 0 1 0 1 0 1 1 1 1 10 + + + + 1 1 1 1 11 + 1 1 1 10 + 10 1 11 + 1
  • 54. Binary Addition (Cont.) – Add the two binary numbers 10112 and 11012 1 1 1 1 – 1111 1 0 1 1 › 1 1 0 1 › 1 1 0 0 0 + Result: 110002 Least Significant bit (LSB) Most Significant bit (MSB) Note: you can verify your answer by converting to decimal. 1110 1310 2410
  • 55. Try yourself ! – Add the following binary numbers. 1) 1002 and 12 2) 111102 and 101012 3) 10010012 and 1101102 4) 1000002 and 111112
  • 57. Binary Subtraction (Cont.) – Subtract the two binary numbers 11012 and 10112 0 2 – 1111 › 1 1 0 1 › 1 0 1 1 › 0 0 1 0 – Result: 00102 Note: you can verify your answer by converting to decimal.
  • 58. Try yourself ! – Subtract the following binary numbers. 1) 1002 and 12 2) 111102 and 101012 3) 10010012 and 1101102 4) 1000002 and 111112
  • 59. Binary Multiplication – Multiply the two binary numbers 10112 and 11012 – 1111 › 0 1 1 › 1 0 1 › 0 1 1 › 0 0 0 0 › 0 1 1 0 0 › 0 1 1 1 1 × Result: 011112 Note: you can verify your answer by converting to decimal.
  • 60. Try yourself ! – multiply the following binary numbers. 1) 10112 and 1102 2) 100102 and 1012 3) 11102 and 102 4) 110012 and 112
  • 62. – Negative numbers are stored in two's complement notation. – Represents the additive Inverse • If you add the number to its additive inverse, the sum is zero. Two’s Complement Note that 00000001 + 11111111 = 00000000
  • 63. – Add the two decimal numbers – 9 and 4. Two’s Complement – Example 9 = 00001001 → Two’s Complement: 11110111 4 = 00000100 11110111 00000100 + 11111001 1 Represents a negative number Most Significant bit (MSB) 1 -128 64 32 16 8 4 2 1 1 1 1 1 1 0 1 1 -128 + 64 + 32 + 16 + 8 + 0 + 2 + 1 = -5
  • 64. – CMD – OS – OS Types (VM) – Storage Structure – Caching concept – Difference between files and directories – Viruses types – API Concept – Logic Gates – Fetch-decode Cycle – Multiprocessor/Multicores vs. Multiprogramming – Grid and its derivatives – Real-time systems – LAN vs. WAN Revision
  • 65. End of lecture 3 ThankYou!