SlideShare a Scribd company logo
Operating System:
Chap1 Introduction
National Tsing-Hua University
2016, Fall Semester
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 2
Outline
 What is an Operating System?
 Computer-System Organization
 HW Protection
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 3
What is an Operating System
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 4
Computer System
 Four components:

User 1 User 2 User 3 User n
Application Programs
Compiler Assembler Text Editor Browser
Operating System
Computer
Hardware
CPU Memory Device
_________,_______,__________,______
User
Application
OS
Hardware
…..
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 5
Computer System
 User — people, machines, other computers
 Application — define the ways in which the
system resources are used to solve the
computing problems
 Operating System — _______ and __________
the use of the hardware/resources
 Hardware — provides basic computing resources
(CPU, memory, I/O devices)
controls coordinates
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 6
What is an Operating System?
 An operating system is the “permanent”
software that controls/abstracts
hardware resources for user applications
physical machine interface
User Applications
Operating System
Architecture
virtual machine interface
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 7
Multi-tasking Operating Systems
 Manages resources and processes to
support different user applications
 Provides Applications Programming
Interface (API) for user applications
User Application
Operating System
Architecture
User Application
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 8
General-Purpose Operating Systems
user
compiler
OS interface
OS
Hardware
User program Executable binary
Compiler Linker
System library
Architecture
Device drivers
Operating system
kernel
user mode
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 9
Definition of an Operating System
 Resource allocator – manages and allocates
resources to insure efficiency and fairness
 Control program – controls the execution of
user programs and operations of I/O devices to
prevent errors and improper use of computer
 Kernel – the one program running at all times
(all else being system/application programs)
No universally accepted definition
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 10
Goals of an Operating System
 Convenience
 make computer system easy to use and compute
 In particular for small PC
 Efficiency
 use computer hardware in an efficient manner
 Especially for large, shared, multiuser systems
Two goals are sometimes contradictory
In the past, efficiency is more important
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 11
Importance of an Operating System
 System API are the only interface between
user applications and hardware
 API are designed for general-purpose, not
performance driven
 OS code cannot allow any bug
 Any break (e.g. invalid access) causes reboot
 The owner of OS technology controls the
software & hardware industry
 Operating systems and computer architecture
influence each other
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 12
Modern Operating Systems
 x86 platform
 Linux (CentOS, Redhat, openSUSE, Ubuntu, etc)
 Windows (Windows10, XP, 2000, etc)
 PowerPC platform – Mac OS
 Smartphone Mobile OS
 Android, iOS, Windows10 Mobile, Ubuntu Touch
 Embedded OS
 Embedded Linux(Andriod, WebOS), Windows CE
 Raspberry Pi, Xbox, etc
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 13
Review Slides (1)
 Definition of OS?
 Goals of OS?
 Importance of OS?
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 14
Computer-System
Organization
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 15
Computer-System Organization
 One or more CPUs, device controllers connect
through common bus providing access to
shared memory
 Goal: __________________________________
______________________________
Concurrent execution of CPUs and devices
competing for memory cycles
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 16
Computer-System Operations
 Each device controller is in charge of a
particular device type
 Each device controller has a local buffer
 I/O is from the device to controller’s local buffer
 CPU moves data from/to memory to/from local
buffers in device controllers
CPU
Device Controller
Status reg
Data reg mechanism
Buffer
Memory
Device
Device
Device
…
I/O
BUS
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 17
Busy/wait output
 Simplest way to program device
 Use instructions to test when device is ready
#define OUT_CHAR 0x1000 // device data register
#define OUT_STATUS 0x1001 // device status register
current_char = mystring;
while (*current_char != ‘0’) {
poke(OUT_CHAR,*current_char);
while (peek(OUT_STATUS) != 0); // busy waiting
current_char++;
}
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 18
Interrupt I/O
 Busy/wait is very inefficient
 CPU can’t do other work while testing device
 Hard to do simultaneous I/O
 Interrupts allow a device to change the flow
