SlideShare a Scribd company logo
1 of 3
Download to read offline
1 Spring 1997, Lecture 03
Input / Output (I/O)
n CPU and device controllers all use a
common bus for communication
n Software-polling synchronous I/O
q CPU starts an I/O operation, and
continuously polls (checks) that device
until the I/O operation finishes
q Device controller contains registers for
communication with that device
n Input register, output register — for data
n Control register — to tell it what to do
n Status register — to see what it’s done
q Why not connect all I/O devices directly to
CPU? Why not… memory…?
CPU
Disk
Cont roller
Print er
Cont roller
Tape Drive
Cont roller
Memory
Cont roller
2 Spring 1997, Lecture 03
Input / Output (I/O)
(cont.)
n Terminology
q Synchronous I/O — CPU execution waits
while I/O proceeds
q Asynchronous I/O — I/O proceeds
concurrently with CPU execution
n Interrupt-based asynchronous I/O
q Device controller has its own processor,
and executes asynchronously with CPU
n Device controller puts an interrupt signal
on the bus when it needs CPU’s attention
q When CPU receives an interrupt:
1. It saves the CPU state and invokes the
appropriate interrupt handler using the
interrupt vector (addresses of OS
routines to handle various events)
2. Handler must save and restore software
state (e.g., registers it will modify)
3. CPU restores CPU state
3 Spring 1997, Lecture 03
Input / Output (I/O)
(cont.)
n Memory-mapped I/O
q Uses direct memory access (DMA) — I/O
device can transfer block of data to / from
memory without going through CPU
q OS allocates buffer in memory, tells I/O
device to use that buffer
q I/O device operates asynchronously with
CPU, interrupts CPU when finished
q Used for most high-speed I/O devices
(e.g., disks, communication interfaces)
CPU I/ O device
memory
I/ O commands
dat adat a
4 Spring 1997, Lecture 03
Storage Structures
n At a given level, memory may not be as
big or as fast as you’d like it be
q Tradeoffs between size and speed
n Principle of Locality of Reference leads
to caching
q When info is needed, look on this level
q If it’s not on this level, get it from the next
slower level, and save a copy here in
case it’s needed again sometime soon
Regist ers
Level 1 Cache
Level 2 Cache
Disk (Virtual Memory)
Disk (File System)
FAST
SLOW
SMALL
LARGEBackup Tape
Main Memory
5 Spring 1997, Lecture 03
Magnetic Disks
n Provide secondary storage for system
(after main memory)
n Technology
q Covered with magnetic material
q Read / write head “floats” just above
surface of disk
q Hierarchically organized as platters,
tracks, sectors (blocks)
n Devices
q Hard (moving-head) disk — one or more
platters, head moves across tracks
q Floppy disk — disk covered with hard
surface, read / write head sits on disk,
slower, smaller, removable, rugged
q CDROM — uses laser, read-only, high-
density
n Optical —read / write
6 Spring 1997, Lecture 03
Protection
n Multiprogramming and timesharing
require that the memory and I/O of the
OS and user processes be protected
against each other
q Note that most PCs do not support this
kind of protection
n Provide protection via two modes of CPU
execution: user mode and kernel mode
q In kernel / privileged / supervisor mode,
privileged instructions can:
n Access I/O devices, control interrupts
n Manipulate the state of the memory (page
table, TLB, etc.)
n Halt the machine
n Change the mode
q Requires architectural support:
n Mode bit in a protected register
n Privileged instructions, which can only be
executed in kernel mode
7 Spring 1997, Lecture 03
I/O Protection
n To prevent illegal I/O, or simultaneous
I/O requests from multiple processes,
perform all I/O via privileged instructions
q User programs must make a system call
to the OS to perform I/O
n When user process makes a system call:
q A trap (software-generated interrupt)
occurs, which causes:
n The appropriate trap handler to be invoked
using the trap vector
n Kernel mode to be set
q Trap handler:
n Saves state
n Performs requested I/O (if appropriate)
n Restores state, sets user mode, and
returns to calling program
8 Spring 1997, Lecture 03
Memory Protection
n Must protect OS’s memory from user
programs (can’t overwrite, can’t access)
q Must protect memory of one process from
another process
q Must not protect memory of user process
from OS
n Simplest and most common technique:
q Base register —smallest legal address
q Limit register — size of address range
q Base and limit registers are loaded by OS
before running a particular process
q CPU checks each address (instruction &
data) generated in user mode
n Any attempt to access memory outside the
legal range results in a trap to the OS
n Additional hardware support is provided
for virtual memory
9 Spring 1997, Lecture 03
CPU Protection
n Use a timer to prevent CPU from being
hogged by one process (either
maliciously, or due to an infinite loop)
q Set timer to interrupt OS after a specified
period (small fraction of a second)
q When interrupt occurs, control transfers
to OS, which decides which process to
execute for next time interval (maybe the
same process, maybe another one)
n Also use timer to implement time sharing
q At end of each time interval, OS switches
to another process
q Context switch = save state of that
process, update Process Control Block
for each of the two processes, restore
state of next process
10 Spring 1997, Lecture 03
Computer Architecture & OS
n Need for OS services often drives
inclusion of architectural features in CPU:
OS Service Hardware Support
I/O interrupts
memory-mapped I/O
caching
Data access memory hierarchies
file systems
Protection system calls
kernel & user mode
privileged instructions
interrupts & traps
base & limit registers
Scheduling & timers
Error recovery

