Learning Outcomes: Chapter 1 - 1.3 Chapter 1.5 - 1.9
Learning Outcomes: Chapter 1 - 1.3 Chapter 1.5 - 1.9
Learning Outcomes: Chapter 1 - 1.3 Chapter 1.5 - 1.9
What is an Operating
System?
3 4
5 6
1
Viewing the Operating System Traditional View: the Operating
as a Resource Manager System as the Privileged Component
• Responsible for allocating resources to users
and processes Applications Applications Applications
• Must ensure User Mode Requests (System Calls)
– No Starvation
Privileged Mode
– Progress
– Allocation is according to some desired policy Operating System
• First-come, first-served; Fair share; Weighted fair share;
limits (quotas), etc;
– Overall, that the system is efficiently used Hardware
7 8
11 12
2
Structure of a Computer System Structure of a Computer System
Device OS Device
OS
Device Device
Memory Memory
13 14
15 16
3
Services Provided by the
Operating System Software
Operating System
• Fundamentally, OS functions the
• Accounting same way as ordinary computer Application
19 20
Major OS Concepts
Processes
(Overview) • A program in execution
• Processes • An instance of a program running on a computer
• The entity that can be assigned to and executed on a
• Concurrency and deadlocks processor
• Memory management • A unit of resource ownership
• Files
• Scheduling and resource management
• Information Security and Protection
21 22
Memory
• Consist of three Process Process
segments Stack
– Text
• contains the code
• Consists of three components
(instructions) – An executable program
– Data
• Global variables
Gap • text
– Stack – Associated data needed by the program
• Activation records of • Data and stack
procedure
• Local variables Data – Execution context of the program
• Note: • All information the operating system needs to
– data can dynamically grow
Text manage the process
up – Registers, program counter, stack pointer, etc;
– The stack can dynamically
grow down
23 24
4
Multiple processes creates
concurrency issues Memory Management
• The view from thirty thousand feet
– Process isolation
• Prevent processes from accessing each others data
– Automatic allocation and management
• Don’t want users to deal with physical memory directly
– Protection and access control
• Still want controlled sharing
– Long-term storage
– OS services
• Virtual memory
• File system
29 30
5
Information Protection and Scheduling and Resource
Security Management
• Access control • Fairness
– regulate user access to the system – give equal and fair access to all processes
– Involves authentication • Differential responsiveness
• Information flow control – discriminate between different classes of jobs
– regulate flow of data within the system and • Efficiency
its delivery to users
– maximize throughput, minimize response time,
and accommodate as many uses as possible
31 32
33 34
6
The Monolithic Operating
System Structure
• However, some
reasonable structure
usually prevails
Computer Hardware
Review
Chapter 1.4
Bowman, I. T., Holt, R. C., and Brewster, N. V. 1999. Linux as a case study: its extracted
software architecture. In Proceedings of the 21st international Conference on Software
Engineering (Los Angeles, California, United States, May 16 - 22, 1999). ICSE '99. ACM, 37
New York, NY, 555-563. DOI= http://doi.acm.org/10.1145/302405.302691
41 42
7
The real world is logically similar,
but more complex
A Simple Model of CPU
Computation
• The fetch-execute cycle
43 44
45 46
8
Privileged-mode Operation I/O and Interrupts
Memory Address Space • I/O events (keyboard, mouse, incoming network
packets) happen at unpredictable times
• The accessibility of 0xFFFFFFFF • How does the CPU know when to service an I/O
Accessible only
addresses within an to event?
address space Kernel-mode
changes depending 0x80000000
on operating mode
– To protect kernel code Accessible to
User- and
and data
Kernel-mode
0x00000000
49 50
51 52
9
Memory Hierarchy
Simple Interrupt • Going down the
hierarchy
Application – Decreasing cost per
User Mode
bit
– Increasing capacity
– Increasing access
time
– Decreasing
Kernel Mode frequency of access
to the memory by the
processor
Interrupt • Hopefully
Handler • Principle of locality!!!!!
55 56
Cache
Memory Hierarchy Word Transfer Block Transfer
CPU
• Rough (somewhat dated) approximation of Registers
Cache Main Memory
memory hierarchy
• Cache is fast memory placed between the CPU and main memory
– 1 to a few cycles access time compared to RAM access time of tens –
hundreds of cycles
• Holds recently used data or instructions to save memory accesses.
• Matches slow RAM access time to CPU speed if high hit rate
• Is hardware maintained and (mostly) transparent to software
• Sizes range from few kB to several MB.
• Usually a hierarchy of caches (2–5 levels), on- and off-chip.
• Block transfers can achieve higher transfer bandwidth than single
words.
– Also assumes probability of using newly fetch data is higher than the
probability of reuse ejected data.
57 58
10
A Strategy: Avoid Waiting for Two-level Memories and Hit
Disk Access Rates
• Keep a subset of the disk’s data in • Given a two-level memory,
memory – cache memory and main memory (RAM)
⇒ Main memory acts as a cache of disk – main memory and disk
contents what is the effective access time?
11