of control in the CPU
 Causes subroutine call to handle device
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 19
Interrupt I/O Timeline
 Interrupt time line for I/O on a single process
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 20
Interrupt-Driven I/O
CPU executing checks for
interrupts between instructions
CPU Controller
initiates I/O
2
input ready, output
complete, or error
Generates interrupt signal
3
CPU receiving interrupt,
transfers control to
Interrupt handler
4
interrupt handler
processes data,
returns from interrupt
5
CPU resumes
processing of
interrupted task
6
device driver
initiates I/O
1
7
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 21
Interrupt
 Modern OS are interrupt driven
 The occurrence of an event is signaled by an
interrupt from either hardware or software.
 Hardware may trigger an interrupt at any time by
sending a signal to CPU
 Software may trigger an interrupt either by an
error (division by zero or invalid memory access)
or by a user request for an operating system
service (system call)
 Software interrupt also called trap
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 22
resident monitor
1
an interrupt
from device i
occurs
3
return to
user
user program
d:=3*c
service routine
for device i
2 perform the service
routine for device i
a:=b+c
1
i
2
interrupt
vector
HW Interrupt
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 23
resident monitor
system call n
read
case n
1 2
3
trap to
monitor
perform
I/O
return to
user
user program d:=3*c
SW Interrupt
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 24
Common Functions of Interrupts
 Interrupt transfers control to the interrupt
service routine generally, through the
interrupt vector, which contains the
addresses (function pointer) of all the service
(i.e. interrupt handler) routines
 Interrupt architecture must save the address
of the interrupted instruction
 Incoming interrupts are disabled while
another interrupt is being processed to
prevent a lost interrupt
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 25
Review Slides (2)
 What is interrupt and how does it work?
 What is the difference between trap and
interrupt?
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 26
Storage-Device Hierarchy
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 27
Storage-Device Hierarchy
 Storage systems organized in hierarchy.
 ______,_____,________
 Main memory – only large storage media that the
CPU can access directly
 RAM: Random Access Memory
 Secondary storage – extension of main memory
that provides _____________________ capacity
 Magnetic disk
Speed Cost Volatility
large nonvolatile storage
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 28
RAM: Random-Access Memory
 DRAM (Dynamic RAM):
 Need only one transistor
 Consume less power
 values must be periodically refreshed
 Access Speed: >= 30ns
 SRAM (Static RAM):
 Need six transistors
 Consume more power
 Access Speed: 10ns~30ns
 usage: cache memory
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 29
Disk Mechanism
 Speed of magnetic disk
 Transfer time = data size / transfer rate
 Positioning time (random access time)
seek time (cylinder) + rotational latency (sector)
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 30
Performance of Various Levels of Storage
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 31
Caching
 Information in use copied from slower to faster
storage temporarily
 Faster storage (cache) checked first to determine
if information is there
 If it is, ______________________________________
 If not, ______________________________
information used directly from the cache (fast)
data copied to cache and used there
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 32
Coherency and Consistency Issue
 The same data may appear in different levels
 Issue: ___________________________
___________________________
 Single task accessing:
 No problem, always use the Highest level copy
 Multi-task accessing:
 Need to obtain the
most recent value
 Distributed system:
 Difficult b.c. copies are on different computers
Change the copy in register make
it inconsistent with other copies
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 33
Review Slides (3)
 Why storage hierarchy?
 Caching? involved issues?
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 34
Hardware Protection:
Dual-Mode Operation
I/O Protection
Memory Protection
CPU Protection
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 35
Dual-Mode Operation
 What to protect?
 Sharing system resources requires OS to ensure
that an incorrect program cannot cause other
programs to execute incorrectly
 Provide hardware support to differentiate
between at least two modes of operations
1. User mode – execution done on behalf of a user
2. Monitor mode (also kernel mode or system mode)
– execution done on behalf of operating system
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 36
Dual-Mode Operation (Cont’d)
 Mode bit added to computer hardware to indicate
the current mode: kernel (0) or user (1)
 When an interrupt/trap or fault occurs, hardware
switches to monitor mode
 Privileged instructions
 Executed only in monitor mode
 Requested by users (system calls)
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 37
I/O Protection
 All I/O instructions are privileged instructions
 Any I/O device is shared between users
 Must ensure that a user program could never gain
