0% found this document useful (0 votes)
24 views

OS - Chap 1 - Eng - 2023

Uploaded by

chau.pm020902
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)
24 views

OS - Chap 1 - Eng - 2023

Uploaded by

chau.pm020902
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/ 151

Operating Systems

(Principles of Operating Systems)

Đỗ Quốc Huy
[email protected]
Department of Computer Science
School of Information and Communication Technology
Course Info

Prerequisite:
• Introduction to information technology, Data structure
and algorithm
• C programming skill
Course Info
Objectives:
• Know clearly the components of a computer system,
problems and solutions in the history of computing system
development
• Master the algorithms used in the OS, be able to evaluate
algorithms, as well as be able to apply them to solve real-
life problems
• Understand basic Oss 'services (related to processes, threads,
network, memory, directories, files)
• Grasp knowledge of data structures used in OS, improve
concurrency programming capabilities, and system-level
programming
Course Outline

Chapters:
1.Introduction (2.5 weeks)
2.Process Management (5.5 weeks)
3.Memory Management (3 weeks)
4.Files Systems (2 weeks)
5.IO Management (1 week)

Group Projects
Course Info

Text book:
• Operating System Concepts – Abraham Siblerschatz
• Modern Operating System – Andrew Tanenbaum
• Bài giảng Hệ Điều Hành – Nguyễn Thanh Tùng
• Nguyên lý Hệ Điều Hành – Đỗ Văn Uy
• Others universities’ textbook
Class Expectations
Lectures
– Come! Cannot guarantee content will be identical to previous years.
– Meet your fellow students, they are your future teammate or
colleagues!
– Electronic devices used only for note taking.
Exams
– Attendance mandatory
Communication Policy
-Communicate with lecturer, classmate through Teams rather than
email
Chapter 1 Operating System
Overview

① Definition of operating system


② History of operating Systems
③ Definition and Classifications
④ Notions in operating systems
⑤ Operating System structures
⑥ Basic Properties of Operating Systems
⑦ Principles of Operating Systems
Chapter 1 Operating System
Overview

① Operating system concept


② History of Operating Systems
③ Definition and Classifications
④ Basic Properties of Operating Systems
⑤ Notions in operating systems
⑥ Operating System structures
⑦ Principles of Operating Systems
Chapter 1. Operating System Overview
1. Definition of operating system

① Definition of operating system


⚫Layered structure of a computing system
⚫Operating system’s functions
Chapter 1. Operating System Overview
1. Definition of operating system
1.1. Layered structure of a computing system

A computer system’s structure


Chapter 1. Operating System Overview
1. Definition of operating system
1.1. Layered structure of a computing system

A computer system’s structure


Input Output
Memory
System

Bus

Processor

• One/ many CPUs, controlling devices are linked by a common bus system to
access a shared memory.
• Controlling devices and CPU operate simultaneously and compete with each
other.
Chapter 1. Operating System Overview
1. Definition of operating system
1.1. Layered structure of a computing system

A computer system’s components (Silberschatz 2002)


Chapter 1. Operating System Overview
1. Definition of operating system
1.1. Layered structure of a computing system

A computer system’s components (Tanenbaum 2001)


Chapter 1. Operating System Overview
1. Definition of operating system
1.1. Layered structure of a computing system

A computing system’s components


1. Hardware – provides basic computing resources (CPU,
memory, I/O devices).
2. Operating system – controls and coordinates the use of
the hardware among the various application programs for the
various users.
3. Applications programs – define the ways in which the
system resources are used to solve the computing problems
of the users (compilers, database systems, video games,
business programs).
4. Users (people, machines, other computers).
Chapter 1. Operating System Overview
1. Definition of operating system
1.1. Layered structure of a computing system

Objectives
• Operating system lies between the system’s hardware and user’s
program

• Objectives: To provide an environment which helps user run application


program and use the computer system easier, more conveniently and
effectively.
• Standardize the user interface for different hardware systems
• Utilize hardware’s resource effectively and exploit the hardware’s
performance optimally.
Chapter 1. Operating System Overview
1. Definition of operating system

① Definition of operating system


• Layered structure of a computing system
• Operating system’s functions
Chapter 1. Operating System Overview
1. Definition of operating system
1.2. Operating system’s functions

