Oslectureset 1 SPR 20
Oslectureset 1 SPR 20
Oslectureset 1 SPR 20
Operating Systems
(Spring 2020)
Teaching Assistants:
Biswadeep Maity (Deep) ([email protected])
Saehanseul Yi (Hans) ([email protected])
Andrew Chio ([email protected])
4
Course logistics and details
● Homeworks and Assignments
● 4 written homeworks in the quarter
● 1 programming assignment (knowledge of C, C++ or Java
required).
● Handed out at midterm; submit during Finals Week
● Multistep assignment – don’t start in last week of classes!!!
● Late homeworks will not be accepted.
● All submissions will be made using Gradescope for the course
● Tests
● Midterm - tentatively Wednesday, Week 6
● Detailed format and tools to be used -- TBD
● Final Exam - as per UCI course catalog
● June 9th (1:30 - 3:30 pm)
● Detailed format and tools to be used -- TBD
Principles of Operating Systems -
Lecture 1 5
ICS 143 Grading Policy
● Homeworks - 40% (10% each)
● Week 9 - FileSystems
• Virtual Memory, FileSystems Interface and Implementation
● Operating System
● Controls and coordinates the use of hardware among application programs.
● Application Programs
● Solve computing problems of users (compilers, database systems, video games,
business programs such as banking software).
● Users
● People, machines, other computers
User
1 User User User
2 3 ... n
Operating System
Computer
Hardware
•Referee
• Resource allocation among users, applications
• Isolation of different users, applications from each other
• Communication between users, applications
•Illusionist
• Each application appears to have the entire machine to itself
• Infinite number of processors, (near) infinite amount of
memory, reliable storage, reliable network transport
•Glue
• Libraries, user interface widgets, …
•Reduces cost of developing software
15
Example: file systems
•Referee
• Prevent users from accessing each other’s files without
permission
•Illusionist
• Files can grow (nearly) arbitrarily large
• Files persist even when the machine crashes in the middle of a
save
•Glue
• Named directories, printf, …
16
Goals of an Operating System
● Simplify the execution of user programs and
make solving user problems easier.
● Use computer hardware efficiently.
● Allow sharing of hardware and software resources.
● Make application software portable and versatile.
● Provide isolation, security and protection among
user programs.
● Improve overall system reliability
● error confinement, fault tolerance, reconfiguration.
Moore’s
Law
$/
23
Software Complexity Increases
● Programming models:
• Tightly coupled vs. loosely coupled ,message-based vs. shared
variable
Principles of Operating Systems -
Lecture 1 37
Parallel Computing Systems
ILLIAC 2 (UIllinois)
Climate modeling,
earthquake
simulations, genome
analysis, protein
folding, nuclear fusion
research, ….. K-computer(Japan)
Tianhe-1(China)
46
Operating systems are
everywhere
47
Info-tainment!!
48
Summary of lecture
● What is an operating system?
● Early Operating Systems
● Simple Batch Systems
● Multiprogrammed Batch Systems
● Time-sharing Systems
● Personal Computer Systems
● Parallel and Distributed Systems
● Real-time Systems
•Storage architecture
•OS organization
•OS tasks
•Virtual Machines
50
Computer System Organization
51
CPU execution
Addr 232-1
R0
…
R31
F0
Fetch …
… Exec Data1
F30
PC Data0
Inst237
Inst236
…
• Execution sequence: Inst5
• Fetch Instruction at PC Inst4
• Decode Inst3 PC
• Execute (possibly using registers) Inst2 PC
• Write results to registers/mem Inst1 PC
• PC = Next Instruction(PC) Inst0 PC
• Repeat
Addr 0
From Berkeley OS course
52
Computer System Organization
I/O devices
53
I/O devices
54
Interrupts
55
Interrupt handling
56
Direct Memory Access (DMA)
57
Process Abstraction
58
Process Abstraction
• Process: an instance of a program, running
with limited rights
59
Process Abstraction and rights
• Process: an instance of a program, running
with limited rights
60
Hardware Protection
•CPU Protection:
• Dual Mode Operation
• Timer interrupts
•Memory Protection
•I/O Protection
61
How to limit process rights?
62
Should a process be able to
execute any instructions?
63
Should a process be able to
execute any instructions?
● No
● Can alter system configuration
● Can access unauthorized memory
● Can access unauthorized I/O
● etc.
● How to prevent?
64
Dual-mode operation
65
Dual-mode operation(cont.)
66
CPU Protection
67
CPU Protection
68
How to isolate memory
access?
69
Process address space
• Address space ⇒ the set of accessible
addresses + state associated with them:
70
Virtual Address
71
Providing the Illusion of Separate Address Spaces
Data 2
Code Code
Data Stack 1
Data
Heap Heap 1
Heap
Stack Code 1
Stack
Stack 2
Proc 1 Proc 2
Data 1
Virtual Virtual
Address Heap 2 Address
Space 1 Space 2
Code 2
kernel code
kernel data
Translation Map 1 Translation Map 2
kernel heap &
Stacks
Valid
Physical
Physical Memory
Data
address
Data
73
Memory Protection
74
Memory Protection: base and limit
0
1024000
• Sometimes called Base and
Bounds method
75
Hardware Address Protection
76
Virtual Address translation using the
Base and Bounds method
77
I/O Protection
78
Question
79
Question
80
System Calls
• User code can issue a syscall, which causes a trap
• Kernel handles the syscall
81
System Calls
• Interface between applications
and the OS.
•Application uses an
assembly instruction to trap into
the kernel
• Some higher level languages
provide wrappers for system
calls (e.g., C)
• System calls pass parameters
between an and OS via registers
or memory, memory tables or
stack.
• Linux has about 300 system
calls
• read(), write(), open(), close(),
fork(), exec(), ioctl(),…..
82
System services or system
programs
83
Command Interpreter System
84
Storage Structure
85
Storage Hierarchy
86
Storage Device Hierarchy
87
OS Task: Process Management
88
OS Task: Memory Management
89
OS Task: Secondary Storage and I/O
Management
90
OS Task: File System Management
91
OS Task: Protection and Security
92
Operating Systems: How are they
organized?
•Simple
• Only one or two levels of code
•Layered
• Lower levels independent of upper levels
•Modular
•Core kernel with Dynamically loadable modules
•Microkernel
• OS built from many user-level processes
93
OS Structure - Simple Approach
94
Original UNIX System Structure
•Limited structuring, has 2 separable parts
• Systems programs
• Kernel
• everything below system call interface and above physical hardware.
• Filesystem, CPU scheduling, memory management
95
Layered OS Structure
96
Monolithic vs. Microkernel OS
•Monolithic OSes have large kernels with a lot of components
• Linux, Windows, Mac
97
A microkernel OS
Physical Machine
Application
OS
Hardware
99
Virtual Machines
OS OS OS
Hardware
100
Virtual Machines
•Use cases
● Resource configuration
● Running multiple OSes, either the same or different
OSes
● Run existing OS binaries on different architecture
101
Summary of Lecture set 1
102