control of the computer in monitor mode (i.e., a user
program that, as part of its execution, stores a new
address in the interrupt vector)
User code
resident
monitor
system call/
interrupt
user program
interrupt
vector
malicious
program
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 38
Memory Protection
 Protect
 Interrupt vector and the interrupt service routines
 ________________________________________
 HW support: two registers for legal address
determination:
 Base register – holds the smallest legal physical
memory address
 Limit register – contains the size of the range
 Memory outside the defined range is protected
Data access and over-write from other programs
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 39
Use of Base and Limit Register
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 40
Hardware Address Protection
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 41
CPU Protection
 Prevent user program from not returning control
 getting stuck in an infinite loop
 not calling system services
 HW support: Timer—interrupts computer after
specified period
 Timer is decremented every clock tick
 When timer reaches the value 0, an interrupt occurs
 Timer commonly used to implement time sharing
 Load-timer is a privileged instruction
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 42
Review Slides (4)
 Dual-mode Operation?
 CPU protection?
 Memory protection?
Chapter1 introduction Operating System Concepts – NTHU LSA Lab 43
Reading Material & HW
 Chap 1
 Problem set
 1.8: What is the purpose of interrupt? How does an
interrupt differ from trap? Can traps be generated
intentionally by a user program? If so, for what purpose?
 1.10: some computer systems do not provide a privileged
mode of operation in hardware. Is it possible to construct
a secure operating system for these computer systems?
Give arguments both that it is and that it is not possible.
 Why dual mode operation can protect system?

More Related Content

Similar to Chap1_Introduction.pdf

OSLec1&2.ppt
OSLec1&2.pptOSLec1&2.ppt
OSLec1&2.ppt
ssusere16bd9
 
OS UNIT-I Introdution to Operating systems.ppt
OS UNIT-I Introdution to Operating systems.pptOS UNIT-I Introdution to Operating systems.ppt
OS UNIT-I Introdution to Operating systems.ppt
KVBALARAMAKRISHNA
 
Cs8493 unit 1
Cs8493 unit 1Cs8493 unit 1
Cs8493 unit 1
Kathirvel Ayyaswamy
 
Module1
Module1Module1
Module1
dilshad begum
 
Operating system lecture 2. batch system.memory layout
Operating system lecture 2. batch system.memory layoutOperating system lecture 2. batch system.memory layout
Operating system lecture 2. batch system.memory layout
fahim shahzad
 
Operating system (BCS303) MODULE 1 NOTES
Operating system (BCS303) MODULE 1 NOTESOperating system (BCS303) MODULE 1 NOTES
Operating system (BCS303) MODULE 1 NOTES
KopinathMURUGESAN
 
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
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - IntroductionWayne Jones Jnr
 
CH01.pdf
CH01.pdfCH01.pdf
CH01.pdf
ImranKhan880955
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-Basics
Ajit Nayak
 
Operating System and related questions
Operating System and related questionsOperating System and related questions
Operating System and related questions
imdurgesh
 
Operating System-Chap 1-EnglishVersion-20221
Operating System-Chap 1-EnglishVersion-20221Operating System-Chap 1-EnglishVersion-20221
Operating System-Chap 1-EnglishVersion-20221
ChungHong22
 
Operating System-Chap 1-EnglishHust-20231
Operating System-Chap 1-EnglishHust-20231Operating System-Chap 1-EnglishHust-20231
Operating System-Chap 1-EnglishHust-20231
ChungHong22
 
Operating System-Chap 1-EnglishVersion_20231
Operating System-Chap 1-EnglishVersion_20231Operating System-Chap 1-EnglishVersion_20231
Operating System-Chap 1-EnglishVersion_20231
ChungHong22
 
operating system introduction- basics of operating system, definition, meanin...
operating system introduction- basics of operating system, definition, meanin...operating system introduction- basics of operating system, definition, meanin...
operating system introduction- basics of operating system, definition, meanin...
DEVIRAJAM
 
Operating system notes ch1
Operating system notes ch1Operating system notes ch1
Operating system notes ch1
Emmanuel Damka
 
MC 7204 OS Question Bank with Answer
MC 7204 OS Question Bank with AnswerMC 7204 OS Question Bank with Answer
MC 7204 OS Question Bank with Answer
sellappasiva
 