① Simulate a virtual computer machine

② Manage system resources


Chapter 1. Operating System Overview
1. Definition of operating system
1.2. Operating system’s functions

Simulate a virtual computer machine

Help hide detailed works and exploit computer hardware’s functions


easier and more effectively.
• Simplify programming problem
• No need to work with binary sequences
• Each program thinks that it own the whole computer’s
memory, CPU time, devices...
• Help communicating with devices easier than with original
device. Ex: Ethernet card: Reliable communication, ordered
(TCP/IP)
Chapter 1. Operating System Overview
1. Definition of operating system
1.2. Operating system’s functions

Simulate a virtual computer


machine

• Extend the system’s abilities: The system seem to have desired


resources (virtual memory, virtual printer...)

• Help programs not violating each other → a program which does not
work would not damage the whole system

• Useful for OS’s development


• If experimental OS get errors, only limited in the virtual machine
• Help verifying other programs in the OS
Chapter 1. Operating System Overview
1. Definition of operating system
1.2. Operating system’s functions

Simulate a virtual computer machine


Non virtual machine With virtual machine
Chapter 1. Operating System Overview
1. Definition of operating system
1.2. Operating system’s functions

System’s resources management

• System’s resources (CPU, memory, IO devices, files...) are utilized


by program to perform a determined task.

• Programs require resources: time (CPU-usage) and space (memory)

• The OS has to manage the resource so that the computer can work in
the most effective way.
Chapter 1. Operating System Overview
1. Definition of operating system
1.2. Operating system’s functions

System’s resources management (cont.)


• The OS has to manage the resource so that the computer can work
in the most effective way.
• Provide resource for program when it’s necessary.
• Handle competition
• Decide the order of resource providing for the programs’
requirements
• Example: memory resource management (limited)
• Many program can operate at the same time.
• Avoid illegal access
• Data protection (memory sharing: file)
Chapter 1 Operating System
Overview

① Operating system Definition


② History of Operating Systems
③ Definition and Classifications
④ Notions in operating systems
⑤ Operating System structures
⑥ Basic Properties of Operating Systems
⑦ Principles of Operating Systems
Chapter 1. Operating System Overview
2.History of Operating Systems

Operating systems development’s history

⚫History of electronic computer


⚫Operating systems development’s history
Chapter 1. Operating System Overview
2.History of Operating Systems
2.1. History of electronic computer

Development history of electronic computers


• 1936 - A. Turing & Church present logic computing model and prove
the existence of a computer: Turing machine

• Model of a character processing


device; Simple but able to perform all
the computer’s algorithm
• A Turing machine that is able to
simulate any other Turing machine ->
a universal Turing machine
• Turing is considered as the father of
computer science and artificial
intelligence
Chapter 1. Operating System Overview
2.History of Operating Systems
2.1. History of electronic computer

Development history of electronic computers


• 1941- Konrad Zuse (German) Constructed world's first
programmable computer; the functional program-controlled Turing-
complete Z3
• Z3: use binary system
• Has separated memory
and controller
• Mechanical technique
Chapter 1. Operating System Overview
2.History of Operating Systems
2.1. History of electronic computer

Development history of electronic computers


⚫ 1946 ENIAC based on electric bulbs

• 18000 vacuum tube


• 70000 resistance
• 5 million metal
connector
• Faster but least
reliable
Chapter 1. Operating System Overview
2.History of Operating Systems
2.1. History of electronic computer

Development history of electronic computers


• 1950-1958 Transistor
• 1959-1963 Semiconductor

• 1964-1974 Integrated Circuit (IC)


Chapter 1. Operating System Overview
2.History of Operating Systems
2.1. History of electronic computer

Development history of electronic computers


⚫ 1974-1990 Large scale IC:
Allow CPU, main memory or similar device to be produced in
a single integrated circuit
→new class of smaller, cheaper computer and parallel processor
with multi CPUs
• 1990-now Very large scale IC, smart IC
Chapter 1. Operating System Overview
2.History of Operating Systems

Operating systems development’s history

• History of electronic computer


• Operating systems development’s history
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

view of change

• 1948-1970 : Hardware expensive; human labor cheap


• 1970-1981 : Hardware cheap; human labor expensive
• 1981- : Hardware very cheap; human labor very
expensive
• 1981- : Distributed system
• 1995- : Mobile devices
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

