SlideShare a Scribd company logo
1 of 68
Operating Systems - A Primer
Introduction
# who am i Saumil Shah CEO Net-square. Hacker, Speaker, Trainer, Author. M.S. Computer Science Purdue University. Google: "saumil" LinkedIn: saumilshah
Preview
CPU and Registers
The CPU We shall discuss the Intel x86 32-bit CPU.
The CPU We shall discuss the Intel x86 32-bit CPU. The CPU has REGISTERS.
The CPU We shall discuss the Intel x86 32-bit CPU. The CPU has REGISTERS. "Variables" on the CPU, hard-wired. Size is equal to the "machine word". (32 bits)
What do Registers do?
What do Registers do? Registers hold data.
What do Registers do? Registers hold data. They may be numbers... ...or memory addresses (pointers)
What do Registers do? Registers hold data. They may be numbers... ...or memory addresses (pointers) Using registers, the CPU can perform computations, read and write memory, and execute instructions.
x86 Registers - the basics EAX ESI EBX EDI ECX ESP EDX EBP EIP EFLAGS there are more, but this is good enough for now.
x86 Registers - General Purpose EAX Accumulator EBX Base ECX Count EDX Data
x86 Registers - General Purpose EAX Accumulator EBX Base ECX Count EDX Data Used for Integer operations (arithmetic), returning values (EAX), loops (ECX), or anything the compiler wishes to use them for.
x86 Registers - Pointers ESI Source Index EDI Destination Index
x86 Registers - Pointers ESI Source Index EDI Destination Index These are POINTERS, used for block copy operations. ESI = address of source, EDI = address of destination, ECX = count of bytes/words to be copied.
x86 Registers - Stack Related Stack Pointer ESP Frame Pointer (Base Pointer) EBP
x86 Registers - Stack Related Stack Pointer points to the top of the process stack. Stack Pointer ESP Frame Pointer (Base Pointer) EBP
x86 Registers - Stack Related Stack Pointer points to the top of the process stack. Stack Pointer ESP Frame Pointer (Base Pointer) EBP Frame pointer points to FRAMES within the stack. Frames store data for functions.
x86 Registers - EIP EIP Instruction Pointer (program counter)
x86 Registers - EIP A very important register. Points to a memory address from where the CPU fetches and executes the next instruction. EIP autoincrements after every instruction. EIP Instruction Pointer (program counter)
x86 Registers - Flags EFLAGS Bit Flags
x86 Registers - Flags Individual bits indicate status of operations. Boolean values. Never treated as a full register, just individual bit flags. EFLAGS Bit Flags
Operating System Basics
The Operating System Modern Operating Systems are very complex and do many things. We shall discuss only the basic concepts and functions of an OS.
The Operating System Modern Operating Systems are very complex and do many things. We shall discuss only the basic concepts and functions of an OS. Multitasking and Multiprogramming Processes The Virtual Machine
What is Multiprogramming?
What is Multiprogramming? The ability to store and execute multiple programs in the memory
What is Multiprogramming? The ability to store and execute multiple programs in the memory ...and what is Multitasking?
What is Multiprogramming? The ability to store and execute multiple programs in the memory ...and what is Multitasking? Running multiple PROCESSES at the SAME TIME.
So what is a "Process"?
So what is a "Process"? A PROCESS is termed as a program that is EXECUTING. A running program.
So what is a "Process"? A PROCESS is termed as a program that is EXECUTING. A running program. A process is an instance of a program. Processes "live" in memory. Programs live on disk. (secondary storage) A program may have multiple processes of its own self.
How do multiple processes run simultaneously?
How do multiple processes run simultaneously? By TIME SLICING and CONTEXT-SWITCHING
How do multiple processes run simultaneously? By TIME SLICING and CONTEXT-SWITCHING Each process runs for a short time and is then PRE-EMPTED to let another process run. This happens so fast, it appears as if all processes are running simultaneously. This is called MULTITASKING
Processes and Multitasking
Multitasking Process Queue P2 P3 P4 P1 CPU Process P1 is running. It shall continue to run for a small period of time, called a QUANTUM.
Multitasking P2 P3 P4 P1 Time Slice Interrupt CPU An INTERRUPT is triggered at the end of the quantum. A snapshot of P1's registers (P1's CONTEXT) is saved.
Multitasking P2 P3 P4 P1 CPU P1 is then PRE-EMPTED. It is brought back into the process queue.
Multitasking P2 P3 P4 P1 CPU It is P2's turn now. P2's context is loaded into the CPU's registers. This is called CONTEXT SWITCHING.
Multitasking P1 P3 P4 P2 CPU P2 is scheduled to execute on the CPU.
Multitasking P1 P3 P4 P2 CPU P2 runs for the next quantum.
Multitasking P1 P3 P4 P2 Time Slice Interrupt CPU P2's context is now saved.
Multitasking P1 P3 P4 P2 CPU P2 is PRE-EMPTED. It is brought back into the process queue. Next it will be P3's turn, and so on.
Virtual Machines and Process Memory Maps
What is a Virtual Machine?
What is a Virtual Machine? A view of ABSTRACTED HARDWARE as presented to a PROCESS by the OS.
What is a Virtual Machine? A view of ABSTRACTED HARDWARE as presented to a PROCESS by the OS. A process sees its OWN view of the CPU, Memory, Storage, and other devices. Every process runs in its own "virtual" machine. This is how the OS ensures process memory and resource segregation.
Do processes have their OWN view of the memory? Yes. Processes see "Virtual Memory"
Do processes have their OWN view of the memory? Yes. Processes see "Virtual Memory" Physical memory is divided into PAGES. A process is assigned pages as needed. This is done by the Memory Management Unit (MMU) From the process' point of view, it seems to have all the memory to itself.
Pages from P1's memory are mapped from physical memory. P1 sees a "virtual address space". Physical Memory P1's memory Physical and Virtual Memory
Physical and Virtual Memory Similarly for P2. Physical Memory P1's memory P2's memory
Can one process access another's memory? No. A process can only access its own virtual memory space.
Can one process access another's memory? No. A process can only access its own virtual memory space. A process CANNOT access physical memory.
The Process' view of memory Process Memory has its own VIRTUAL ADDRESS SPACE. Typically 2 to 3 GB. Binary Heap It is called a PROCESS MEMORY MAP. Lib 3GB (Linux) 2GB (Win32) Lib Lower addresses represented at the top of the map. Higher addresses at the bottom. Lib Stack Process' Virtual Memory
Linux Process Memory Map 0x08000000 Binary Heap Lib 3GB Lib Lib Stack 0xbfffffff Linux Process Memory Map
An example Here's how to view a process' memory map in Linux. The process here is PID 1110. saumil@localhost:$ pmap 1110 1110:   /home/nweb/nweb 8181 /home/nweb  08048000      8K read/exec         /home/nweb/nweb 0804a000      4K read/write        /home/nweb/nweb 0804b000      8K read/write/exec     [ anon ] 40000000     72K read/exec         /lib/ld-2.3.1.so 40012000      4K read/write        /lib/ld-2.3.1.so 40013000      4K read/write          [ anon ] 40019000   1204K read/exec         /lib/i686/libc-2.3.1.so 40146000     16K read/write        /lib/i686/libc-2.3.1.so 4014a000      8K read/write          [ anon ] bfffe000      8K read/write/exec     [ anon ]  total     1336K
The Big Picture
CPU NIC Storage Physical Memory
File System Network Stack Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
kernel space System Calls File System Network Stack Loader Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
user space Virtual Memory PROCESS Virtual Memory PROCESS Virtual Memory PROCESS CPU FS N/W CPU FS N/W CPU FS N/W kernel space System Calls File System Network Stack Loader Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
user space Virtual Memory PROCESS Virtual Memory PROCESS Virtual Memory PROCESS CPU FS N/W CPU FS N/W CPU FS N/W kernel space System Calls File System Network Stack Loader Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
Key Concepts
Review
END

