0% found this document useful (0 votes)
39 views37 pages

OS - C1 - Introduction To OS

The document discusses the main components of an operating system including process management, memory management, file management, and more. It begins with defining what an operating system is and its roles in providing an interface between hardware and software. It then covers system calls, different classifications of operating systems such as batch, timesharing, and real-time operating systems, and finally discusses the key components that an operating system manages like processes, memory, files, and CPU scheduling.

Uploaded by

21522924
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views37 pages

OS - C1 - Introduction To OS

The document discusses the main components of an operating system including process management, memory management, file management, and more. It begins with defining what an operating system is and its roles in providing an interface between hardware and software. It then covers system calls, different classifications of operating systems such as batch, timesharing, and real-time operating systems, and finally discusses the key components that an operating system manages like processes, memory, files, and CPU scheduling.

Uploaded by

21522924
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

HCMUS - FIT

Introduction to
Operating System
Lecturer: VU THI MY HANG

OPERATING SYSTEM
Plan

• WHAT and WHY an Operating System?


• System Calls
• Classification
• Main components
• OS Structure

OPERATING SYSTEM 2
Plan

• WHAT and WHY an Operating System?


• System Calls
• Classification
• Main components
• OS Structure

OPERATING SYSTEM 3
WHAT and WHY an Operating System?

Operating System Definition

Windows Linux Ubuntu Mac OS/iOS Android

A system program
• Provides an easy way to execute application programs, i.e.,
user programs solving user problems (e.g., word processor,
web browser)
• Acts as an interface between application programs and
computer hardware (e.g., CPU, memory, I/O devices)
OPERATING SYSTEM 4
WHAT and WHY an Operating System?

Computer System Overview


user
1
user
2
user
3
… user
n

compiler assembler text editor … database


system
system and application programs

operating system

computer hardware

OPERATING SYSTEM 5
WHAT and WHY an Operating System?

Role of an Operating System


Virtual machine (user view)
• Provides a uniform abstraction of computer hardware
• Provides abstract concepts (e.g. file) for using computers easier
ü What if users open myfile.docx?

OPERATING SYSTEM 6
WHAT and WHY an Operating System?

Role of an Operating System


Resource manager/allocator (system view)
• Manages resources (CPU, memory, ...) among various
programs in a fair, efficient, and safe manner
ü Allocation/Desallocation
ü Sharing
ü Protection CPU Memory
Printer
...

OPERATING SYSTEM 7
WHAT and WHY an Operating System?

Role of an Operating System


Set of utilities, i.e. system functions (programmer view)
• Facilitates and simplifies application programming
ü Write a program to read files from disk?

Read file
“abc.txt”
working with
working with files track, sector, etc.
OS

OPERATING SYSTEM 8
Plan

• WHAT and WHY an Operating System?


• System Calls
• Classification
• Main components
• OS Structure

OPERATING SYSTEM 9
System Calls

System Call Definition


(System) Programming Interface
• Provided by OS to facilitate application programming
ü Win32 API for Windows
ü POSIX API for UNIX, Linux, and Mac OS
ü Java API for JVM
• Mostly called by programs via Application Programming
Interface (API), i.e., utilities provided by programming
language

OPERATING SYSTEM 10
System Calls

User mode vs. Kernel mode


User
Application programs
mode Mode transition made via a
system call
System Call Interface

KERNEL

Kernel
mode Device controllers

Computer hardware OPERATING SYSTEM 11


System Calls

System Call Examples

C program calls “printf” function, which Windows and Unix System Calls
invokes “write” system call

OPERATING SYSTEM 12
Plan

• WHAT and WHY an Operating System?


• System Calls
• Classification
• Main components
• OS Structure

OPERATING SYSTEM 13
Classification

Batch OS
• A job/program (i.e., set of instructions, data)
ü Stored on punched cards, which are read by card readers
• A batch (i.e., set of similar jobs)
ü Executed one by one without user interaction directly
L CPU is idle while the current job is waiting for I/O to complete
L Lack of user interaction
Batch 1 Batch 2
Job1 Job3
Job2 Job4

Punched card Batch processing


OPERATING SYSTEM 14
Classification

Multiprogramming OS
• Multiple programs are kept in memory simultaneously
• While the current program is waiting for an I/O operation,
the CPU switches to another
J Maximize CPU utilization
L CPU scheduling?
OS
L Memory protection?
P1 Memory
partitions
P2

OPERATING SYSTEM 15
Classification

Multiprogramming OS
Batch system vs. Multiprogramming system

Batch
CPU P1 Idle P1 P2 Idle P2

I/O P1 P2

Multiprogramming
CPU P1 P2 P1 P2

I/O P1 P2

OPERATING SYSTEM 16
Classification

Timesharing OS (Multitasking OS)


• An extension of the multiprogramming system
• Switches CPU among various programs
ü Each program utilizes CPU ... P1
in a short quantum of time (time slice)
• Requires direct interaction users/systems
P3 P2
J Quick response to users
ü Fast enough to give an illusion of pseudo-parallelism
L More complex CPU scheduling

OPERATING SYSTEM 17
Classification

Parallel OS (Multiprocessing OS)