1948-1970 :Hardware expensive; human labor cheap

• Computer 1-5 M$ : Nation ‘s property, mainly used for


military’s purposes ⇒ Require optimization for using hardware
effectively

• Lack of human-machine interact

• User, programmer; operator are same group of people

• 1 user at a single time


Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

1948-1970 :Hardware expensive; human labor cheap


• User wrote program on punched cards
• First card is bootstraps loader is loaded into memory and executed
• Instructions in bootstraps loader fetch into memory and execute
instructions on other later cards (application program)
• Check light bulb for results, debug

• Debugging is difficult
• Waste processor time
• Solution: batch processing
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Batch processing and professional operator


• Programmer give program to operator
• Operator groups program into a single pack (batch)
• Computer reads and run each program consequently
• Operator takes the result, prints out and gives to programmer

• Reduce waiting time between jobs


• Input/output problem
• Computer getting faster
• Card reader still slow
⇒CPU must wait for card reading/writing
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Batch and sequential processing


Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

The first Operating System


GM-NAA I/O General Motors and North American Aviation
Input Output System.

- Created in 1956 by Robert L. Patrick of


Owen Mock of North American Aviation.
- Main function: automatically execute a new
program once the one that was being
executed had finished (batch processing).

- Formed of shared routines to the programs


that provided common access to the
input/output devices.

- Installed on 40 IBM 704 computers


Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Independent computer for reading/writing data


• Replace card reader by tape ⇒ Independent external computers
for reading/writing data

paper tape
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Independent computer for reading/writing data


• Replace card reader by tape ⇒ Independent external computers
for reading/writing data
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Independent computer for reading/writing data

• External devices are designed to be able to Direct Memory


Access, using interrupt and i/o channel
• OS request I/O device then continue its work
• OS receive interrupt signal when I/O devices finishes

• ⇒Allow overlap between computing and I/O

• CPU is reprogrammed to be switch easily between programs


Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Multi programming
• Hardware: memory space larger and cheaper => Some programs can
run simultaneously -> multi programming

• More overlap between computing and I/O


• Require memory protection between programs and keep one
crashed program from damaging the system
• Problem: OS must manage all interactions ⇒ out of control (OS360:
1000 errors)
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

1970-1981 :
• Computers prices about 10.000$ ⇒ used widely for
different jobs

• OS technology became stable.

• Using cheap terminal device (1000$) allow many user


to interact with the system at the same time
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

1970-1981 :
• User perform different works (text editor, chat, program
debugging,..) ⇒ require system to be exploited effectively

• Example: a PC: 10M calculation/s; typing speed 0.2s/1


character => lost 2M calculation per one typing
⇒ Time sharing operating system
• Problem: system’s response time

• Computer network was born (ARPANet : 1968) Communication


between computer; Protection against network attack
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

1981-1995 :
• Computers prices about 1000$;
• Human labor 100K $/year

If you can make someone 1% more efficient by giving them


a computer, it’s worth it!

⇒ Computers are used more widely for working more


effectively
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

1981-1995 :
• Personal computing
• Cheap computer, single person can afford (PC).
• OS on PC
• Hardware resources are limited (Early : 1980s)
• OS become library of available procedures
• Run 1 program at a time (DOS)
• PC become more powerful
• OS meet complex problems: multi tasking, memory
protection... (WINXP)
• Graphical user interface (MAC, WIN,..)
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Distributed systems
• Development time of networking and distributed
operating systems

• Local area network


• Computers share resources: printer, File servers,..
• Client / Server model
• Services
• Computing, storage
• Services provided through Internet.
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Distributed systems

• Problems
• Transmission delay; bandwidth,
reliable...
• Virus (love letter virus
05/2000),..
• >45 millions computers
were infected
• Stole information
• Auto send emails from
contact list
• Download Trojan
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Mobile devices
Mobile devices become
more popular
• Phone, Laptop, PDA . . .
• Small, changeable and
cheap → More
computers/human
• Limited ability: speed,
memory,...

Windows mobile 6.1 Symbian OS


Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Mobile devices

• Wide area network, wireless network