More Related Content

What's hot

Beneath the Linux Interrupt handling
Beneath the Linux Interrupt handlingBeneath the Linux Interrupt handling
Beneath the Linux Interrupt handlingBhoomil Chavda
 
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and EntitlementsRuxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and EntitlementsStefan Esser
 
DWARF Data Representation
DWARF Data RepresentationDWARF Data Representation
DWARF Data RepresentationWang Hsiangkai
 
Interrupt of 8085
Interrupt of 8085Interrupt of 8085
Interrupt of 8085Nitin Ahire
 
Linux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend ProgramingLinux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend ProgramingAngel Boy
 
Startup Snapshot in Node.js
Startup Snapshot in Node.jsStartup Snapshot in Node.js
Startup Snapshot in Node.jsIgalia
 
[DEFCON 16] Bypassing pre-boot authentication passwords by instrumenting the...
[DEFCON 16] Bypassing pre-boot authentication passwords  by instrumenting the...[DEFCON 16] Bypassing pre-boot authentication passwords  by instrumenting the...
[DEFCON 16] Bypassing pre-boot authentication passwords by instrumenting the...Moabi.com
 
1D Array in Assembly Language
1D Array in Assembly Language1D Array in Assembly Language
1D Array in Assembly LanguageJaveria Yaqoob
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorDarling Jemima
 
