Operating Systems
Chapter 1 Fundamentals
Tien Pham Van, Dr. rer. nat.
Compiled with reference to other presentations
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 1
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Introduction
• A computer system consists of
– hardware
– system programs
– application programs
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 2
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Operating System
• A program that controls the
execution of application programs
• An interface between applications
and hardware
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 3
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
What is an Operating System
• It is an extended machine
– Hides the messy details which must be performed
– Presents user with a virtual machine, easier to use
• It is a resource manager
– Each program gets time with the resource
– Each program gets space on the resource
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 4
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Performance Criteria
• Convenience
– Makes the computer more convenient to use
• Efficiency
– Allows computer system resources to be used in
an efficient manner
• Ability to evolve
– Permit effective development, testing, and
introduction of new system functions without
interfering with service
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 5
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
History of Operating Systems (1/3)
• 1940s–1950s: No OS (Manual Operation)
– Programs loaded manually using switches or
punch cards
– One job at a time
– No abstraction or automation
• 1960s: Batch Systems
– Jobs grouped and executed sequentially
– Introduction of resident monitors
– Early mainframe operating systems (IBM OS/360)
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 6
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
History of Operating Systems (2/3)
• 1970s: Multiprogramming & Time-Sharing
– Multiple users interact simultaneously
– CPU scheduling introduced
– UNIX (1969–1973) → portability, C language
• 1980s: Personal Computer Era
– MS-DOS, Mac OS
– Graphical User Interfaces (GUI)
– Single-user systems become widespread
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 7
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
History of Operating Systems (3/3)
• 1990s: Networked & Distributed Systems
– Windows NT, Linux
– Client–server computing
– Internet-driven OS evolution
• 2000s–Present: Mobile, Virtualization & Cloud
– Android, iOS
– Hypervisors & virtual machines
– Cloud computing & containerization
– Focus on security, scalability, and energy efficiency
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 8
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Why study operating systems?
• Operating systems are a mature field
– Most people use a handful of mature Oses
– Hard to get people to switch operating systems
– Hard to have impact with a new OS
• Still open questions in operating systems
– Security– Hard to achieve security without a solid foundation
– Scalability– How to adapt concepts when hardware scales 10×
• High-performance servers are an OS issue
– Face many of the same issues as OSes, sometimes bypass OS
• Resource consumption is an OS issue
– Battery life, radio spectrum, etc.
• New “smart” devices need new OSes
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 9
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Modern OS
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 10
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
The Operating System family
• Mainframe operating
systems
• Server operating systems
• Distributed operating
systems
• Personal computer operating
systems
• Real-time operating systems
• Embedded operating systems
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 11
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Popular OSs
• [Link]
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 12
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Layers of Computer System
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 13
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Services Provided by the Operating System (1/3)
• Program development
– Editors and debuggers
• Program execution
• Access to I/O devices
• Controlled access to files
• System access
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 14
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Services Provided by the Operating System (2/3)
• Error detection and response
– Internal and external hardware errors
• Memory error
• Device failure
– Software errors
• Arithmetic overflow
• Access forbidden memory locations
– Operating system cannot grant request of
application
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 15
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Services Provided by the Operating System (3/3)
• Accounting
– Collect usage statistics
– Monitor performance
– Used to anticipate future enhancements
– Used for billing purposes
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 16
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Computers under OS’s control
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam 17
Tel: +84-243-8693596
Kernel
• Portion of operating system that is in main
memory
• Contains most frequently used functions
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 18
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Kernel vs. User
• [Link]
_9HRs
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 19
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Uniprogramming
• Processor must wait for I/O instruction to
complete before preceding
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 20
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Multiprogramming
• When one job needs to wait for I/O, the processor
can switch to the other job
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 21
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Timing
Prevents a job from monopolizing the system
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 22
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Utilization Histograms
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 23
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
I/O Devices Slow
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 24
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Multitasking
• Idea:
– More than one process can be running at once
– When one process blocks (waiting for disk, network, user
input, etc.) run another process
• Problem:
– What can ill-behaved process do?
– Go into infinite loop and never relinquish CPU- Scribble
over other processes’ memory to make them fail
• OS provides mechanisms to address these problems
– Preemption–take CPU away from looping process
– Memory protection–protect processes’ memory from one
another
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 25
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Key Elements of Operating System
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 26
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Protection
• User program executes in user mode
– Certain instructions may not be executed
• Monitor executes in system mode
– Kernel mode
– Privileged instructions are executed
– Protected areas of memory may be accessed
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 27
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Memory protection
Do not allow the memory area containing the monitor
to be altered
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 28
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Scheduling and Resource Management
• Fairness
– Give equal and fair access to resources
• Differential responsiveness
– Discriminate among different classes of jobs
• Efficiency
– Maximize throughput, minimize response time,
and accommodate as many uses as possible
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 29
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Processes (1/2)
• A program in execution
• An instance of a program
running on a computer
• The entity that can be
assigned to and executed on
a processor
• A unit of activity
characterized by a single
sequential thread of
execution, a current state,
and an associated set of
system resources
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 30
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596
Process (2/2)
• Consists of three components
– An executable program
– Associated data needed by the program
– Execution context of the program
• All information the operating system needs to manage
the process
Embedded Networking Lab School of Electrical and Electronic Engineering - Hanoi University of Science and Technology 31
tien.phamvan1@[Link] C7-E715, Dai Co Viet str. 1, Bach Mai, Hanoi, Vietnam Tel: +84-243-8693596