• Traditional computer divided into many components
(wireless keyboards, mouse, remoting storage)
• peer-to-peer system
• Devices with the same role working together
• “Operating system’s” components are spread globally
• Cloud computing
• Cloud operating system
• Ex: Microsoft Windows Azure, Google Chrome OS
Chapter 1. Operating System Overview
2.History of Operating Systems
2.2. History of Operating Systems

Conclusion

• The development of the operating systems are strongly


connected with the computers’ development

• Operating systems have to change with changing technology


Chapter 1 Operating System
Overview

① Operating system Definition


② History of Operating Systems
③ Definition and Classifications
④ Definitions in operating systems
⑤ Operating System structures
⑥ Basic Properties of Operating Systems
⑦ Principles of Operating Systems
Chapter 1. Operating System Overview
3. Operating System definition and classification

Operating System definition and classification

⚫Definitions
⚫Classifications
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.1. Definition of operating system

Observer’s perspective

• Different objects have different requirements for OS


• Different observing perspectives ⇒ different definitions

❖User
❖Manager
❖Technical perspective
❖System engineer perspective
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.1. Definition of operating system

User’s perspective:

“A system of
programs that help
exploit the
computing system
conveniently”
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.1. Definition of operating system

Manager’s perspective
“A system of programs that help manage the computing
system’s resources effectively”
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.1. Definition of operating system

Technician's perspective
“A system of programs equipped for a specific computer to
make a new logic computer with new resources and new
abilities”
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.1. Definition of operating system

System engineer’s perspective

“A system of programs that model and simulate the operation


of the computer, user, and operators. It works in a
communicating mode to make a convenient environment for
exploiting the computer system and maximum resource
management.”
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.1. Definition of operating system

System engineer’s perspective


Simulate 3 roles ⇒ require 3 types of
Simulate the operation of languages
Machine + User+ Operator ⚫ Machine language
• The only working language of the
Mac- system
hine
User • All other languages have to be
Commu- translated into machine language
nication ⚫ System operation’s language
• OS commands (DOS: Dir, Del..;
Ope- Unix: ls, rm,..)
rator • Translated by the Shell
⚫ Algorithm language
• Programming language
Operating System • Compiler
Chapter 1. Operating System Overview
3. Operating System definition and classification

Operating System definition and classification

⚫Definitions
⚫Classifications
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

• Batch processing single program system


• Batch processing multi program system
• Time sharing system
• Parallel system
• Distributed system
• Real-time processing system
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Batch processing single program system

• Programs are performed consequently follow predetermined


instructions
• When a program finished, the system automatically run the next
program without any external intervention

• Require a special process to supervise the sequence of jobs and the


supervisor must stay permanent in the memory
• Need to organize a job queue
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Batch processing multi-program system


• Problem: when a program access an I/O device, processor has to wait
• Solution: allow many programs to run at the same time
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Batch processing multi-program system


• Keep several jobs in memory and multiplex CPU between jobs
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Batch processing multi-program system


• Keep several jobs in memory and multiplex CPU between jobs
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Batch processing multi-program system


• Keep several jobs in memory and multiplex CPU between jobs
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Batch processing multi-program system


• Save memory (no need to load all the program into the memory)

• Reduce processor spare-time

• High cost for processor scheduling. Which program can use


processor next?

• How to solve the memory sharing problem between programs ?


Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Time sharing system


• Processor’s usage allowance time is shared among ready-to-run programs
• Similar to batch processing multi program system (only load part of the
programs)
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Time sharing system


• Processor is issued mainly
by the OS ⇒ how ? ⇒
Chapter 2

• Swapping time between


programs are small →
programs seem to run
parallel

• Usually called: Multi tasking operating system (Windows)


Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Parallel system
• Constructed for system that has many processors
• Many processors, works are done faster
• More reliable: one processor breaks down will not affect the
system
• Advantage over single processor computer due to memory,
peripheral devices sharing...

• Symmetric multi processing (SMP: symmetric)


• Each processor run a single program
• Processors communicate via a shared memory
• Fault tolerance mechanism and optimal load balance
• Problem: processor synchronization
• Example: WinNT operating system
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Parallel system (cont.)


• Asymmetric multi processing (ASMP: asymmetric)
• One processor controls the whole system
• Other processors follow the main processor’s commands or
predetermined instructions
• This model has the master-slave relation form: The main process will
make schedule for other processors
• Example: IBM System/360
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Distributed system

