You are on page 1of 27

Advanced Operating System

M. Sc. Computer Science and Information Technology, Tribhuvan University

By Bishnu Gautam

Advanced Operating System

General Overview

Objectives of the course


Introduce the underlying principles of an operating system, virtual memory and resource management concepts. Exposer of current state of art research in operating system Exposure of distributed operating system, realtime operating system and multimedia systems.

by Bishnu Gautam

Advanced Operating System

Introduction

Why Learn about Operating Systems?


Tangible reasons Build or modify a real operating system Administer and use system well Tune application performance Intangibles reasons Intrinsic curiosity
Understand how much of your computer system works

Gain/apply knowledge in other areas of Computer Science


Computer architecture and devices Synchronization in programming languages Data structures and algorithms Performance analysis

Challenge of designing large, complex systems


by Bishnu Gautam 3

Advanced Operating System

General Overview

Course Overview
1. Introduction 2. Process, Memory and Storage Management
First Internal Examination

-1week -7weeks

3. System Protection and Security -2weeks 4. Distributed Operating Systems, Distributed File Systems -3weeks 5. Real-time Systems, Multimedia Systems -2weeks
Second Internal Examination

-15weeks

Final Examination
by Bishnu Gautam 4

Advanced Operating System

General Overview

Books and References


Text Book: 1. Silberschatz, Galvin and Gagne, Operating System Concepts, 8th Edition, John-Wiley. References : 1. Research and Technical Papers 2. Tanenbaum, A. S., Modern Operating Systems, 3rd Edition, PHI 3. Stallings, W., Operating Systems, Fourth Edition, Pearson. 4. Tanenbaum, A. S. and Woodhull, A. S., Operating Systems Design and Implementation, Second Edition, PHI. Lab References: Linux Manual, Linux Programming Manual and C book.

by Bishnu Gautam

Advanced Operating System

General Overview

Evaluation system
Total mark (75) = Assessment (15) + Semester (60)

Assessment marks is distributed as follows:


Assignments (5) + Internal Examination1 (5) + Internal Examination2 (5) = 15 Assignments are basically Lab works and Case Studies, each assignment will have a due date for submission and demonstration, it is mandatory to submit their report with in the due date. Home works will be assigned in class only for your practice, not for submission, but sometime it may assigned as an assignment.
by Bishnu Gautam 6

Advanced Operating System

Introduction

Introduction
Computer System Structure What is Operating Systems Operating-System Structure Operating-System Operations Process Management Memory Management Storage Management Protection and Security Distributed Systems Special-Purpose Systems
Reading: Textbook Chapter 1 & 2
by Bishnu Gautam 7

Advanced Operating System

Introduction

Computer System Structure


Computer system can be divided into four components:
Hardware provides basic computing resources
CPU, memory, I/O devices

Operating system
Controls and coordinates use of hardware among various applications and users

Application programs define the ways in which the system resources are used to solve the computing problems of the users
Word processors, compilers, web browsers, database systems, video games

Users
People, machines, other computers
by Bishnu Gautam 8

Advanced Operating System

Introduction

Computer System Structure

by Bishnu Gautam

Advanced Operating System

Introduction

What is an operating system?


An operating system (OS) is a collection of system programs that together control the operation of a computer system.

Operating system goals:


Execute user programs and make solving user problems easier. Make the computer system convenient to use. Use the computer hardware in an efficient manner.
Provides an environment within which other programs can do useful work.
by Bishnu Gautam 10

Advanced Operating System

Introduction

Two Functions of OS

OS as an Extended Machine OS as a Resource Manager

by Bishnu Gautam

11

Advanced Operating System

Introduction

OS as an Extended Machine
OS creates higher-level abstraction for programmer
Example: (Floppy disk I/O operation) -disks contains a collection of named files -each file must be open for READ/WRITE -after READ/WRITE complete close that file -no any detail to deal OS shields the programmer from the disk hardware and presents a simple file oriented interface.

OS function is to present the user with the equivalent of an extended machine or virtual machine that is easier to program than the underlying hardware.
Challenges: What are the right abstractions? How to achieve this?

by Bishnu Gautam

12

Advanced Operating System

Introduction

OS as a Resource Manager
-What happens if three programs try to print their output on the same
printer at the same time? -What happens if two network users try to update a shared document at same time?

OS primary function is to manage all pieces of a complex system. Advantages: Virtualizes resource so multiple users/applications can share Protect applications from one another Provide efficient and fair access to resources Challenges: What mechanisms? What policies?
by Bishnu Gautam 13

Advanced Operating System

Introduction

OS evolution
Computer Generation, Component and OS Types
1st (1945-55) 2nd (1955-65) 3rd (1965-80) 4th (1980-present) Vacuum Tubes Transistor IC PC User Driven Batch Multiprogramming Client Server/Distributed

by Bishnu Gautam

14

Advanced Operating System

Introduction

Operating System Structure


Multiprogramming: Multiple jobs in memory at the same time. Each memory
space protected from each other. OS picks one, execute it for a while, stops (e.g. when programs reads for input or randomly), picks other to run. Needed for efficiency 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

Timesharing (multitasking) is logical extension in which CPU switches jobs


so frequently that users can interact with each job while it is running, creating interactive computing Response time should be < 1 second Each user has at least one program executing in memory process If several jobs ready to run at the same time CPU scheduling If processes dont fit in memory, swapping moves them in and out to run Virtual memory allows execution of processes not completely in memory
by Bishnu Gautam 15

