SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF Superpowers
Brendan Gregg
 
EuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis MethodologiesEuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis Methodologies
Brendan Gregg
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
ScyllaDB
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
Charles Nutter
 

Tendances (20)

Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
Linux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF SuperpowersLinux 4.x Tracing Tools: Using BPF Superpowers
Linux 4.x Tracing Tools: Using BPF Superpowers
 
EuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis MethodologiesEuroBSDcon 2017 System Performance Analysis Methodologies
EuroBSDcon 2017 System Performance Analysis Methodologies
 
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionLinux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
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
 
Qemu Introduction
Qemu IntroductionQemu Introduction
Qemu Introduction
 
Performance Analysis Tools for Linux Kernel
Performance Analysis Tools for Linux KernelPerformance Analysis Tools for Linux Kernel
Performance Analysis Tools for Linux Kernel
 
High-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uringHigh-Performance Networking Using eBPF, XDP, and io_uring
High-Performance Networking Using eBPF, XDP, and io_uring
 
Linux Performance Profiling and Monitoring
Linux Performance Profiling and MonitoringLinux Performance Profiling and Monitoring
Linux Performance Profiling and Monitoring
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 
Linux Ethernet device driver
Linux Ethernet device driverLinux Ethernet device driver
Linux Ethernet device driver
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
 
Linux Memory
Linux MemoryLinux Memory
Linux Memory
 
Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)Performance Wins with eBPF: Getting Started (2021)
Performance Wins with eBPF: Getting Started (2021)
 
eBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to UserspaceeBPF Trace from Kernel to Userspace
eBPF Trace from Kernel to Userspace
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
 
IntelON 2021 Processor Benchmarking
IntelON 2021 Processor BenchmarkingIntelON 2021 Processor Benchmarking
IntelON 2021 Processor Benchmarking
 

Similaire à Operating Systems - A Primer

5.6 Basic computer structure microprocessors
5.6 Basic computer structure   microprocessors5.6 Basic computer structure   microprocessors
5.6 Basic computer structure microprocessors
lpapadop
 
Computer System Architecture - Computer System Architecture
Computer System Architecture - Computer System ArchitectureComputer System Architecture - Computer System Architecture
Computer System Architecture - Computer System Architecture
ssusera1e32a1
 
Ayw computer working
Ayw computer workingAyw computer working
Ayw computer working
pbeerak
 

Similaire à 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...
 

Plus de Saumil Shah

Plus de 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
 

Dernier

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
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
giselly40
 

Dernier (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
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...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 

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