⚫ Each processor has a local memory


and communicate via transmission
lines

⚫ Processors are different from sizes


to functions (personal machine,
workstation, mini computer,..)
Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Distributed system

• Distributed system is used for


• Resource sharing : provide a mechanism for file sharing,
remote printer...

• Increase computing speed: 1 computing operation is divided


into smaller parts and performed on different places at the
same time.

• Safety: 1 position has problem; others can continue working


Chapter 1. Operating System Overview
3. Operating System definition and classification
3.2. Operating System Classification

Real-time processing system

• Used mainly in controlling field.


• Solve a problem no late than a
specific time.
• Each problem has a deadline
• The system must generate
correct result in a determined
time period
• This OS requires high cooperation
between software and hardware.
Chapter 1 Operating System
Overview

① Operating system Definition


② History of Operating Systems
③ Definition and Classifications
④ Notions in operating systems
⑤ Operating System structures
⑥ Basic Properties of Operating Systems
⑦ Principles of Operating Systems
Chapter 1 Operating System Overview
4. Notions in operating systems

Notions in operating systems

• Process

• System’s resources

• Shell

• Kernel

• System calls
Chapter 1 Operating System Overview
4. Notions in operating systems
4.1. Process and Thread

Process
• A running program
• Codes: Program’s executable instruction
• Program’s data
• Stack, stack pointer, registers
• Information that is necessary for running program
• Process >< program
• Program: a passive object, contains computer’s
instructions to perform a specific task
• Process: program’s active state.
Chapter 1 Operating System Overview
4. Notions in operating systems

Notions in operating systems

⚫Process and Thread


⚫System’s resources
⚫Shell
⚫Kernel
⚫System calls
Chapter 1 Operating System Overview
4. Notions in operating systems
4.2 System’s resources

Notion of system resources


• Everything that is necessary for a program to be executed
• Space: System’s storage space
• Time: Instruction executing time, data accessing time

• System’s resources
• Processor
• Memory
• Peripheral devices
Chapter 1 Operating System Overview
4. Notions in operating systems
4.2 System’s resources

System’s resources (cont.)


Processor
• System’s most important
component
• Access level: instruction
• Processing time
• Multi-processor system:
each processor’s time is
managed and scheduled
independently
Chapter 1 Operating System Overview
4. Notions in operating systems
4.2 System’s resources

Notion
• Memory
• Distinguished by: Storage size, directly access,
sequent access
• Levelled by main memory/internal; extend, external
Chapter 1 Operating System Overview
4. Notions in operating systems
4.2 System’s resources

System’s resources (cont.)


• Peripheral devices
• Retrieve, output information (I/O device)
• Attached to the system via controller
• Commonly considered peripheral devices-controller devices
Chapter 1 Operating System Overview
4. Notions in operating systems
4.2 System’s resources

Resource’s classification
• Resource’s types
• Physical : physical devices
• Logical: variable; virtual devices
• Sharing ability
• Sharable: at a specific time, it can be allocated for different
processes. Example: Memory
• Non-sharable but dividable: Processes use the resource
follow an order; Example: processor
• Non-sharable and non-dividable : at a specific time, only one
process can use the resource. Example: Printer
Chapter 1 Operating System Overview
4. Notions in operating systems
4.2 System’s resources

Virtual resource

• provided to a user program in a modified form


• Appears only when the system needs it or when the system
creates it
• Automatically disappears when the system terminates or, more
precisely, when the process associated with it has terminated.
• Example: Virtual printer
Chapter 1 Operating System Overview
4. Notions in operating systems

Notions in operating systems

⚫Process and Thread


⚫System’s resources
⚫Shell
⚫Kernel
⚫System calls
Chapter 1 Operating System Overview
4. Notions in operating systems
4.3 Shell

• A special process: user and OS communication environment


• Task
• Receive user’s command
• Analysis received
command
• Generate new process to
perform command’s
requirement
• Receives command from
command’s line or graphical
interface
Chapter 1 Operating System Overview
4. Notions in operating systems
4.3 Shell

Single task environment (MS-DOS)

• Shell waits until the process finishes and then receive new
command

(a) At system startup. (b) Running a program