More Related Content

What's hot

Linux memory consumption
Linux memory consumptionLinux memory consumption
Linux memory consumptionhaish
 
Operating Systems - Processor Management
Operating Systems - Processor ManagementOperating Systems - Processor Management
Operating Systems - Processor ManagementDamian T. Gordon
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategiesDr. Loganathan R
 
OS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switchOS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switchDaniel Ben-Zvi
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process managementBabasab Patil
 
Process management
Process managementProcess management
Process managementMohd Arif
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its conceptsKaran Thakkar
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management Shashank Asthana
 
Os presentation process
Os presentation processOs presentation process
Os presentation processNaseer Ahmad
 
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemProcess, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemLieYah Daliah
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - IntroductionWayne Jones Jnr
 
Process management
Process managementProcess management
Process managementBirju Tank
 
Linux optimization strategy plan by shiv
Linux optimization strategy plan by shivLinux optimization strategy plan by shiv
Linux optimization strategy plan by shivthedatabasearchitect
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPTQUONTRASOLUTIONS
 
Unit II - 1 - Operating System Process
Unit II - 1 - Operating System ProcessUnit II - 1 - Operating System Process
Unit II - 1 - Operating System Processcscarcas
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows VistaTrinh Phuc Tho
 

What's hot (20)

Linux memory consumption
Linux memory consumptionLinux memory consumption
Linux memory consumption
 
Process of operating system
Process of operating systemProcess of operating system
Process of operating system
 
Operating Systems - Processor Management
Operating Systems - Processor ManagementOperating Systems - Processor Management
Operating Systems - Processor Management
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
OS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switchOS scheduling and The anatomy of a context switch
OS scheduling and The anatomy of a context switch
 
Chapter 3 - Processes
Chapter 3 - ProcessesChapter 3 - Processes
Chapter 3 - Processes
 
水晶礦脈
水晶礦脈水晶礦脈
水晶礦脈
 
My ppt @ bec doms on process management
My ppt @ bec doms on process managementMy ppt @ bec doms on process management
My ppt @ bec doms on process management
 
Process management
Process managementProcess management
Process management
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
Operating system Memory management
Operating system Memory management Operating system Memory management
Operating system Memory management
 
Os presentation process
Os presentation processOs presentation process
Os presentation process
 
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemProcess, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - Introduction
 
OSCh9
OSCh9OSCh9
OSCh9
 
Process management
Process managementProcess management
Process management
 