JCL UTILITIES IEBCOPY
JCL UTILITIES IEBCOPYJCL UTILITIES IEBCOPY
JCL UTILITIES IEBCOPYjanaki ram
 
Play with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit TechniquePlay with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit TechniqueAngel Boy
 
Sigreturn Oriented Programming
Sigreturn Oriented ProgrammingSigreturn Oriented Programming
Sigreturn Oriented ProgrammingAngel Boy
 
An introduction to ROP
An introduction to ROPAn introduction to ROP
An introduction to ROPSaumil Shah
 
Reliable Windows Heap Exploits
Reliable Windows Heap ExploitsReliable Windows Heap Exploits
Reliable Windows Heap Exploitsamiable_indian
 

What's hot (20)

Beneath the Linux Interrupt handling
Beneath the Linux Interrupt handlingBeneath the Linux Interrupt handling
Beneath the Linux Interrupt handling
 
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and EntitlementsRuxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
 
DWARF Data Representation
DWARF Data RepresentationDWARF Data Representation
DWARF Data Representation
 
Interrupt of 8085
Interrupt of 8085Interrupt of 8085
Interrupt of 8085
 
Linux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend ProgramingLinux Binary Exploitation - Return-oritend Programing
Linux Binary Exploitation - Return-oritend Programing
 
Startup Snapshot in Node.js
Startup Snapshot in Node.jsStartup Snapshot in Node.js
Startup Snapshot in Node.js
 
Memory model
Memory modelMemory model
Memory model
 
[DEFCON 16] Bypassing pre-boot authentication passwords by instrumenting the...
[DEFCON 16] Bypassing pre-boot authentication passwords  by instrumenting the...[DEFCON 16] Bypassing pre-boot authentication passwords  by instrumenting the...
[DEFCON 16] Bypassing pre-boot authentication passwords by instrumenting the...
 
CO by Rakesh Roshan
CO by Rakesh RoshanCO by Rakesh Roshan
CO by Rakesh Roshan
 
1D Array in Assembly Language
1D Array in Assembly Language1D Array in Assembly Language
1D Array in Assembly Language
 
Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
 
JCL UTILITIES IEBCOPY
JCL UTILITIES IEBCOPYJCL UTILITIES IEBCOPY
JCL UTILITIES IEBCOPY
 
Play with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit TechniquePlay with FILE Structure - Yet Another Binary Exploit Technique
Play with FILE Structure - Yet Another Binary Exploit Technique
 
cache memory
 cache memory cache memory
cache memory
 
Sigreturn Oriented Programming
Sigreturn Oriented ProgrammingSigreturn Oriented Programming
Sigreturn Oriented Programming
 
An introduction to ROP
An introduction to ROPAn introduction to ROP
An introduction to ROP
 
A Step Towards Data Orientation
A Step Towards Data OrientationA Step Towards Data Orientation
A Step Towards Data Orientation
 
Smpe
SmpeSmpe
Smpe
 
Reliable Windows Heap Exploits
Reliable Windows Heap ExploitsReliable Windows Heap Exploits
Reliable Windows Heap Exploits
 