Chapter 1 Operating System Overview
4. Notions in operating systems
4.3 Shell

multi-tasking system (UNIX, WINXP,. . .)


• After creating and running new process, Shell can receive
new command

[FreeBSD – Derived from Berkely Unix]


Chapter 1 Operating System Overview
4. Notions in operating systems

Notions in operating systems

• Process and Thread


• System’s resources
• Shell
• Kernel
• System calls
Chapter 1 Operating System Overview
4. Notions in operating systems
4.4 Kernel

Kernel
Chapter 1 Operating System Overview
4. Notions in operating systems

Notions in operating systems

⚫Process
⚫System’s resources
⚫Shell
⚫Kernel
⚫System calls
Chapter 1 Operating System Overview
4. Notions in operating systems
4.5 System calls

• Provides environment for interacting between user’s program and the


OS
• Programs utilize system calls to request services from OS
• Create, delete, use other software objects operated by the OS
• Every single system call is corresponding to a library of sub-programs
(functions)
• System calls are done in the form of
• Instructions in low-levels programming languages
• Interrupt requests (Int) in assembly language
• API functions calls in Windows
• Input parameters for the services and returned results are in special
memory areas
• For example: when making request for an interrupt, the function name is
stored in the register AH
• Int 05 : print to monitor ; Int 13/AH=03h : DISK – WRITE/ DISK SECTOR
Chapter 1 Operating System Overview
4. Notions in operating systems
4.4 System calls

Example

Func BOOL WINAPI ExitWindowsEx(int uFlags, int dwReason);


uFlags Shutdown types
EWX_LOGOFF End process and exit Windows
EWX_POWEROFF Shutdown system and turn off computer
EWX_ REBOOT Shutdown and restart computer
dwReason Reason for shutdown
Chapter 1 Operating System
Overview

① Operating system Definition


② History of Operating Systems
③ Definition and Classifications
④ Definitions in operating systems
⑤ Operating System structures
⑥ Basic Properties of Operating Systems
⑦ Principles of Operating Systems
Chapter 1 Operating System Overview
6. Operating System structures

• System’s components
• Operating system’s services
• System calls
• Operating system’s structures
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Process management
• Process: A running program
• utilize system’s resources to complete its task
• Resources are allocated when process created or while it’s
running
• Process terminates, resources are returned

• It is possible for many processes to exist in the system at the same


time
• System process
• User process
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Process management (cont.)

• tasks of OS in process management


• Create and terminate user’s process and system’s process
• Block or re-execute a process
• Provide mechanism for
• process synchronization
• processes’ communication
• controlling deadlock among processes
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Main memory management


• Main memory: an array of byte(word);
• Each element has an address; where data are accessed by CPU
• To be executed, a program must be given an absolute address and
loaded into main memory.
• When the program is running, the system accesses instructions and
data in main memory.
• To optimize CPU time and computer’s speed, some processes are
kept in memory at the same time
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Main memory management (cont.)

• Role of OS in main memory


management
• Store information about used areas in
memory and who used them

• Decide which process will be fetched


into main memory when the memory
is available.

• Allocate and retrieve memory when


it’s necessary
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Input-Output system management

• Objective: hide physical devices' details from users to help


them operate easier.
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Input-Output system management

• Input-Output system management includes


• Memory management of buffering, caching, spooling
• Communicate with device drivers.
• Controller for special hardware devices. Only device
driver understand its associated-device’s specific structure
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

File management

• Computer can store information on many types of storage


devices
• File: storage unit
• File management task
• Creates/ deletes a file/directory
• Provides operations over files and directory
• Reflects file on secondary storage system
• Backs up file system on storage devices
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Storage memory management

• Program is stored in secondary memory (magnetic disk) until


it’s fetched into main memory and executed.
• Disk is utilized for storing data and processed result.
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Storage memory management

• Data and result can be stored temporarily on disk: virtual


memory

• Role of OS in disk management


• Unused area management
• Provide storage area as requested
• Schedule disk accessing effectively
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Data transmission system (Distributed system)

• Distributed system combined of set of processor (sym/asym)


without common clock and memory. Each processor has a
local memory.
• Processor connected via transmission network
• Transmission is performed via protocols (FTP, HTTP...)
• Distributed system allow user to access different resource
• Access to sharing resources will allow
• Increase computing speed
• Increase data availability
• Increase the system reliable
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