Linux optimization strategy plan by shiv
Linux optimization strategy plan by shivLinux optimization strategy plan by shiv
Linux optimization strategy plan by shiv
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPT
 
Unit II - 1 - Operating System Process
Unit II - 1 - Operating System ProcessUnit II - 1 - Operating System Process
Unit II - 1 - Operating System Process
 
Processes and Threads in Windows Vista
Processes and Threads in Windows VistaProcesses and Threads in Windows Vista
Processes and Threads in Windows Vista
 

Similar to L03

Lecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfLecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfTaufeeq8
 
computer system structure
computer system structurecomputer system structure
computer system structureHAMZA AHMED
 
OS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptxOS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptxGokhul2
 
OS - Ch1
OS - Ch1OS - Ch1
OS - Ch1sphs
 
Operating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chaptersOperating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chapterssphs
 
operating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsoperating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsJyoReddy9
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxLeahRachael
 
linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning iman darabi
 
The central processing unit by group 5 2015
The central processing unit by group 5 2015The central processing unit by group 5 2015
The central processing unit by group 5 2015Tendai Karuma
 

Similar to L03 (20)

Lecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdfLecture1,2,3 (1).pdf
Lecture1,2,3 (1).pdf
 
Io sys
Io sysIo sys
Io sys
 
computer system structure
computer system structurecomputer system structure
computer system structure
 
test1_361
test1_361test1_361
test1_361
 
OS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptxOS_Unit II - Process Management_CATI.pptx
OS_Unit II - Process Management_CATI.pptx
 
Unit 6
Unit 6Unit 6
Unit 6
 
OS - Ch1
OS - Ch1OS - Ch1
OS - Ch1
 
Operating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chaptersOperating systems. replace ch1 with numbers for next chapters
Operating systems. replace ch1 with numbers for next chapters
 
operating system over view.ppt operating sysyems
operating system over view.ppt operating sysyemsoperating system over view.ppt operating sysyems
operating system over view.ppt operating sysyems
 
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptxUNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
UNIT 5- UNDERSTANDING THE SYSTEM DESIGN PROCESS.pptx
 
Operating System Lecture 2
Operating System Lecture 2Operating System Lecture 2
Operating System Lecture 2
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
Ch1
Ch1Ch1
Ch1
 
Ch 01 os8e
Ch 01  os8eCh 01  os8e
Ch 01 os8e
 
linux monitoring and performance tunning
linux monitoring and performance tunning linux monitoring and performance tunning
linux monitoring and performance tunning
 
Operating System-2 by Adi.pdf
Operating System-2 by Adi.pdfOperating System-2 by Adi.pdf
Operating System-2 by Adi.pdf
 
Register
RegisterRegister
Register
 
Optimizing Linux Servers
Optimizing Linux ServersOptimizing Linux Servers
Optimizing Linux Servers
 
The central processing unit by group 5 2015
The central processing unit by group 5 2015The central processing unit by group 5 2015
The central processing unit by group 5 2015
 
CS6401 Operating Systems
CS6401 Operating SystemsCS6401 Operating Systems
CS6401 Operating Systems
 

More from International advisers

More from International advisers (20)

SNC 2020 MATHEMATICS Final.pptx
SNC 2020 MATHEMATICS Final.pptxSNC 2020 MATHEMATICS Final.pptx
SNC 2020 MATHEMATICS Final.pptx
 
SNC 2020 MATHEMATICS Lesson plan.pptx
SNC 2020 MATHEMATICS Lesson plan.pptxSNC 2020 MATHEMATICS Lesson plan.pptx
SNC 2020 MATHEMATICS Lesson plan.pptx
 
SNC 2020 MATHEMATICS requirment.pptx
SNC 2020 MATHEMATICS requirment.pptxSNC 2020 MATHEMATICS requirment.pptx
SNC 2020 MATHEMATICS requirment.pptx
 