8086 assembly
8086 assembly8086 assembly
8086 assembly
 

Similar to Operating Systems - A Primer

Guide to alfresco monitoring
Guide to alfresco monitoringGuide to alfresco monitoring
Guide to alfresco monitoringMiguel Rodriguez
 
5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessorslpapadop
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Amin Astaneh
 
Computer System.ppt
Computer System.pptComputer System.ppt
Computer System.pptjguuhxxxfp
 
Computer System Architecture - Computer System Architecture
Computer System Architecture - Computer System ArchitectureComputer System Architecture - Computer System Architecture
Computer System Architecture - Computer System Architecturessusera1e32a1
 
lec5 - The processor.pptx
lec5 - The processor.pptxlec5 - The processor.pptx
lec5 - The processor.pptxMahadevaAH
 
Unix operating system basics
Unix operating system basicsUnix operating system basics
Unix operating system basicsSankar Suriya
 
linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning iman darabi
 
Bios, processorand motherboard
Bios, processorand  motherboardBios, processorand  motherboard
Bios, processorand motherboardImranulHasan6
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set ArchitectureJaffer Haadi
 
Linux System Monitoring
Linux System Monitoring Linux System Monitoring
Linux System Monitoring PriyaTeli
 
Ayw computer working
Ayw computer workingAyw computer working
Ayw computer workingpbeerak
 
OSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner FischerOSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner FischerNETWAYS
 
OSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerOSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerNETWAYS
 
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner FischerOSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner FischerNETWAYS
 
Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...
Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...
Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...ssuser65bfce
 

Similar to Operating Systems - A Primer (20)

Guide to alfresco monitoring
Guide to alfresco monitoringGuide to alfresco monitoring
Guide to alfresco monitoring
 
5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessors
 
Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)Linux Server Deep Dives (DrupalCon Amsterdam)
Linux Server Deep Dives (DrupalCon Amsterdam)
 
Computer System.ppt
Computer System.pptComputer System.ppt
Computer System.ppt
 
Computer System Architecture - Computer System Architecture
Computer System Architecture - Computer System ArchitectureComputer System Architecture - Computer System Architecture
Computer System Architecture - Computer System Architecture
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Os
OsOs
Os
 
Os
OsOs
Os
 
lec5 - The processor.pptx
lec5 - The processor.pptxlec5 - The processor.pptx
lec5 - The processor.pptx
 
Unix operating system basics
Unix operating system basicsUnix operating system basics
Unix operating system basics
 
linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning
 
Bios, processorand motherboard
Bios, processorand  motherboardBios, processorand  motherboard
Bios, processorand motherboard
 
Cpu
CpuCpu
Cpu
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 
Linux System Monitoring
Linux System Monitoring Linux System Monitoring
Linux System Monitoring
 
Ayw computer working
Ayw computer workingAyw computer working
Ayw computer working
 
OSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner FischerOSDC 2017 | Open POWER for the data center by Werner Fischer
OSDC 2017 | Open POWER for the data center by Werner Fischer
 
OSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data centerOSDC 2017 - Werner Fischer - Open power for the data center
OSDC 2017 - Werner Fischer - Open power for the data center
 
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner FischerOSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
OSDC 2017 | Linux Performance Profiling and Monitoring by Werner Fischer
 
Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...
Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...
Assembly Language for x86 Processors 7th Edition Chapter 2 : x86 Processor Ar...
 

More from Saumil Shah

The Hand That Strikes, Also Blocks
The Hand That Strikes, Also BlocksThe Hand That Strikes, Also Blocks
The Hand That Strikes, Also BlocksSaumil Shah
 
Debugging with EMUX - RIngzer0 BACK2WORKSHOPS
Debugging with EMUX - RIngzer0 BACK2WORKSHOPSDebugging with EMUX - RIngzer0 BACK2WORKSHOPS
Debugging with EMUX - RIngzer0 BACK2WORKSHOPSSaumil Shah
 
Unveiling EMUX - ARM and MIPS IoT Emulation Framework
Unveiling EMUX - ARM and MIPS IoT Emulation FrameworkUnveiling EMUX - ARM and MIPS IoT Emulation Framework
Unveiling EMUX - ARM and MIPS IoT Emulation FrameworkSaumil Shah
 