System’s protection

• Multi users operate with the system at the same time ⇒


Processes must be protected from other processes’ activities
• Protection is a controlling mechanism of program or user’s
access to system or resource
• Protection mechanism will require
• Distinguish between legal or illegal usage
• Set imposed controls
• Provide tools for imposing
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

User interface

• Carry out user’s command.


• Commands are provided for OS ‘s command controller to
• Create and manage process
• Manage main memory and storage memory
• Access file system
• Protect
• Network system
• ...
• User interface can be command line (DOS, UNIX) or more
friendly with graphical interface (Windows, MacOS)
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

User interface

Some forms of human-computer interact


• Command line
• Simple but organized
• Do not require complex system specification
• Easy to add parameter
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Some forms of human-computer interact (cont 1.)

• Selection table
• Menu
• Popup
• Menu_popup: 2
method: on and
onselect
Chapter 1 Operating System Overview
6. Operating System structures
6.1 System’s components

Some forms of human-computer interact (cont2.)

• Symbol
window, icon, desktop
Chapter 1 Operating System Overview
6. Operating System structures

⚫System’s components
⚫Operating system’s services
⚫System calls
⚫Operating system’s structures
Chapter 1 Operating System Overview
6. Operating System structures
6.2 Operating system’s services

A view of operating system services


Chapter 1 Operating System Overview
6. Operating System structures
6.2 Operating system’s services

Main and basic services


Chapter 1 Operating System Overview
6. Operating System structures
6.2 Operating system’s services

Support services
Chapter 1 Operating System Overview
6. Operating System structures

⚫System’s components
⚫Operating system’s services
⚫System calls
⚫Operating system’s structures
Chapter 1 Operating System Overview
6. Operating System structures
6.3 System call

System call
Chapter 1 Operating System Overview
6. Operating System structures
6.3 System call

System call
Provide an interface between process and operating system

a number is
associated
with each
system call
Chapter 1 Operating System Overview
6. Operating System structures
6.3 System call

System call
Example of how system calls are used in file copying

Frequently, systems execute thousands of system calls per second


Chapter 1 Operating System Overview
5. Operating System structures
5.3 System call

System call

• Process management: initialize, terminate process..


• Memory management: allocate and free memory...
• File management: create, delete, read and write file...
• Input Output device management: perform
input/output...
• Exchange information with the system. Example
get/set time/date...
• Inter process communication
Chapter 1 Operating System Overview
5. Operating System structures

⚫System’s components
⚫Operating system’s services
⚫System calls
⚫Operating system’s structures
Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

Monolithic System Architecture


Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

MS-DOS structure (Silberschatz 2002)


Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

UNIX structure (Silberschatz 2002)


Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

Layered Approach
Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

Layered Approach
Ex: Structure of THE (Technische Hogeschool Eindhoven), 1968

Layer Function
5 The operator

4 User programs

3 Input/output management

2 Operator-process communication

1 Memory and drum management

0 Processor allocation and multiprogramming


Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

OS/2 structure (Silberschatz 2002)


Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

Virtual machine(Silberschatz 2002)

VMWare architecture
Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

Client-Server Model (Tanenbaum 2001)


Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

Windows NT Client-Server Structure)


Chapter 1 Operating System Overview
5. Operating System structures
5.4 Operating system’s structures

Client-Server model in distributed OS (Tanenbaum 2001)


Chapter 1 Operating System
Overview

① Operating system Definition


② History of Operating Systems
③ Definition and Classifications
④ Notions in operating systems
⑤ Operating System structures
⑥ Basic Properties of Operating Systems
⑦ Principles of Operating Systems
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Basic Properties of Operating Systems

• High reliability
• Secure
• Effectiveness
• General overtime/ Inherit and adaption
• Convenience
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

High reliability

• Every actions, notifications must be accurate


• Only provide information when it’s surely correct
• When error occurs notify and stop the process or let
the user decide
• Require support from device
• Example: C:/>COPY C:/F.TXT A:
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

High reliability
• Example: C:/>COPY C:/F.TXT A:
• Check the syntax of command copy
• Check I/O card (motor, drive accessibility)
• Check for file F.TXT existence in C drive
• Check A drive
• Check if file F.TXT already existed in A drive
• Check if there is enough space in A
• Check if the disk is write protection
• Check written information (if required)
• ....
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Basic Properties of Operating Systems