Advanced Operating System

Introduction

Operating-System Operations
OS must insure that an incorrect program can not cause other programs to execute incorrectly, and must terminate the such erroneous program. Provide hardware support to differentiate between at least two modes of operations. 1. User mode . execution done on behalf of a user. User programs runs in user mode, which permits only the subset of instructions to be executed and subset of features to be accessed. 2. Kernel mode (or supervisor mode) . execution done on behalf of operating system. OS runs in kernel mode, giving it access to the complete hardware. Mode bit is added to the hardware of the computer to indicate the current mode: kernel(0) and user(1).
by Bishnu Gautam 16

Advanced Operating System

Introduction

Dual-Mode Operation
When an trap or interrupt occurs hardware switches from user mode to the kernel mode. Thus, whenever the OS gains control of computer, it is in kernel mode. The system always switches to user mode before passing control to the user program.

Privileged instructions can be issued only in kernel mode.


Advantages: protect OS from errant users and errant user from one another.
by Bishnu Gautam 17

Advanced Operating System

Introduction

Process Management
A process is a program in execution. A process needs certain resources, including CPU time, memory, files, and I/O devices, to accomplish its task.

The operating system is responsible for the following activities in connection with process management.
Process creation and deletion. Process suspension and resumption. Provision of mechanisms for:
process synchronization process communication deadlock handling
by Bishnu Gautam 18

Advanced Operating System

Introduction

Memory Management
Memory is a large array of words or bytes, each with its own address. It is a repository of quickly accessible data shared by the CPU and I/O devices.

The operating system is responsible for the following activities in connections with memory management:
Keep track of which parts of memory are currently being used and by whom. Decide which processes to load when memory space becomes available. Allocate and deallocate memory space as needed.

by Bishnu Gautam

19

Advanced Operating System

Introduction

File Management
A file is a collection of related information defined by its creator. Commonly, files represent programs (both source and object forms) and data.

The operating system is responsible for the following


activities in connections with file management:
File creation and deletion. Directory creation and deletion. Support of primitives for manipulating files and directories. Mapping files onto secondary storage. File backup on stable (nonvolatile) storage media.
by Bishnu Gautam 20

Advanced Operating System

Introduction

I/O Management
All computers have physical devices for acquiring input and producing output.

The I/O system consists of:


A memory management component that includes buffering, caching, and spooling. A general device-driver interface. Drivers for specific hardware devices. Disk management.

by Bishnu Gautam

21

Advanced Operating System

Introduction

Protection and Security


Situation: a computer system has multiple users and allows the concurrent execution of multiple processes, then access to data must be regulated. Required mechanisms that ensures files, memory segments, CPU, and other resources can be operated on by only those processes that have gained proper authorization from the operating system Protection mechanism for controlling access of processes or users to resources defined by the OS Security defense of the system against internal and external attacks
Huge range, including denial-of-service, worms, viruses, identity theft, theft of service

Systems generally first distinguish among users, to determine who can do what
User identities (user IDs, security IDs) include name and associated number 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 Privilege escalation allows user to change to effective ID with more rights
by Bishnu Gautam 22

Advanced Operating System

Introduction

Distributed Systems
A distributed system is a collection of physically separate, possibly heterogeneous, computer systems that are networked to provide the users with access to the various resources that the system maintains. Access to a shared resource increases computation speed, functionality, data availability, and reliability Network Operating System provides features between systems across network Communication scheme allows systems to exchange messages Illusion of a single system

by Bishnu Gautam

23

Advanced Operating System

Introduction

Special-Purpose Systems
The computer systems whose functions are more limited and whose objective is to deal with limited computation domains

Real-time embedded systems most prevalent form of computers


Vary considerable, special purpose, limited purpose OS, real-time OS

Multimedia systems
Streams of data must be delivered according to time restrictions

Handheld systems
PDAs, smart phones, limited CPU, memory, power Reduced feature set OS, limited I/O
by Bishnu Gautam 24

Advanced Operating System

Introduction

System calls
System calls provide the interface between a process and the operating system.
Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call use Three most common APIs are Win32 API for Windows, POSIX API for POSIXbased systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM) Example: ReadFile() function in the Win32 APIa function for reading from a file
HANDLE filethe file to be read LPVOID buffera buffer where the data will be read into and written from DWORD bytesToReadthe number of bytes to be read into the buffer LPDWORD bytesReadthe number of bytes read during the last read LPOVERLAPPED ovlindicates if overlapped I/O is being used

by Bishnu Gautam

25

Advanced Operating System

Examples of Windows and Unix System Calls

Introduction

by Bishnu Gautam

26

Advanced Operating System

Introduction

Home Works
HW #1: 1. Textbook: (Ch. 1) 1.1, 1.3, 1.4, 1.6, 1.7, 1.8, 1.13,1.19 & 1.21 2. Textbook: (Ch. 2) 2.1, 2.2, 2.14, 2.8 & 2.19, 2. What does the CPU do when there are no programs to run? 3. What must user programs be prohibited from writing to the memory locations containing the interrupt vector? 4. Classify the following applications as batch-oriented or interactive.
a) Word processing b) Generating monthly bank statements c) Computing pi to a million decimal places

5. What is a purpose of system calls?


by Bishnu Gautam 27

You might also like