Upload
christy-king
View
6
Download
1
Tags:
Embed Size (px)
DESCRIPTION
Operating sytem
Citation preview
UNIT–I: Introduction• Introduction to Operating System Concepts
• Multitasking• Multiprogramming• Multiuser• Multithreading
…
• Types of Operating Systems• Batch Operating System• Time–sharing Systems• Distributed OS• Network OS• Real–Time OS
• Various Operating System Services
• Architecture
• System Calls and Programs
• Exam Questions1Unit-I: Introduction
|<<
Introduction to Operating System Concepts
• Prerequisites
• Operating System (OS)
• Resources of a Computer System
• User View
• System View
• Objectives and Functions of OS
• Multiprogramming
• Multitasking
• Multiuser
• Multithreading
2Unit-I: Introduction
• Basic Data Structures
• Computer Organisation
• High–Level Language (C, …)
3
|<<
Unit-I: Introduction
Prerequisites
• Collection of System Software (Programs), which makes it User friendly andMost efficient
• Controls and coordinates use of Hardware among Various Applications and Users
KernelProgram running at all times on the Computer
4Unit-I: Introduction
Operating System
What is an Operating System?
• A program that acts as an intermediary between a user of a computer and the computer hardware
• 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
5Unit-I: Introduction
Computer System Structure
• Computer system can be divided into four components:– Hardware – provides basic computing resources
• CPU, memory, I/O devices– System Programs 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
6Unit-I: Introduction
• AT & T / BSDUnix
• Sun Microsystems’ Solaris 2 Linux• Microsoft MS-DOS Windows 95 / 98 / NT Windows 2000 (Windows Me) Windows XP Windows Vista
Windows 7 / Windows 8• DEC VMS (Virtual Memory System) TOPS–20 (Total Operations Processing System)• IBM OS/2
• AppleMacintosh
7Unit-I: Introduction
|<<
Most Popular Operating Systems
Hardware and Software required to solve a problem
CPU Time
Memory Space
File Storage Space
I/O Devices
…
8Unit-I: Introduction
|<<
Resources of a Computer System
• Goal• To maximize the work, the user performing
• Ease of use
• Don’t care about Resource utilization
• Shared computer Mainframe / Minicomputer• Share Resources• Exchange Information• Designed to maximize Resource utilization• All Available CPU Time, Memory and I/O used efficiently
10Unit-I: Introduction
User View
• Workstations• Connected to Networks of other workstations and Servers• Dedicated Resources at disposal• Also Share Resources such as Networking and Servers
• Handheld Computers• Standalone units for Individual users• Connected to Networks
(Directly by wire / through wireless Modems and Networking)
• Perform relatively few remote operations (Power, Speed, Interface limitations)
• Designed mostly for individual usability
• Embedded Computers in Home Devices and Automobiles• Have Numeric Keypads• May turn indicator lights on or off to show status• Designed primarily to run without user intervention
11Unit-I: Introduction
|<<
User View
Most intimately involved with Hardware
• Resource Allocator• Acts as Manager of Resources.
• Decides to allocate Resources to Specific Programs and Users so that OS operates the Computer System Efficiently and Fairly
• Important when many Users access the same computer
• Control Program• Controls Execution of User Programs to prevent Errors and Improper use of
Computer
• Concerned with Operation and Control of I/O Devices
12Unit-I: Introduction
|<<
System View
Operating System Definition
• OS is a resource allocator– Manages all resources– 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
13Unit-I: Introduction
Operating System Definition (Cont.)
• No universally accepted definition
• “The one program running at all times on the computer” is the kernel. Everything else is either a system program (ships with the operating system) or an application program.
14Unit-I: Introduction
Overview
• Multiprogramming: Running multiple programs “at the same time”– Requires multiplexing (sharing) the CPU
• Transfer of control is called a context switch
15Unit-I: Introduction
Computer System Organization• Computer-system operation
– One or more CPUs, device controllers connect through common bus providing access to shared memory
– Concurrent execution of CPUs and devices competing for memory cycles
16Unit-I: Introduction
• Essential part of a Computer System
• Provides an Environment within which Other programs can do Useful work
• Program running at all times on the Computer (Kernel)
• Program that Manages Computer Hardware
• Program that acts as an intermediary between the User of a Computer and the Computer Hardware
• PurposeTo provide an environment in which a User can Execute Programs
in a Convenient and Efficient manner
18Unit-I: Introduction
Objectives and Functions of Operating System
• Must Ensure Correct Operation of Computer System
• Provides Certain Services to Programs and to the users of those programs in order to make their Tasks Easier
• Controls and Coordinates the use of Hardware among Various Application Programs for the Various users
• Primary GoalsUser friendlyEfficient Operation of the Computer System
19Unit-I: Introduction
|<<
Objectives and Functions of Operating System
20
Evolution of Operating Systems
• Serial Processing– No operating system– Machines run from a console with display lights,
toggle switches, input device, and printer– Schedule time– Setup included loading the compiler, source
program, saving compiled program, and loading and linking
Unit-I: Introduction
21
Evolution of Operating Systems
• Simple Batch Systems– Monitors• Software that controls the sequence of events• Batch jobs together• Program branches back to monitor when finished
Unit-I: Introduction
22
Hardware Features
• Memory protection– Do not allow the memory area containing the
monitor to be altered
• Timer– Prevents a job from monopolizing the system
Unit-I: Introduction
23
Hardware Features
• Privileged instructions– Certain machine level instructions can only be
executed by the monitor
• Interrupts– Early computer models did not have this capability
Unit-I: Introduction
24
Memory Protection
• User program executes in user mode– Certain instructions may not be executed
• Monitor executes in system mode– Kernel mode– Privileged instructions are executed– Protected areas of memory may be accessed
Unit-I: Introduction
25
Major Achievements
• Processes• Memory Management• Information protection and security• Scheduling and resource management• System structure
Unit-I: Introduction
27
Uniprogramming
• Processor must wait for I/O instruction to complete before preceding
Unit-I: Introduction
No. of Programs in execution.
Increases CPU utilisation by organizing jobs so thatthe CPU always has one job to execute.
CPU is never idle.
OS Keeps several jobs in memory simultaneously.Picks and begins to execute one of the jobs in the memory.
Job may have to wait for some task (I/O operation) and OS simply switches to, and executes, another job.
When that job needs to wait, the CPU is switched to another job, and so on.
When the first job finishes waiting, it gets the CPU back.
Allow time-sharing.
28Unit-I: Introduction
|<<
Multiprogramming
• Multiple Tasks are performed during the Same period of time.
• Tasks Share Common Processing Resourcessuch as CPU and Main Memory.
• In Uniprocessor Systems, Multitasking Solves the problem by Scheduling which task may be the one running at any given time, and when another waiting task gets a turn.
Context Switch • Act of reassigning a CPU from one task to another one.
29Unit-I: Introduction
|<<
Multitasking / Multiprocessing
30
Multiprogramming
• When one job needs to wait for I/O, the processor can switch to the other job
Unit-I: Introduction
32
Time Sharing
• Using multiprogramming to handle multiple interactive jobs
• Processor’s time is shared among multiple users
• Multiple users simultaneously access the system through terminals
Unit-I: Introduction
33
Compatible Time-Sharing System (CTSS)
• First time-sharing system developed at MIT
Unit-I: Introduction
Allows for Multiple users to use the Same Computer at the Same time and Different times.
34Unit-I: Introduction
|<<
Multiuser
• Operating Systems that allow Different parts of a Software program to run Concurrently.
• Examples• Linux• Unix• Windows 2000
• Applications• Any kind of application which has Distinct tasks which can
be performed independently.
• Any application with a GUI.
• Any application which requires Asynchronous response.
• Network based applications are ideally suited.
35Unit-I: Introduction
|<<
Multithreading
• Batch Processing Systems
• Interactive Systems
• Time Sharing
• Time Slicing
• Distributed Systems
• Network Systems
• Real–Time Systems
36Unit-I: Introduction
Types of Operating Systems|<<
Computer runs one and only one application at a time.
Early Computers were physically enormous machines run from a console.
Common input devices Card readersTape drives
Common output devicesLine printersTape drivesCard punches
37Unit-I: Introduction
Batch Processing Systems
OS always resident in memory.
CPU is often idle.
User did not interact directly with computer systems.
User prepared a job and submitted to computer operator.
Operators batched together jobs with similar needs and run them through the computer as a group.
Programmers would leave their programs with the operator.
The operator would sort the programs into batches with similar requirements and as the computer became available would run each job.
38Unit-I: Introduction
|<<
Batch Processing
• User and Computer System interact.
• User Requests.
• System Responds.
• The process goes on.
39Unit-I: Introduction
|<<
Interactive Processing
Variable CPU Time to different processes.
Once CPU Time is allocated to a process, will not be interrupted till it completes its execution, or waiting for an I/O,
or cannot continue its execution.
40Unit-I: Introduction
|<<
Time Sharing
• Distribute the Computation among Several Physical Processors
• Loosely Coupled System• Each Processor has its Own Local Memory
• Processors Communicate with one another thru Various Communications lines, such as High–Speed buses.
• Enables Parallelism but speed up is not the goal
42Unit-I: Introduction
Distributed Systems
• Advantages of Distributed Systems• Resources Sharing• Computation Speed up–load Sharing
• Reliability• Communications
• Distributed Operating System• Less Autonomy between Computers• Gives the impression, Single Operating System Controlling the Network
• Types of Distributed Systems• Client–Server Systems• Peer–to–Peer Systems
43Unit-I: Introduction
|<<
Distributed Systems
• Equal Amount of CPU time allocated among Various Processes.
• Autonomy between computers• File sharing, exchange of information between computers
44Unit-I: Introduction
Network Systems|<<
• Special purpose OS.•
• Used when rigid time requirements have been placed on the operation of a processor or the flow of data.
•
• Used as control device in a dedicated application. Accurate response time.
• Sensors bring data to the computer. • The computer analyses the data and possibly adjust controls to modify
the sensor inputs.
• Well-defined, Fixed-time constraints.
• Processing must be done within the defined constraints.
Ex: Systems controlling scientific experimentsMedical imaging systemsIndustrial control systemsCertain display systemsAutomobile-engine fuel-injection systemsHome-appliance controllersWeapon systems
45Unit-I: Introduction
Real–Time Systems
Hard real-time systemsGuarantee critical tasks be completed on time.
Soft real-time systemsCritical real-time task gets priority over other tasks
and retains the priority until it completes.
Ex: Multimedia Advanced scientific projects Undersea exploration Planetary rovers
46Unit-I: Introduction
|<<
Types of Real–Time Systems
|<<Various Operating System Services
Provides No. of Services.
Lowest level – System CallsAllow running program to make requests
from the OS directly.
Higher level – Command Interpreter or ShellUser issues request without writing program.
CategoriesProgram ControlStatus RequestsI/O Requests
48Unit-I: Introduction
Operating System Services
– User Interface
– Program Execution
– I/O Operations
– File-System Manipulation
– Communications
– Error Detection
– Other Services
• Resource Allocation
• Accounting
• Protection and Security
49Unit-I: Introduction
|<<
• All Operating Systems have User Interface (UI)
• Command-Line Interface (CLI)
• Graphics User Interface (GUI)
50Unit-I: Introduction
|<<User Interface
• Load Program into Memory
• Run the Program
• End Execution, either Normally or Abnormally (indicating Error)
51Unit-I: Introduction
Program Execution|<<
Running Program may require I/O,
which may involve File or I/O Device.
52Unit-I: Introduction
I/O Operations|<<
Programs need to
Read and Write Files and Directories,
Create and Delete Files and Directories,
Search Files and Directories,
List File Information,
Permission Management.
53Unit-I: Introduction
File–System Manipulation|<<
Processes may exchange information, on the Same Computer or between Computers over a Network
Communications may be via – Shared Memory or – thru Message Passing (Packets moved by the Operating System)
54Unit-I: Introduction
Communications|<<
• May occur in – the CPU and Memory Hardware, – I / O Devices, – User Program
• For each type of Error, – OS should take the appropriate action
to ensure correct and consistent computing
• Debugging facilities – can greatly enhance the User’s and Programmer’s abilities
to efficiently use the System
55Unit-I: Introduction
Error Detection|<<
When Multiple Users or Multiple Jobs running Concurrently,
Resources must be Allocated to each of them.
56Unit-I: Introduction
Resource Allocation|<<
To Keep Track of
Which Users use How much
What Kinds of Computer Resources
57Unit-I: Introduction
Accounting|<<
• Protection – Involves ensuring that all Access to System Resources is Controlled
• Security of the System – from outsiders requires User Authentication, – extends to defending External I / O Devices from Invalid Access
attempts
58Unit-I: Introduction
Protection and Security|<<
• Hardware
• Operating System
• Application Programs
• Users
59Unit-I: Introduction
Basic Structure/Components of a Computer System
Central Processing Unit (CPU)
Memory
Input–Output (I/O) / Peripheral Devices
•Provides basic Computing Resources.
60Unit-I: Introduction
Hardware
Word Processors (MS–Word)
Spreadsheets (MS–Excel)
Compilers (C, Java, …)
Web Browsers (Internet Explorer, Mozilla)
Database Systems
Video Games
Define the ways in which the resources are used to solve the computing problems of the users.
61Unit-I: Introduction
Application Programs
|<<System Calls and Programs
63Unit-I: Introduction
• System Calls• Types of System Calls
• System Programs
Unit-I: Introduction
System Calls
System call is a Programming interface to the services provided by the OS
It provides Interface between Running Program and the Operating System.
Generally available as Assembly–Language Instructions.
• 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.
• Methods used to Pass Parameters between a Running Program and the Operating System.
– Pass Parameters in Registers.– Store the Parameters in a Table in Memory, and the Table Address is passed as a
Parameter in a Register.– Push (store) the Parameters onto the Stack by the Program, and Pop off the Stack by
Operating System.
64
|<<
Typically a number is associated with each system call.System call interface maintains a table indexed according to
these numbersThe System call interface invokes the intended system call in OS
kernel and returns the status of the system call and any return values.
• The caller need know nothing about how the system call is implemented
• Just needs to obey API and understand what OS will do as a result call
• Most details of OS interface hidden from programmer by API
Unit-I: Introduction 66
Unit-I: Introduction
Types of System Calls
• Process Control
• File Management
• Device Management
• Information Maintenance
• Communications
• Example
67
|<<
• End, Abort
• Load, Execute
• Create Process, Terminate Process
• Get Process Attributes, Set Process Attributes
• Wait for time
• Wait Event, Signal Event
• Allocate and Free Memory
68Unit-I: Introduction
|<<System Calls – Process Control
• Create File, Delete File
• Open, Close
• Read, Write, Reposition
• Get File attributes, Set File attributes
69Unit-I: Introduction
|<<System Calls – File Management
• Request Device, Release Device
• Read, Write, Reposition
• Get Device attributes, Set Device attributes
• Logically Attach or Detach Devices
70Unit-I: Introduction
|<<System Calls – Device Management
Unit-I: Introduction 71
• Get Time or Date, Set Time or Date
• Get System Data, Set System Data
• Get Process, File, or Device attributes
• Set Process, File, or Device attributes
|<<System Calls – Information Maintenance
Unit-I: Introduction 72
• Create, Delete Communication connection
• Send, Receive Messages
• Transfer Status information
• Attach or Detach Remote Devices
|<<System Calls – Communications
System Call Sequence to Copy the contents of One file to another file.
73Unit-I: Introduction
|<<Example of System Calls
Unit-I: Introduction 74
Provide Convenient environment for Program Development and execution.
Categories
•File Management
•Status information
•File Modification
•Programming Language Support
•Program Loading and Execution
•Communications
|<<System Programs
Unit-I: Introduction 75
Create
Delete
Copy
Rename
Dump
List
Manipulate Files and Directories
|<<System Programs – File Management
Unit-I: Introduction 76
Date
Time
Amount of available Memory / Disk Space
No. of users
…
|<<System Programs – Status information
Unit-I: Introduction 77
Text Editors
To Create and Modify the Contents of Files Stored on Disk or Tape.
Screen Editor – vi
Line Editor – edlin, ed, …
|<<System Programs – File modification
Unit-I: Introduction 78
• Compilers
• Assemblers
• Interpreters
|<<
System Programs – Programming Language Support
Unit-I: Introduction 79
• Absolute Loaders
• Relocatable Loaders
• Linkage Editors
• Overlay Loaders
• Debugging Systems
|<<System Programs – Program Loading & Execution
Unit-I: Introduction 80
Provide mechanism for creating virtual connections among processes, users and different computer
systems.
Allow users to Send messages to one another’s Screens.Browse Web pages.Send Electronic Mail messages.Log-in Remotely.Transfer Files from one machine to another.
|<<System Programs – Communications
Exam Questions1. Define OS.
2. Write about Evolution of Operating Systems.
3. Explain basic Structure of a Computer System & also Explain its basic elements.
4. Discuss the basic components of a virtual computer.
5. What are OS Objectives?
6. What is an Operating System? Explain the functions of OS.
7. Discuss the various approaches of designing an operating system.
8. Write about Multitasking.
9. Explain the concept of Multiprogramming. 81Unit-I: Introduction
Exam Questions
10. What are the multi-tasking, multi-programming and multi-threading?
11. Explain the following:a. Multiprogrammingb. Timesharingc. Virtual Memory
12. What are Distributed Operating Systems?
13. What are the types of real-time systems?
14. What is dispatcher?
15. What is a system call? Explain the categories of system calls.
16. What is a system call? Explain different types of system calls.
|<<
82Unit-I: Introduction