0% found this document useful (0 votes)
5 views38 pages

OS - C1 - Introduction To OS

This document is an introductory chapter on Operating Systems (OS) from a university course, detailing the definition, roles, and classifications of OS. It covers main components such as process management, memory management, file management, and I/O management, as well as various OS structures like monolithic, layered, and microkernel. The chapter also includes references for further reading on operating system concepts.

Uploaded by

hoanght1012
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)
5 views38 pages

OS - C1 - Introduction To OS

This document is an introductory chapter on Operating Systems (OS) from a university course, detailing the definition, roles, and classifications of OS. It covers main components such as process management, memory management, file management, and I/O management, as well as various OS structures like monolithic, layered, and microkernel. The chapter also includes references for further reading on operating system concepts.

Uploaded by

hoanght1012
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/ 38

UNIVERSITY OF SCIENCE, VNUHCM

FAC U LT Y O F I N F O R M AT I O N T E C H N O L O G Y

CSC10007 - OPERATING SYSTEM

Chapter 1

Introduction to OS
Instr uctor : VU THI MY HANG, Ph.D.
TA / La b : LE QUOC H OA , M. S c .

HCM, 2024
Plan

• OS: WHAT and WHY?


• Classification
• Main components
• OS Structure

OPERATING SYSTEM 2
Plan

• OS: WHAT and WHY?


• Classification
• Main components
• OS Structure

OPERATING SYSTEM 3
WHAT and WHY?

Operating System Definition

Windows Linux Ubuntu Mac OS/iOS Android

A system program (Phần mềm hệ thống)


• Provides an easy way to execute application programs, i.e.,
user programs solving user problems (e.g., word processor,
web browser)
(Phần mềm ứng dụng)
• Acts as an interface between application programs and
computer hardware (e.g., CPU, memory, I/O devices)
OPERATING SYSTEM 4
WHAT and WHY?

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?

Role of an Operating System


Virtual machine (user view) (Giả lập máy tính mở rộng/máy tính ảo)
• 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?

Role of an Operating System


Resource manager/allocator (system view) (Quản lý tài nguyên)
• 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?

Role of an Operating System


(Hỗ trợ giao tiếp với máy tính thông qua các lời gọi hệ thống)
Set of utilities, i.e. system calls (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

• OS: WHAT and WHY?


• Classification
• Main components
• OS Structure

OPERATING SYSTEM 9
Classification

Batch OS (HỆ ĐIỀU HÀNH XỬ LÝ THEO LÔ)


• 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 10
Classification

Multiprogramming OS (HỆ ĐIỀU HÀNH ĐA CHƯƠNG)


• 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 11
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 12
Classification

Timesharing OS (Multitasking OS)


(HỆ ĐIỀU HÀNH CHIA SẺ THỜI GIAN / ĐA NHIỆM)
• 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 13
Classification

Parallel OS (Multiprocessing OS)


(HỆ ĐIỀU HÀNH SONG SONG / ĐA XỬ LÝ)
• Runs 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 14
Classification

Distributed OS (HỆ ĐIỀU HÀNH PHÂN TÁN)

• Consists of independent systems linked via network


• Need for a distributed OS
ü Resource sharing
ü Job collaboration
ü Computing power increase

OPERATING SYSTEM 15
Classification

Real-time OS (RTOS) (HỆ ĐIỀU HÀNH XỬ LÝ THỜI GIAN THỰC)


• 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 16
Classification

Embedded OS (HỆ ĐIỀU HÀNH NHÚNG)


• 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 17
Plan

• OS: WHAT and WHY?


• Classification
• Main components
• OS Structure

OPERATING SYSTEM 18
Main components (QUẢN LÝ TIẾN TRÌNH VÀ TIỂU TRÌNH/LUỒNG)

Process (and Thread) Management


• Process and Thread operations (e.g., create, destroy)
ü Process: a program in execution (Tiến trình)
ü Thread: a lightweight process, supported in most modern OS (Tiểu trình/Luồng)

• Interprocess Communication (IPC) (Cơ chế liên lạc)


ü For exchanging data or collaborating to solve a task ...
• CPU Scheduling (Điều phối CPU)
ü How to allocate CPU among many processes fairly and efficiently?
• Synchronization (Đồng bộ hoá)
ü What if various processes access a common resource at the same time?

OPERATING SYSTEM 19
Main components (QUẢN LÝ BỘ NHỚ)

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 20
Main components (QUẢN LÝ TẬP TIN VÀ Ổ ĐĨA)

File & Disk 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 21
Main components (QUẢN LÝ HỆ THỐNG NHẬP/XUẤT)

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 22
Main components

System Call (LỜI GỌI HỆ THỐNG)


(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 23
Main components

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

KERNEL
(NHÂN HỆ ĐIỀU HÀNH)

Kernel
mode Device drivers

Computer hardware OPERATING SYSTEM 24


Main components

System Call

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

OPERATING SYSTEM 25
Main components

SHELL or Command Interpreter (HỆ THỐNG CƠ CHẾ DÒNG LỆNH)


• Text-based interface for interacting with the operating system.

OPERATING SYSTEM 26
Main components (HỆ THỐNG BẢO VỆ VÀ BẢO MẬT)

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).

i n g
e a rn
-l
S e lf

OPERATING SYSTEM 27
Plan

• OS: WHAT and WHY?


• Classification
• Main components
• OS Structure

OPERATING SYSTEM 28
OS structure (KIẾN TRÚC ĐƠN GIẢN)

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 (KIẾN TRÚC MỘT KHỐI)

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 (KIẾN TRÚC PHÂN TẦNG)

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

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 32
OS structure (VI NHÂN)

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
Program
File
System
Device
Driver
user
User
mode

L Performance problem occasionally


messages messages

Interprocess memory
managment
CPU
scheduling
Kernel
kernel
Communication mode

microkernel

hardware

OPERATING SYSTEM 33
OS structure (KIẾN TRÚC LAI)

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


OS structure

And other ...

36
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 37
Topic 1

You might also like