+ All Categories
Home > Documents > Csc4320 Chapter 1

Csc4320 Chapter 1

Date post: 27-Mar-2015
Category:
Upload: prabir-kumar-pani
View: 983 times
Download: 0 times
Share this document with a friend
48
Chapter 1 Introduction to Operating System Bernard Chen Spring 2007
Transcript
Page 1: Csc4320 Chapter 1

Chapter 1Introduction to Operating System

Bernard ChenSpring 2007

Page 2: Csc4320 Chapter 1

Outline

1.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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1
Page 6: Csc4320 Chapter 1

USER View of OS

Ease to use (Home PCs)

Efficient resource utilization (Work stations)

Page 7: Csc4320 Chapter 1

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: Csc4320 Chapter 1

1.2 Computer System Organization

Basic Organization Storage Structure I/O structure

Page 9: Csc4320 Chapter 1

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: Csc4320 Chapter 1

1.2.1 Computer System Organization

Page 11: Csc4320 Chapter 1

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: Csc4320 Chapter 1

Interrupt Timeline

Page 13: Csc4320 Chapter 1

1.2.2 Storage Structure

Main 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: Csc4320 Chapter 1

1.2.2 Storage Structure

Therefore, most computer provide secondary storage as extension to store web browser, compliers, word processors…etc

Page 15: Csc4320 Chapter 1

Storage Device Hierarchy

Page 16: Csc4320 Chapter 1

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: Csc4320 Chapter 1

Performance of Various Levels of Storage

Page 18: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

1.3 Computer-System Architecture

1.3.1 Single-Processor Systems 1.3.2 Multiprocessor Systems 1.3.3 Cluster Systems

Page 21: Csc4320 Chapter 1

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: Csc4320 Chapter 1

1.3.2 Multiprocessor Systems

Also called Parallel Systems

Advantages:1. Increase throughput 2. Economy of scale3. Increase reliability (fault tolerant)

Page 23: Csc4320 Chapter 1

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: Csc4320 Chapter 1

1.3.3 Clustered Systems

Clustered computers share storage and are closely linked via Local-area network (LAN) or a faster interconnection.

Page 25: Csc4320 Chapter 1

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: Csc4320 Chapter 1

Memory Layout for Multiprogrammed System

Page 27: Csc4320 Chapter 1

Multiprogramming

Jobs are stored in “Job Pool” Virtual memory is the useful

technique for the limitation size of physical memory

Page 28: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

Transition from user to kernel mode

Page 31: Csc4320 Chapter 1

C library handling of write()

#include<stdio.h>

Int main()

{

printf(“hellow world”);

}

Standard C libraryUser mode

Kernel mode

Write() system call

Page 32: Csc4320 Chapter 1

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: Csc4320 Chapter 1

Timer

To 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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

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: Csc4320 Chapter 1

Computing Environments

Traditional computer

Used to be single system, then modems

Now firewalled, networked

Page 45: Csc4320 Chapter 1

Client-Server computing

Many system now servers, responding request to clients

Page 46: Csc4320 Chapter 1

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: Csc4320 Chapter 1

Web-Based computing

Web has become ubiquitous More devices becoming networked

to allow web access, such as work stations, PDA, even cell phone

Page 48: Csc4320 Chapter 1

Operating System Services User interface Program execution File-system manipulation Communication Error detection Resource allocation Accounting Protection and security


Recommended