SNC 2020 MATHEMATICS Final final.pptx
SNC 2020 MATHEMATICS Final final.pptxSNC 2020 MATHEMATICS Final final.pptx
SNC 2020 MATHEMATICS Final final.pptx
 
GRAVITATION Day 1 final.pptx
GRAVITATION Day 1 final.pptxGRAVITATION Day 1 final.pptx
GRAVITATION Day 1 final.pptx
 
GRAVITATION Day 1 sample.pptx
GRAVITATION Day 1 sample.pptxGRAVITATION Day 1 sample.pptx
GRAVITATION Day 1 sample.pptx
 
GRAVITATION Day 1 final own voice.pptx
GRAVITATION Day 1 final own voice.pptxGRAVITATION Day 1 final own voice.pptx
GRAVITATION Day 1 final own voice.pptx
 
RATIO & PROPORTION.pptx
RATIO & PROPORTION.pptxRATIO & PROPORTION.pptx
RATIO & PROPORTION.pptx
 
.ppt
.ppt.ppt
.ppt
 
Chapter 19.ppt
Chapter 19.pptChapter 19.ppt
Chapter 19.ppt
 
Checks and Balances.ppt
Checks and Balances.pptChecks and Balances.ppt
Checks and Balances.ppt
 
AP Gov Federalism Lyberger 2015.pptx
AP Gov Federalism Lyberger 2015.pptxAP Gov Federalism Lyberger 2015.pptx
AP Gov Federalism Lyberger 2015.pptx
 
ap gov ppt ch01.ppt
ap gov ppt ch01.pptap gov ppt ch01.ppt
ap gov ppt ch01.ppt
 
Teacher Notes MODULE 25.pptx
Teacher Notes MODULE 25.pptxTeacher Notes MODULE 25.pptx
Teacher Notes MODULE 25.pptx
 
Teacher Notes MODULE 28.pptx
Teacher Notes MODULE 28.pptxTeacher Notes MODULE 28.pptx
Teacher Notes MODULE 28.pptx
 
Teacher Notes MODULE 20.pptx
Teacher Notes MODULE 20.pptxTeacher Notes MODULE 20.pptx
Teacher Notes MODULE 20.pptx
 
Teacher Notes MODULE 21.pptx
Teacher Notes MODULE 21.pptxTeacher Notes MODULE 21.pptx
Teacher Notes MODULE 21.pptx
 
Teacher Notes MODULE 23.pptx
Teacher Notes MODULE 23.pptxTeacher Notes MODULE 23.pptx
Teacher Notes MODULE 23.pptx
 
Teacher Notes MODULE 24.pptx
Teacher Notes MODULE 24.pptxTeacher Notes MODULE 24.pptx
Teacher Notes MODULE 24.pptx
 
Chapter_20.pptx
Chapter_20.pptxChapter_20.pptx
Chapter_20.pptx
 

Recently uploaded

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Recently uploaded (20)

Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

