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

PPTX
Introduction to digital computers and Number systems.pptx
PDF
number system understand
PDF
PPT
microprocessor
PDF
computer programmingUnit1pdf__2024_09_06_12_26_20.pdf
DOCX
Interview
PPT
intro.ppt
PPT
Kaizen cso002 l1
Introduction to digital computers and Number systems.pptx
number system understand
microprocessor
computer programmingUnit1pdf__2024_09_06_12_26_20.pdf
Interview
intro.ppt
Kaizen cso002 l1

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

PPT
intro.ppt
PPTX
6_2018_11_23!09_24_56_PM (1).pptx
PPTX
Part#1_Logic_Design.pptx LOGIC Circuit Course
PDF
Computer Programming_Unit 1
PPT
10 instruction sets characteristics
PPT
10 instruction sets characteristics
PPTX
Introduction to computers
PPTX
Principles of operating system
PPT
PDF
COA Unit-1.pdf
PPT
1-Introduction madul include all the.ppt
PPT
1-Introduction to the first OS topic for
PDF
Operating system module
PPTX
Computer System Architecture
PPTX
ICT FIRST LECTURE.pptx
PDF
6_2020_12_23!08_00_40_AM.pdf
PPTX
Fundamentals of Information and communication technology.pptx
PPTX
Chapter 1 - Operating Systems Introduction.pptx
PPT
IT109 Microsoft Windows 7 Operating Systems Unit 01
PPT
Introduction To operating System:
intro.ppt
6_2018_11_23!09_24_56_PM (1).pptx
Part#1_Logic_Design.pptx LOGIC Circuit Course
Computer Programming_Unit 1
10 instruction sets characteristics
10 instruction sets characteristics
Introduction to computers
Principles of operating system
COA Unit-1.pdf
1-Introduction madul include all the.ppt
1-Introduction to the first OS topic for
Operating system module
Computer System Architecture
ICT FIRST LECTURE.pptx
6_2020_12_23!08_00_40_AM.pdf
Fundamentals of Information and communication technology.pptx
Chapter 1 - Operating Systems Introduction.pptx
IT109 Microsoft Windows 7 Operating Systems Unit 01
Introduction To operating System:
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)

PDF
Approach and Philosophy of On baking technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Spectroscopy.pptx food analysis technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
KodekX | Application Modernization Development
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Approach and Philosophy of On baking technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
The Rise and Fall of 3GPP – Time for a Sabbatical?
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Machine learning based COVID-19 study performance prediction
Spectroscopy.pptx food analysis technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
“AI and Expert System Decision Support & Business Intelligence Systems”
KodekX | Application Modernization Development
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Weekly Chronicles - August'25 Week I
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
Encapsulation_ Review paper, used for researhc scholars
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation

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!