Download - OSD Chapter 1 Lec02and 03
![Page 1: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/1.jpg)
Chapter 1Introduction to Operating System
![Page 2: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/2.jpg)
Outline1.1 What is OS1.2 Computer System Organization1.3 Computer System Architecture1.4 OS Structure1.5 OS Operations 1.6-1.8 Process, Memory, Storage
management1.9 Protection and Security1.10~ Systems
![Page 3: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/3.jpg)
1.1 What is Operating System? An operating system is a program
that manages the computer hardware.
It also provides a basis for application programs and acts as an intermediary between the computer user and computer hardware.
![Page 4: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/4.jpg)
What do Operating System do? The computer system can be divided
roughly into four components:
1. The hardware2. The operating system3. The application software4. The Users
![Page 5: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/5.jpg)
![Page 6: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/6.jpg)
USER View of OS Ease to use (Home PCs)
Efficient resource utilization (Work stations)
![Page 7: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/7.jpg)
SYSTEM view of OS OS is a resource allocator Manages all resources (CPU time, memory space, storage space, I/O and so on) Decides between conflicting requests for efficient and fair resource use
OS is a control program Controls execution of programs to prevent errors and improper use of the computer
![Page 8: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/8.jpg)
1.2 Computer System Organization Basic Organization Storage Structure I/O structure
![Page 9: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/9.jpg)
Computer Startup Bootstrap program is loaded at
power up or reboot Typically stored in ROM, generally
known as firmware Initialize all aspects of system Loads operating system kernel and
starts execution
![Page 10: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/10.jpg)
1.2.1 Computer System Organization
![Page 11: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/11.jpg)
1.2.1 Computer System Organization I/O devices and the CPU can
execute concurrently. Each device controller is in charge
of a particular device type. Each device controller has a local
buffer.
![Page 12: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/12.jpg)
Interrupt Timeline
![Page 13: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/13.jpg)
1.2.2 Storage StructureMain Memory: Main memory is the only large
storage media that the CPU can access directly
Main memory is usually too small to store all needed programs and data
Main memory is a volatile storage device that loses its contents when power is off
![Page 14: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/14.jpg)
1.2.2 Storage Structure Therefore, most computer provide
secondary storage as extension to store web browser, compliers, word processors…etc
![Page 15: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/15.jpg)
Storage Device Hierarchy
![Page 16: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/16.jpg)
1.2.2 Storage Structure Storage systems organized in
hierarchy. Speed Cost Volatility Caching–copying information into
faster storage system; main memory can be viewed as a last cache for secondary storage.
![Page 17: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/17.jpg)
Performance of Various Levels of Storage
![Page 18: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/18.jpg)
Caching
Information in use copied from slower to faster storage temporarily
Important principle, performed at many levels in a computer (in hardware, operating system, software)
![Page 19: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/19.jpg)
Caching Faster storage (cache) checked first to
determine if information is there If it is, information used directly from the cache (fast) If not, data copied to cache and used there
Cache is usually smaller than storage being cached
Cache management is an important design problem
Cache size and replacement policy
![Page 20: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/20.jpg)
1.3 Computer-System Architecture 1.3.1 Single-Processor Systems 1.3.2 Multiprocessor Systems 1.3.3 Cluster Systems
![Page 21: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/21.jpg)
1.3.1 Single-Processor Systems On a single processor system, there is
only one main CPU capable of executing a general purpose instruction set.
Some other special-purpose processors may also included. Such as:
GPU Disk-controller microprocessor Keyboard microprocessor
![Page 22: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/22.jpg)
1.3.2 Multiprocessor Systems Also called Parallel Systems
Advantages:1. Increase throughput 2. Economy of scale3. Increase reliability (fault tolerant)
![Page 23: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/23.jpg)
1.3.2 Multiprocessor Systems Two types of multiprocessor systems:
1. Asymmetric multiprocessing (master and slave processors)2. Symmetric multiprocessing (Shared memory system)
![Page 24: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/24.jpg)
1.3.3 Clustered Systems Clustered computers share
storage and are closely linked via Local-area network (LAN) or a faster interconnection.
![Page 25: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/25.jpg)
1.4 OS Architecture One of the most important aspect of OS is
the ability to Multiprogramming
Single user cannot keep CPU and I/O devices busy at all times
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS switches to another job
![Page 26: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/26.jpg)
Memory Layout for Multiprogrammed System
![Page 27: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/27.jpg)
Multiprogramming Jobs are stored in “Job Pool” Virtual memory is the useful
technique for the limitation size of physical memory
![Page 28: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/28.jpg)
1.5 OS operations Interrupt (driven by hardware) vs. Trap (called by software or error) Trap example: divide by 0; invalid memory access
We need to make sure that an error in a user program could cause problems only for the one program that was running (such as infinite loop)
![Page 29: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/29.jpg)
Dual Mode Operation Dual-mode operation allows OS to
protect itself and other system components
It contains user mode (mode bit:1) and Kernel mode (mode bit:0)
The operating system loaded user application starts in user mode. Whenever a trap or interrupt occurs, hardware switches to kernel mode.
![Page 30: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/30.jpg)
Transition from user to kernel mode
![Page 31: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/31.jpg)
C library handling of write()
#include<stdio.h>Int main(){…printf(“hellow world”);…}
Standard C libraryUser mode
Kernel modeWrite() system call
![Page 32: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/32.jpg)
Dual Mode Operation Privileged instructions: some
machine instructions that may cause harm, can only be executed in kernel mode.
Such as instruction switch to user mode; I/O control; timer management, and interrupt management.
![Page 33: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/33.jpg)
TimerTo prevent the OS out of control by CPU
Set interrupt after specific period Operating system decrements counter When counter zero generate an interrupt Set up before scheduling process to
regain control or terminate program that exceeds allotted time
![Page 34: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/34.jpg)
Process management A process is a program in
execution. It is a unit of work within the system.
Process needs resources to accomplish its task CPU, Memory, files, I/O devices
Process termination requires reclaim of any reusable resources
![Page 35: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/35.jpg)
Process management Single-threaded process has one
program counter (PC) specifying location of next instruction to execute
Process executes instructions sequentially, one at a time until completion
Multi-threaded process has one program counter per thread
![Page 36: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/36.jpg)
Process management The operating system is responsible for
the following activities in connection with process management:
Creating and deleting both user and system processes (Ch3)
Suspending and resuming processes (Ch5) Providing mechanisms for process synchronization (Ch6) Providing mechanisms for process communication (Ch4) Providing mechanisms for deadlock handling(ch7)
![Page 37: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/37.jpg)
Memory Management
All data in memory before and after processing
All instructions in memory in order to execute
Memory management determines what is in memory when optimizing CPU utilization and computer response to users
![Page 38: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/38.jpg)
Memory management activities
Keeping track of which parts of memory are currently being used and by whom
Deciding which processes and data to move into and out of memory
Allocating and deallocating memory space as needed
![Page 39: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/39.jpg)
Storage Management OS provides uniform, logical view
of information storage
file Each medium is controlled by device (i.e., disk
drive, tape drive)
![Page 40: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/40.jpg)
Storage Management
File-System management Files usually organized into directories Access control on most systems to determine
who can access what OS activities include1. Creating and deleting files and directories2. Primitives to manipulate files and dirs3. Mapping files onto secondary storage4. Backup files onto stable (non-volatile) storage
media
![Page 41: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/41.jpg)
Mass Mass-Storage Management Usually disks used to store data that does not
fit in main memory or data that must be kept for a “long” period of time.
OS activities1. Free-space management2. Storage allocation3. Disk scheduling4. Tertiary storage includes optical storage,
magnetic tape5. Varies between WORM (write-once, read-
many-times) and RW (read-write)
![Page 42: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/42.jpg)
Protection and Security
Protection–any mechanism for controlling access of processes or users to resources defined by the OS (Ch14)
Security–defense of the system against internal and external attacks even when protection is activated (Ch15)
(including denial-of-service, worms, viruses, identity theft, theft of service)
![Page 43: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/43.jpg)
Protection and Security Systems generally first distinguish among users,
to determine who can do what
User identities (user IDs, security IDs) include name and associated number, one per user
User ID then associated with all files, processes of that user to determine access control
Group identifier (group ID) allows set of users to be defined and controls managed, then also associated with each process, file
Privilege escalation allows user to change to effective ID with more rights
![Page 44: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/44.jpg)
Computing Environments Traditional computer
Used to be single system, then modems
Now firewalled, networked
![Page 45: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/45.jpg)
Client-Server computing Many system now servers,
responding request to clients
![Page 46: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/46.jpg)
Peer Peer-to to-Peer Computing Another model of distributed
system P2P does not distinguish clients and
servers
1. Instead all nodes are considered peers2. May each act as client, server or both3. Node must join P2P network
![Page 47: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/47.jpg)
Web-Based computing
Web has become ubiquitous More devices becoming networked
to allow web access, such as work stations, even cell phone
![Page 48: OSD Chapter 1 Lec02and 03](https://reader035.vdocuments.mx/reader035/viewer/2022070603/577ccec41a28ab9e788e3e99/html5/thumbnails/48.jpg)
Operating System Services User interface Program execution File-system manipulation Communication Error detection Resource allocation Accounting Protection and security