• Mostly run on multiprocessor computers with shared memory
• Divides a program into multiple activities/jobs which could
be executed on different CPUs simultaneously to speed up the
execution
J Computing power increase
P1 A B A B
J Reliability
L Support of hardware and system architecture?
L Parallel computing techniques?

OPERATING SYSTEM 18
Classification

Real-time OS (RTOS)
• Tasks must complete within time constraint
• Hard real-time system: time constraint must be respected
ü Time delay causes system failure (i.e., tasks MUST be done on time or fail)
ü E.g., industrial control systems, traffic control system
• Soft real-time system
• Time delay accepted occasionally
• E.g., multimedia system
L Limited – Complex - Expensive

OPERATING SYSTEM 19
Classification

Distributed OS
• Consists of independent systems linked via network
• Need for a distributed OS
ü Resource sharing
ü Job collaboration
ü Computing power increase

OPERATING SYSTEM 20
Classification

Embedded OS
• Installed on phones, PDAs, and other devices (not a computer)
• Designed for specific purpose
• May or may not have user interface
L Limited resources (low CPU, small memory, no disk, ...)
L Complex algorithm

Smartphone Smartwatch Vacuum-cleaning robot iPod


OPERATING SYSTEM 21
Plan

• WHAT and WHY an Operating System?


• System Calls
• Classification
• Main components
• OS Structure

OPERATING SYSTEM 22
Main components

Process (and Thread) Management


• Process and Thread operations (e.g., create, destroy)
ü Process: a program in execution
ü Thread: a lightweight process, supported in most modern OS
• Interprocess Communication (IPC)
ü For exchanging data or collaborating to solve a task ...
• CPU Scheduling
ü How to allocate CPU among many processes fairly and efficiently?
• Synchronization
ü What if various processes access a common resource at the same time?

OPERATING SYSTEM 23
Main components

Memory Management
• In a multiprogramming system, many programs to be executed
(i.e., process) are resident in memory simultaneously.
• OS deals with:
ü Memory allocation, deallocation, and protection (against invalid access)
ü Virtual memory management
o To have more space ...
o Programs loaded into memory partially ...

OPERATING SYSTEM 24
Main components

File Management
• A file is an abstract concept provided by OS to store collection of
data on disk
• OS deals with:
ü File organization
ü File allocation/deallocation
ü File storage on disk

OPERATING SYSTEM 25
Main components

I/O Management
• OS acts as an intermediary between I/O request and physical
devices (e.g., mouse, keyboard, screen, printer)
• OS deals with:
ü I/O hardware communication (e.g., device controller, DMA, polling,
interrupt I/O)
ü I/O software, which allows accessing and managing I/O operations (e.g.,
device driver, interrupt handler)

OPERATING SYSTEM 26
Main components

Protection and Security


• Computer resources (e.g., files, software, hardware) must be
protected against insecure access.
ü Users/programs must have the right to manipulate system objects (e.g., files)
or system components (software, hardware).

ing
ar n
lf-le
Se

OPERATING SYSTEM 27
Plan

• WHAT and WHY an Operating System?


• System Calls
• Classification
• Main components
• OS Structure

OPERATING SYSTEM 28
OS structure

Simple structure
• OS components are not well separated (e.g., MS-DOS)
• Application programs can access computer hardware directly
J Simple and easy to extend
L Vulnerable
ü What if an application program fails?

OPERATING SYSTEM 29
OS structure

Monolithic structure
• OS components are combined into one single module (e.g.,
traditional UNIX systems)
• Each procedure (function) can call any other procedures
J Simple and fast
L Difficult to implement and maintain
User

Kernel

OPERATING SYSTEM 30
OS structure

Layered structure
• OS components are structured into layers (e.g., MULTICS)
• Each layer uses services (operations, functions) prepared by its
lower adjacent layer
ü layer N calls services defined in layer N-1
J Easier to implement and maintain than monolithic structure
L How to group services into layers? based on
functionality?
L When invoking a system call, a user program
may need to pass through many layers
à efficiency?
OPERATING SYSTEM 31
OS structure

Microkernel structure
• Kernel only stores essential components of OS (e.g., Mach)
• Other components are implemented as user programs
J Easy to manage, extend and build new architecture
J Security and Reliability Application File Device user
Program System Driver User
mode

L Performance problem occasionally


messages messages

Interprocess memory
managment
CPU
scheduling
Kernel
kernel
Communication mode

microkernel

hardware

OPERATING SYSTEM 32
OS structure

Module structure
• A system consists of core kernel and additional services
implemented as modules linked dynamically (e.g., Solaris)
J Easier to add new service than modify the kernel
J Security
L Not a clear design

OPERATING SYSTEM 33
OS structure

Hybrid structure
• A combination of various structures to address performance,
security and usability
• Common design in many modern OS (e.g., Linux, Mac OS X,
Windows, Android)

Hybrid system (Mac OS X) OPERATING SYSTEM 34


OS structure

And other ... Client-Server

Virtual machine Exokernel 35


References

Operating System Concepts (8th Edition), Silberschatz and Galvin


Modern Operating Systems (4th Edition), Andrew S. Tanenbaum
Giáo trình Hệ điều hành, HCMUS-FIT

OPERATING SYSTEM 36
Topic 1

You might also like