L03

  • 1. 1 Spring 1997, Lecture 03 Input / Output (I/O) n CPU and device controllers all use a common bus for communication n Software-polling synchronous I/O q CPU starts an I/O operation, and continuously polls (checks) that device until the I/O operation finishes q Device controller contains registers for communication with that device n Input register, output register — for data n Control register — to tell it what to do n Status register — to see what it’s done q Why not connect all I/O devices directly to CPU? Why not… memory…? CPU Disk Cont roller Print er Cont roller Tape Drive Cont roller Memory Cont roller 2 Spring 1997, Lecture 03 Input / Output (I/O) (cont.) n Terminology q Synchronous I/O — CPU execution waits while I/O proceeds q Asynchronous I/O — I/O proceeds concurrently with CPU execution n Interrupt-based asynchronous I/O q Device controller has its own processor, and executes asynchronously with CPU n Device controller puts an interrupt signal on the bus when it needs CPU’s attention q When CPU receives an interrupt: 1. It saves the CPU state and invokes the appropriate interrupt handler using the interrupt vector (addresses of OS routines to handle various events) 2. Handler must save and restore software state (e.g., registers it will modify) 3. CPU restores CPU state 3 Spring 1997, Lecture 03 Input / Output (I/O) (cont.) n Memory-mapped I/O q Uses direct memory access (DMA) — I/O device can transfer block of data to / from memory without going through CPU q OS allocates buffer in memory, tells I/O device to use that buffer q I/O device operates asynchronously with CPU, interrupts CPU when finished q Used for most high-speed I/O devices (e.g., disks, communication interfaces) CPU I/ O device memory I/ O commands dat adat a 4 Spring 1997, Lecture 03 Storage Structures n At a given level, memory may not be as big or as fast as you’d like it be q Tradeoffs between size and speed n Principle of Locality of Reference leads to caching q When info is needed, look on this level q If it’s not on this level, get it from the next slower level, and save a copy here in case it’s needed again sometime soon Regist ers Level 1 Cache Level 2 Cache Disk (Virtual Memory) Disk (File System) FAST SLOW SMALL LARGEBackup Tape Main Memory
  • 2. 5 Spring 1997, Lecture 03 Magnetic Disks n Provide secondary storage for system (after main memory) n Technology q Covered with magnetic material q Read / write head “floats” just above surface of disk q Hierarchically organized as platters, tracks, sectors (blocks) n Devices q Hard (moving-head) disk — one or more platters, head moves across tracks q Floppy disk — disk covered with hard surface, read / write head sits on disk, slower, smaller, removable, rugged q CDROM — uses laser, read-only, high- density n Optical —read / write 6 Spring 1997, Lecture 03 Protection n Multiprogramming and timesharing require that the memory and I/O of the OS and user processes be protected against each other q Note that most PCs do not support this kind of protection n Provide protection via two modes of CPU execution: user mode and kernel mode q In kernel / privileged / supervisor mode, privileged instructions can: n Access I/O devices, control interrupts n Manipulate the state of the memory (page table, TLB, etc.) n Halt the machine n Change the mode q Requires architectural support: n Mode bit in a protected register n Privileged instructions, which can only be executed in kernel mode 7 Spring 1997, Lecture 03 I/O Protection n To prevent illegal I/O, or simultaneous I/O requests from multiple processes, perform all I/O via privileged instructions q User programs must make a system call to the OS to perform I/O n When user process makes a system call: q A trap (software-generated interrupt) occurs, which causes: n The appropriate trap handler to be invoked using the trap vector n Kernel mode to be set q Trap handler: n Saves state n Performs requested I/O (if appropriate) n Restores state, sets user mode, and returns to calling program 8 Spring 1997, Lecture 03 Memory Protection n Must protect OS’s memory from user programs (can’t overwrite, can’t access) q Must protect memory of one process from another process q Must not protect memory of user process from OS n Simplest and most common technique: q Base register —smallest legal address q Limit register — size of address range q Base and limit registers are loaded by OS before running a particular process q CPU checks each address (instruction & data) generated in user mode n Any attempt to access memory outside the legal range results in a trap to the OS n Additional hardware support is provided for virtual memory
  • 3. 9 Spring 1997, Lecture 03 CPU Protection n Use a timer to prevent CPU from being hogged by one process (either maliciously, or due to an infinite loop) q Set timer to interrupt OS after a specified period (small fraction of a second) q When interrupt occurs, control transfers to OS, which decides which process to execute for next time interval (maybe the same process, maybe another one) n Also use timer to implement time sharing q At end of each time interval, OS switches to another process q Context switch = save state of that process, update Process Control Block for each of the two processes, restore state of next process 10 Spring 1997, Lecture 03 Computer Architecture & OS n Need for OS services often drives inclusion of architectural features in CPU: OS Service Hardware Support I/O interrupts memory-mapped I/O caching Data access memory hierarchies file systems Protection system calls kernel & user mode privileged instructions interrupts & traps base & limit registers Scheduling & timers Error recovery