• High reliability
• Secure
• Effectiveness
• General overtime/ Inherit and adaption
• Convenience
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Security

• Data and programs must be protected


• No unwanted modification happen in every working
mode
• protected from illegal access
• Different resources have different protection
requirements
• Many levels protections with various of tools
• Important for multi tasking system
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Basic Properties of Operating Systems

• High reliability
• Secure
• Effectiveness
• General overtime/ Inherit and adaption
• Convenience
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Effectiveness

• Resources are exploited thoroughly;


• Resource that is limited still able to handle complex
requirement.
• The system need to maintain the synchronization;
• Slow devices do not affect the whole system operation
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Basic Properties of Operating Systems

• High reliability
• Secure
• Effectiveness
• Generalizable overtime/ Inherit and adaption
• Convenience
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Generalizable overtime

• System must be Inheritable


• Operations, notification can not change
• If changed: notify and with detailed guide
(chkdsk/scandisk)
• Help keeping and increasing users
• System must have ability to adapt to changes that
may happen
• Example: Y2K problem; FAT 12/16/32
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Basic Properties of Operating Systems

• High reliability
• Secure
• Effectiveness
• General overtime/ Inherit and adaption
• Convenience
Chapter 1 Operating System Overview
6. Basic Properties of Operating Systems

Convenience

• Easy to use

• Various effective levels

• Have many assisting system


Chapter 1 Operating System
Overview

① Operating system Definition


② History of Operating Systems
③ Definition and Classifications
④ Basic Properties of Operating Systems
⑤ Notions in operating systems
⑥ Operating System structures
⑦ Principles of Operating Systems
Chapter 1 Operating System Overview
7. Principles of Operating Systems

Principles of Operating Systems

• Modular
• Relativity in positioning
• Macroprocessor
• Initialization in the installation
• Functional repetition
• Standard values
• Multi-levels protection
Chapter 1 Operating System Overview
7. Principles of Operating Systems

⚫ Modular principle

I0 O0 I1 O1 In On
m0 m1 mn
Chapter 1 Operating System Overview
7. Principles of Operating Systems

The principle of relativity in positioning

• General form of machine instruction:


Instruction_code operand_1 operand_2
Ex: Mov AX, B
Operand_1, operand_2 can not be absolute address
Chapter 1 Operating System Overview
7. Principles of Operating Systems

The macroprocessor principle

Problem Program Execution Result

Macroprocessor
Chapter 1 Operating System Overview
7. Principles of Operating Systems

Principle of initialization in the installation

• (Also called generate principle)


• OS is made up of modules in the available module
repository to satisfy
• Machine's configuration
• User's requirement
• Distinguish set up and install
Chapter 1 Operating System Overview
7. Principles of Operating Systems

Principle of functional repetition

• (1 job can be performed in combinations of


different modules
• Make system safer
• Convenient for users' request
• Ex: multiple translation programs for the same
language.
Chapter 1 Operating System Overview
7. Principles of Operating Systems

Standard values principle

• Increase module flexibility -> module


parameterization

• For convenience and safety -> build standard


values for modules
Chapter 1 Operating System Overview
7. Principles of Operating Systems

Multi-levels protection

• Resources have different characteristics ->


different methods of protection
• Multiple layers of protection -> safety
• Help significantly reduce unintentional errors

Physical Protection
Access Right

Encryption

Firewall
Access
Login

Data
Chapter 1 Operating System Overview
Summary
① Definition of Operating system ⑤ Notions of Operating system
⚫ Layering structure of OS ⚫ Process and Thread
⚫ OS’s functions
⚫ System’s resources
② History of Operating system
⚫ History of computers ⚫ Shell
⚫ History of Operating system ⚫ System calls
③ Definition and classification of OS
⚫ Definitions
⚫ Classification ⑥ Operating system’s structure
④ Basic properties of OS ⚫ OS’s components
⚫ High reliability
⚫ Security ⚫ OS’s services
⚫ Effective ⚫ System calls
⚫ Generalize overtime ⚫ System’s structures
⚫ Convenience
⑦ Principles of Operating System

You might also like