Operting system
Operting systemOperting system
Operting system
KAnurag2
 

Similar to Chap1_Introduction.pdf (20)

OSLec1&2.ppt
OSLec1&2.pptOSLec1&2.ppt
OSLec1&2.ppt
 
OS UNIT-I Introdution to Operating systems.ppt
OS UNIT-I Introdution to Operating systems.pptOS UNIT-I Introdution to Operating systems.ppt
OS UNIT-I Introdution to Operating systems.ppt
 
Cs8493 unit 1
Cs8493 unit 1Cs8493 unit 1
Cs8493 unit 1
 
Module1
Module1Module1
Module1
 
Operating system lecture 2. batch system.memory layout
Operating system lecture 2. batch system.memory layoutOperating system lecture 2. batch system.memory layout
Operating system lecture 2. batch system.memory layout
 
Ch1
Ch1Ch1
Ch1
 
Operating system (BCS303) MODULE 1 NOTES
Operating system (BCS303) MODULE 1 NOTESOperating system (BCS303) MODULE 1 NOTES
Operating system (BCS303) MODULE 1 NOTES
 
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
 
Chapter 1 - Introduction
Chapter 1 - IntroductionChapter 1 - Introduction
Chapter 1 - Introduction
 
CH01.pdf
CH01.pdfCH01.pdf
CH01.pdf
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-Basics
 
Operating System and related questions
Operating System and related questionsOperating System and related questions
Operating System and related questions
 
Operating System-Chap 1-EnglishVersion-20221
Operating System-Chap 1-EnglishVersion-20221Operating System-Chap 1-EnglishVersion-20221
Operating System-Chap 1-EnglishVersion-20221
 
Operating System-Chap 1-EnglishHust-20231
Operating System-Chap 1-EnglishHust-20231Operating System-Chap 1-EnglishHust-20231
Operating System-Chap 1-EnglishHust-20231
 
Operating System-Chap 1-EnglishVersion_20231
Operating System-Chap 1-EnglishVersion_20231Operating System-Chap 1-EnglishVersion_20231
Operating System-Chap 1-EnglishVersion_20231
 
operating system introduction- basics of operating system, definition, meanin...
operating system introduction- basics of operating system, definition, meanin...operating system introduction- basics of operating system, definition, meanin...
operating system introduction- basics of operating system, definition, meanin...
 
Operating system notes ch1
Operating system notes ch1Operating system notes ch1
Operating system notes ch1
 
MC 7204 OS Question Bank with Answer
MC 7204 OS Question Bank with AnswerMC 7204 OS Question Bank with Answer
MC 7204 OS Question Bank with Answer
 
Operting system
Operting systemOperting system
Operting system
 

Recently uploaded

PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
Kamal Acharya
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 

Recently uploaded (20)

PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Water billing management system project report.pdf
Water billing management system project report.pdfWater billing management system project report.pdf
Water billing management system project report.pdf
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 