Announcing ARMX Docker - DC11332
Announcing ARMX Docker - DC11332Announcing ARMX Docker - DC11332
Announcing ARMX Docker - DC11332Saumil Shah
 
Precise Presentations
Precise PresentationsPrecise Presentations
Precise PresentationsSaumil Shah
 
Effective Webinars: Presentation Skills for a Virtual Audience
Effective Webinars: Presentation Skills for a Virtual AudienceEffective Webinars: Presentation Skills for a Virtual Audience
Effective Webinars: Presentation Skills for a Virtual AudienceSaumil Shah
 
INSIDE ARM-X Cansecwest 2020
INSIDE ARM-X Cansecwest 2020INSIDE ARM-X Cansecwest 2020
INSIDE ARM-X Cansecwest 2020Saumil Shah
 
Cyberspace And Security - India's Decade Ahead
Cyberspace And Security - India's Decade AheadCyberspace And Security - India's Decade Ahead
Cyberspace And Security - India's Decade AheadSaumil Shah
 
Cybersecurity And Sovereignty - A Look At Society's Transformation In Cyberspace
Cybersecurity And Sovereignty - A Look At Society's Transformation In CyberspaceCybersecurity And Sovereignty - A Look At Society's Transformation In Cyberspace
Cybersecurity And Sovereignty - A Look At Society's Transformation In CyberspaceSaumil Shah
 
NSConclave2020 The Decade Behind And The Decade Ahead
NSConclave2020 The Decade Behind And The Decade AheadNSConclave2020 The Decade Behind And The Decade Ahead
NSConclave2020 The Decade Behind And The Decade AheadSaumil Shah
 
Cybersecurity In India - The Decade Ahead
Cybersecurity In India - The Decade AheadCybersecurity In India - The Decade Ahead
Cybersecurity In India - The Decade AheadSaumil Shah
 
INSIDE ARM-X - Countermeasure 2019
INSIDE ARM-X - Countermeasure 2019INSIDE ARM-X - Countermeasure 2019
INSIDE ARM-X - Countermeasure 2019Saumil Shah
 
Introducing ARM-X
Introducing ARM-XIntroducing ARM-X
Introducing ARM-XSaumil Shah
 
The Road To Defendable Systems - Emirates NBD
The Road To Defendable Systems - Emirates NBDThe Road To Defendable Systems - Emirates NBD
The Road To Defendable Systems - Emirates NBDSaumil Shah
 
The CISO's Dilemma 44CON 2019
The CISO's Dilemma 44CON 2019The CISO's Dilemma 44CON 2019
The CISO's Dilemma 44CON 2019Saumil Shah
 
The CISO's Dilemma HITBGSEC2019
The CISO's Dilemma HITBGSEC2019The CISO's Dilemma HITBGSEC2019
The CISO's Dilemma HITBGSEC2019Saumil Shah
 
Schrödinger's ARM Assembly
Schrödinger's ARM AssemblySchrödinger's ARM Assembly
Schrödinger's ARM AssemblySaumil Shah
 
ARM Polyglot Shellcode - HITB2019AMS
ARM Polyglot Shellcode - HITB2019AMSARM Polyglot Shellcode - HITB2019AMS
ARM Polyglot Shellcode - HITB2019AMSSaumil Shah
 
What Makes a Compelling Photograph
What Makes a Compelling PhotographWhat Makes a Compelling Photograph
What Makes a Compelling PhotographSaumil Shah
 
Make ARM Shellcode Great Again - HITB2018PEK
Make ARM Shellcode Great Again - HITB2018PEKMake ARM Shellcode Great Again - HITB2018PEK
Make ARM Shellcode Great Again - HITB2018PEKSaumil Shah
 

More from Saumil Shah (20)

The Hand That Strikes, Also Blocks
The Hand That Strikes, Also BlocksThe Hand That Strikes, Also Blocks
The Hand That Strikes, Also Blocks
 
