Introduction To Advanced Operating System
Introduction To Advanced Operating System
By Bishnu Gautam
General Overview
by Bishnu Gautam
Introduction
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
General Overview
by Bishnu Gautam
General Overview
Evaluation system
Total mark (75) = Assessment (15) + Semester (60)
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
Introduction
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
Introduction
by Bishnu Gautam
Introduction
Introduction
Two Functions of OS
by Bishnu Gautam
11
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
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
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
Introduction
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
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.
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
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
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.
Introduction
I/O Management
All computers have physical devices for acquiring input and producing output.
by Bishnu Gautam
21
Introduction
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
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
Introduction
Special-Purpose Systems
The computer systems whose functions are more limited and whose objective is to deal with limited computation domains
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
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
Introduction
by Bishnu Gautam
26
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