Chap1_Introduction.pdf

  • 1. Operating System: Chap1 Introduction National Tsing-Hua University 2016, Fall Semester
  • 2. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 2 Outline  What is an Operating System?  Computer-System Organization  HW Protection
  • 3. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 3 What is an Operating System
  • 4. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 4 Computer System  Four components:  User 1 User 2 User 3 User n Application Programs Compiler Assembler Text Editor Browser Operating System Computer Hardware CPU Memory Device _________,_______,__________,______ User Application OS Hardware …..
  • 5. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 5 Computer System  User — people, machines, other computers  Application — define the ways in which the system resources are used to solve the computing problems  Operating System — _______ and __________ the use of the hardware/resources  Hardware — provides basic computing resources (CPU, memory, I/O devices) controls coordinates
  • 6. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 6 What is an Operating System?  An operating system is the “permanent” software that controls/abstracts hardware resources for user applications physical machine interface User Applications Operating System Architecture virtual machine interface
  • 7. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 7 Multi-tasking Operating Systems  Manages resources and processes to support different user applications  Provides Applications Programming Interface (API) for user applications User Application Operating System Architecture User Application
  • 8. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 8 General-Purpose Operating Systems user compiler OS interface OS Hardware User program Executable binary Compiler Linker System library Architecture Device drivers Operating system kernel user mode
  • 9. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 9 Definition of an Operating System  Resource allocator – manages and allocates resources to insure efficiency and fairness  Control program – controls the execution of user programs and operations of I/O devices to prevent errors and improper use of computer  Kernel – the one program running at all times (all else being system/application programs) No universally accepted definition
  • 10. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 10 Goals of an Operating System  Convenience  make computer system easy to use and compute  In particular for small PC  Efficiency  use computer hardware in an efficient manner  Especially for large, shared, multiuser systems Two goals are sometimes contradictory In the past, efficiency is more important
  • 11. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 11 Importance of an Operating System  System API are the only interface between user applications and hardware  API are designed for general-purpose, not performance driven  OS code cannot allow any bug  Any break (e.g. invalid access) causes reboot  The owner of OS technology controls the software & hardware industry  Operating systems and computer architecture influence each other
  • 12. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 12 Modern Operating Systems  x86 platform  Linux (CentOS, Redhat, openSUSE, Ubuntu, etc)  Windows (Windows10, XP, 2000, etc)  PowerPC platform – Mac OS  Smartphone Mobile OS  Android, iOS, Windows10 Mobile, Ubuntu Touch  Embedded OS  Embedded Linux(Andriod, WebOS), Windows CE  Raspberry Pi, Xbox, etc
  • 13. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 13 Review Slides (1)  Definition of OS?  Goals of OS?  Importance of OS?
  • 14. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 14 Computer-System Organization
  • 15. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 15 Computer-System Organization  One or more CPUs, device controllers connect through common bus providing access to shared memory  Goal: __________________________________ ______________________________ Concurrent execution of CPUs and devices competing for memory cycles
  • 16. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 16 Computer-System Operations  Each device controller is in charge of a particular device type  Each device controller has a local buffer  I/O is from the device to controller’s local buffer  CPU moves data from/to memory to/from local buffers in device controllers CPU Device Controller Status reg Data reg mechanism Buffer Memory Device Device Device … I/O BUS
  • 17. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 17 Busy/wait output  Simplest way to program device  Use instructions to test when device is ready #define OUT_CHAR 0x1000 // device data register #define OUT_STATUS 0x1001 // device status register current_char = mystring; while (*current_char != ‘0’) { poke(OUT_CHAR,*current_char); while (peek(OUT_STATUS) != 0); // busy waiting current_char++; }
  • 18. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 18 Interrupt I/O  Busy/wait is very inefficient  CPU can’t do other work while testing device  Hard to do simultaneous I/O  Interrupts allow a device to change the flow of control in the CPU  Causes subroutine call to handle device
  • 19. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 19 Interrupt I/O Timeline  Interrupt time line for I/O on a single process
  • 20. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 20 Interrupt-Driven I/O CPU executing checks for interrupts between instructions CPU Controller initiates I/O 2 input ready, output complete, or error Generates interrupt signal 3 CPU receiving interrupt, transfers control to Interrupt handler 4 interrupt handler processes data, returns from interrupt 5 CPU resumes processing of interrupted task 6 device driver initiates I/O 1 7
  • 21. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 21 Interrupt  Modern OS are interrupt driven  The occurrence of an event is signaled by an interrupt from either hardware or software.  Hardware may trigger an interrupt at any time by sending a signal to CPU  Software may trigger an interrupt either by an error (division by zero or invalid memory access) or by a user request for an operating system service (system call)  Software interrupt also called trap
  • 22. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 22 resident monitor 1 an interrupt from device i occurs 3 return to user user program d:=3*c service routine for device i 2 perform the service routine for device i a:=b+c 1 i 2 interrupt vector HW Interrupt
  • 23. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 23 resident monitor system call n read case n 1 2 3 trap to monitor perform I/O return to user user program d:=3*c SW Interrupt
  • 24. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 24 Common Functions of Interrupts  Interrupt transfers control to the interrupt service routine generally, through the interrupt vector, which contains the addresses (function pointer) of all the service (i.e. interrupt handler) routines  Interrupt architecture must save the address of the interrupted instruction  Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt
  • 25. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 25 Review Slides (2)  What is interrupt and how does it work?  What is the difference between trap and interrupt?
  • 26. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 26 Storage-Device Hierarchy
  • 27. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 27 Storage-Device Hierarchy  Storage systems organized in hierarchy.  ______,_____,________  Main memory – only large storage media that the CPU can access directly  RAM: Random Access Memory  Secondary storage – extension of main memory that provides _____________________ capacity  Magnetic disk Speed Cost Volatility large nonvolatile storage
  • 28. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 28 RAM: Random-Access Memory  DRAM (Dynamic RAM):  Need only one transistor  Consume less power  values must be periodically refreshed  Access Speed: >= 30ns  SRAM (Static RAM):  Need six transistors  Consume more power  Access Speed: 10ns~30ns  usage: cache memory
  • 29. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 29 Disk Mechanism  Speed of magnetic disk  Transfer time = data size / transfer rate  Positioning time (random access time) seek time (cylinder) + rotational latency (sector)
  • 30. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 30 Performance of Various Levels of Storage
  • 31. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 31 Caching  Information in use copied from slower to faster storage temporarily  Faster storage (cache) checked first to determine if information is there  If it is, ______________________________________  If not, ______________________________ information used directly from the cache (fast) data copied to cache and used there
  • 32. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 32 Coherency and Consistency Issue  The same data may appear in different levels  Issue: ___________________________ ___________________________  Single task accessing:  No problem, always use the Highest level copy  Multi-task accessing:  Need to obtain the most recent value  Distributed system:  Difficult b.c. copies are on different computers Change the copy in register make it inconsistent with other copies
  • 33. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 33 Review Slides (3)  Why storage hierarchy?  Caching? involved issues?
  • 34. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 34 Hardware Protection: Dual-Mode Operation I/O Protection Memory Protection CPU Protection
  • 35. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 35 Dual-Mode Operation  What to protect?  Sharing system resources requires OS to ensure that an incorrect program cannot cause other programs to execute incorrectly  Provide hardware support to differentiate between at least two modes of operations 1. User mode – execution done on behalf of a user 2. Monitor mode (also kernel mode or system mode) – execution done on behalf of operating system
  • 36. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 36 Dual-Mode Operation (Cont’d)  Mode bit added to computer hardware to indicate the current mode: kernel (0) or user (1)  When an interrupt/trap or fault occurs, hardware switches to monitor mode  Privileged instructions  Executed only in monitor mode  Requested by users (system calls)
  • 37. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 37 I/O Protection  All I/O instructions are privileged instructions  Any I/O device is shared between users  Must ensure that a user program could never gain control of the computer in monitor mode (i.e., a user program that, as part of its execution, stores a new address in the interrupt vector) User code resident monitor system call/ interrupt user program interrupt vector malicious program
  • 38. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 38 Memory Protection  Protect  Interrupt vector and the interrupt service routines  ________________________________________  HW support: two registers for legal address determination:  Base register – holds the smallest legal physical memory address  Limit register – contains the size of the range  Memory outside the defined range is protected Data access and over-write from other programs
  • 39. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 39 Use of Base and Limit Register
  • 40. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 40 Hardware Address Protection
  • 41. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 41 CPU Protection  Prevent user program from not returning control  getting stuck in an infinite loop  not calling system services  HW support: Timer—interrupts computer after specified period  Timer is decremented every clock tick  When timer reaches the value 0, an interrupt occurs  Timer commonly used to implement time sharing  Load-timer is a privileged instruction
  • 42. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 42 Review Slides (4)  Dual-mode Operation?  CPU protection?  Memory protection?
  • 43. Chapter1 introduction Operating System Concepts – NTHU LSA Lab 43 Reading Material & HW  Chap 1  Problem set  1.8: What is the purpose of interrupt? How does an interrupt differ from trap? Can traps be generated intentionally by a user program? If so, for what purpose?  1.10: some computer systems do not provide a privileged mode of operation in hardware. Is it possible to construct a secure operating system for these computer systems? Give arguments both that it is and that it is not possible.  Why dual mode operation can protect system?