Debugging with EMUX - RIngzer0 BACK2WORKSHOPS
Debugging with EMUX - RIngzer0 BACK2WORKSHOPSDebugging with EMUX - RIngzer0 BACK2WORKSHOPS
Debugging with EMUX - RIngzer0 BACK2WORKSHOPS
 
Unveiling EMUX - ARM and MIPS IoT Emulation Framework
Unveiling EMUX - ARM and MIPS IoT Emulation FrameworkUnveiling EMUX - ARM and MIPS IoT Emulation Framework
Unveiling EMUX - ARM and MIPS IoT Emulation Framework
 
Announcing ARMX Docker - DC11332
Announcing ARMX Docker - DC11332Announcing ARMX Docker - DC11332
Announcing ARMX Docker - DC11332
 
Precise Presentations
Precise PresentationsPrecise Presentations
Precise Presentations
 
Effective Webinars: Presentation Skills for a Virtual Audience
Effective Webinars: Presentation Skills for a Virtual AudienceEffective Webinars: Presentation Skills for a Virtual Audience
Effective Webinars: Presentation Skills for a Virtual Audience
 
INSIDE ARM-X Cansecwest 2020
INSIDE ARM-X Cansecwest 2020INSIDE ARM-X Cansecwest 2020
INSIDE ARM-X Cansecwest 2020
 
Cyberspace And Security - India's Decade Ahead
Cyberspace And Security - India's Decade AheadCyberspace And Security - India's Decade Ahead
Cyberspace And Security - India's Decade Ahead
 
Cybersecurity And Sovereignty - A Look At Society's Transformation In Cyberspace
Cybersecurity And Sovereignty - A Look At Society's Transformation In CyberspaceCybersecurity And Sovereignty - A Look At Society's Transformation In Cyberspace
Cybersecurity And Sovereignty - A Look At Society's Transformation In Cyberspace
 
NSConclave2020 The Decade Behind And The Decade Ahead
NSConclave2020 The Decade Behind And The Decade AheadNSConclave2020 The Decade Behind And The Decade Ahead
NSConclave2020 The Decade Behind And The Decade Ahead
 
Cybersecurity In India - The Decade Ahead
Cybersecurity In India - The Decade AheadCybersecurity In India - The Decade Ahead
Cybersecurity In India - The Decade Ahead
 
INSIDE ARM-X - Countermeasure 2019
INSIDE ARM-X - Countermeasure 2019INSIDE ARM-X - Countermeasure 2019
INSIDE ARM-X - Countermeasure 2019
 
Introducing ARM-X
Introducing ARM-XIntroducing ARM-X
Introducing ARM-X
 
The Road To Defendable Systems - Emirates NBD
The Road To Defendable Systems - Emirates NBDThe Road To Defendable Systems - Emirates NBD
The Road To Defendable Systems - Emirates NBD
 
The CISO's Dilemma 44CON 2019
The CISO's Dilemma 44CON 2019The CISO's Dilemma 44CON 2019
The CISO's Dilemma 44CON 2019
 
The CISO's Dilemma HITBGSEC2019
The CISO's Dilemma HITBGSEC2019The CISO's Dilemma HITBGSEC2019
The CISO's Dilemma HITBGSEC2019
 
Schrödinger's ARM Assembly
Schrödinger's ARM AssemblySchrödinger's ARM Assembly
Schrödinger's ARM Assembly
 
ARM Polyglot Shellcode - HITB2019AMS
ARM Polyglot Shellcode - HITB2019AMSARM Polyglot Shellcode - HITB2019AMS
ARM Polyglot Shellcode - HITB2019AMS
 
What Makes a Compelling Photograph
What Makes a Compelling PhotographWhat Makes a Compelling Photograph
What Makes a Compelling Photograph
 
Make ARM Shellcode Great Again - HITB2018PEK
Make ARM Shellcode Great Again - HITB2018PEKMake ARM Shellcode Great Again - HITB2018PEK
Make ARM Shellcode Great Again - HITB2018PEK
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

Operating Systems - A Primer

  • 3. # who am i Saumil Shah CEO Net-square. Hacker, Speaker, Trainer, Author. M.S. Computer Science Purdue University. Google: "saumil" LinkedIn: saumilshah
  • 6. The CPU We shall discuss the Intel x86 32-bit CPU.
  • 7. The CPU We shall discuss the Intel x86 32-bit CPU. The CPU has REGISTERS.
  • 8. The CPU We shall discuss the Intel x86 32-bit CPU. The CPU has REGISTERS. "Variables" on the CPU, hard-wired. Size is equal to the "machine word". (32 bits)
  • 10. What do Registers do? Registers hold data.
  • 11. What do Registers do? Registers hold data. They may be numbers... ...or memory addresses (pointers)
  • 12. What do Registers do? Registers hold data. They may be numbers... ...or memory addresses (pointers) Using registers, the CPU can perform computations, read and write memory, and execute instructions.
  • 13. x86 Registers - the basics EAX ESI EBX EDI ECX ESP EDX EBP EIP EFLAGS there are more, but this is good enough for now.
  • 14. x86 Registers - General Purpose EAX Accumulator EBX Base ECX Count EDX Data
  • 15. x86 Registers - General Purpose EAX Accumulator EBX Base ECX Count EDX Data Used for Integer operations (arithmetic), returning values (EAX), loops (ECX), or anything the compiler wishes to use them for.
  • 16. x86 Registers - Pointers ESI Source Index EDI Destination Index
  • 17. x86 Registers - Pointers ESI Source Index EDI Destination Index These are POINTERS, used for block copy operations. ESI = address of source, EDI = address of destination, ECX = count of bytes/words to be copied.
  • 18. x86 Registers - Stack Related Stack Pointer ESP Frame Pointer (Base Pointer) EBP
  • 19. x86 Registers - Stack Related Stack Pointer points to the top of the process stack. Stack Pointer ESP Frame Pointer (Base Pointer) EBP
  • 20. x86 Registers - Stack Related Stack Pointer points to the top of the process stack. Stack Pointer ESP Frame Pointer (Base Pointer) EBP Frame pointer points to FRAMES within the stack. Frames store data for functions.
  • 21. x86 Registers - EIP EIP Instruction Pointer (program counter)
  • 22. x86 Registers - EIP A very important register. Points to a memory address from where the CPU fetches and executes the next instruction. EIP autoincrements after every instruction. EIP Instruction Pointer (program counter)
  • 23. x86 Registers - Flags EFLAGS Bit Flags
  • 24. x86 Registers - Flags Individual bits indicate status of operations. Boolean values. Never treated as a full register, just individual bit flags. EFLAGS Bit Flags
  • 26. The Operating System Modern Operating Systems are very complex and do many things. We shall discuss only the basic concepts and functions of an OS.
  • 27. The Operating System Modern Operating Systems are very complex and do many things. We shall discuss only the basic concepts and functions of an OS. Multitasking and Multiprogramming Processes The Virtual Machine
  • 29. What is Multiprogramming? The ability to store and execute multiple programs in the memory
  • 30. What is Multiprogramming? The ability to store and execute multiple programs in the memory ...and what is Multitasking?
  • 31. What is Multiprogramming? The ability to store and execute multiple programs in the memory ...and what is Multitasking? Running multiple PROCESSES at the SAME TIME.
  • 32. So what is a "Process"?
  • 33. So what is a "Process"? A PROCESS is termed as a program that is EXECUTING. A running program.
  • 34. So what is a "Process"? A PROCESS is termed as a program that is EXECUTING. A running program. A process is an instance of a program. Processes "live" in memory. Programs live on disk. (secondary storage) A program may have multiple processes of its own self.
  • 35. How do multiple processes run simultaneously?
  • 36. How do multiple processes run simultaneously? By TIME SLICING and CONTEXT-SWITCHING
  • 37. How do multiple processes run simultaneously? By TIME SLICING and CONTEXT-SWITCHING Each process runs for a short time and is then PRE-EMPTED to let another process run. This happens so fast, it appears as if all processes are running simultaneously. This is called MULTITASKING
  • 39. Multitasking Process Queue P2 P3 P4 P1 CPU Process P1 is running. It shall continue to run for a small period of time, called a QUANTUM.
  • 40. Multitasking P2 P3 P4 P1 Time Slice Interrupt CPU An INTERRUPT is triggered at the end of the quantum. A snapshot of P1's registers (P1's CONTEXT) is saved.
  • 41. Multitasking P2 P3 P4 P1 CPU P1 is then PRE-EMPTED. It is brought back into the process queue.
  • 42. Multitasking P2 P3 P4 P1 CPU It is P2's turn now. P2's context is loaded into the CPU's registers. This is called CONTEXT SWITCHING.
  • 43. Multitasking P1 P3 P4 P2 CPU P2 is scheduled to execute on the CPU.
  • 44. Multitasking P1 P3 P4 P2 CPU P2 runs for the next quantum.
  • 45. Multitasking P1 P3 P4 P2 Time Slice Interrupt CPU P2's context is now saved.
  • 46. Multitasking P1 P3 P4 P2 CPU P2 is PRE-EMPTED. It is brought back into the process queue. Next it will be P3's turn, and so on.
  • 47. Virtual Machines and Process Memory Maps
  • 48. What is a Virtual Machine?
  • 49. What is a Virtual Machine? A view of ABSTRACTED HARDWARE as presented to a PROCESS by the OS.
  • 50. What is a Virtual Machine? A view of ABSTRACTED HARDWARE as presented to a PROCESS by the OS. A process sees its OWN view of the CPU, Memory, Storage, and other devices. Every process runs in its own "virtual" machine. This is how the OS ensures process memory and resource segregation.
  • 51. Do processes have their OWN view of the memory? Yes. Processes see "Virtual Memory"
  • 52. Do processes have their OWN view of the memory? Yes. Processes see "Virtual Memory" Physical memory is divided into PAGES. A process is assigned pages as needed. This is done by the Memory Management Unit (MMU) From the process' point of view, it seems to have all the memory to itself.
  • 53. Pages from P1's memory are mapped from physical memory. P1 sees a "virtual address space". Physical Memory P1's memory Physical and Virtual Memory
  • 54. Physical and Virtual Memory Similarly for P2. Physical Memory P1's memory P2's memory
  • 55. Can one process access another's memory? No. A process can only access its own virtual memory space.
  • 56. Can one process access another's memory? No. A process can only access its own virtual memory space. A process CANNOT access physical memory.
  • 57. The Process' view of memory Process Memory has its own VIRTUAL ADDRESS SPACE. Typically 2 to 3 GB. Binary Heap It is called a PROCESS MEMORY MAP. Lib 3GB (Linux) 2GB (Win32) Lib Lower addresses represented at the top of the map. Higher addresses at the bottom. Lib Stack Process' Virtual Memory
  • 58. Linux Process Memory Map 0x08000000 Binary Heap Lib 3GB Lib Lib Stack 0xbfffffff Linux Process Memory Map
  • 59. An example Here's how to view a process' memory map in Linux. The process here is PID 1110. saumil@localhost:$ pmap 1110 1110: /home/nweb/nweb 8181 /home/nweb 08048000 8K read/exec /home/nweb/nweb 0804a000 4K read/write /home/nweb/nweb 0804b000 8K read/write/exec [ anon ] 40000000 72K read/exec /lib/ld-2.3.1.so 40012000 4K read/write /lib/ld-2.3.1.so 40013000 4K read/write [ anon ] 40019000 1204K read/exec /lib/i686/libc-2.3.1.so 40146000 16K read/write /lib/i686/libc-2.3.1.so 4014a000 8K read/write [ anon ] bfffe000 8K read/write/exec [ anon ] total 1336K
  • 61. CPU NIC Storage Physical Memory
  • 62. File System Network Stack Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
  • 63. kernel space System Calls File System Network Stack Loader Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
  • 64. user space Virtual Memory PROCESS Virtual Memory PROCESS Virtual Memory PROCESS CPU FS N/W CPU FS N/W CPU FS N/W kernel space System Calls File System Network Stack Loader Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
  • 65. user space Virtual Memory PROCESS Virtual Memory PROCESS Virtual Memory PROCESS CPU FS N/W CPU FS N/W CPU FS N/W kernel space System Calls File System Network Stack Loader Scheduler MMU Driver Driver CPU NIC Storage Physical Memory
  • 68. END