Syllabus
Modul
e
No
Module Content
1. Operating
System
Overview
1.1 Introduction, Objectives, Functions and Evolution
of Operating System
1.2 Operating system structures: Layered, Monolithic
and Microkernel
1.3 Linux Kernel, Shell and System Calls
2. Process
and
Process
Scheduling
2.1 Concept of a Process, Process States, Process
Description, Process Control Block.
2.2 Uniprocessor Scheduling-Types: Preemptive and
Non-preemptive scheduling algorithms (FCFS, SJF,
SRTN, Priority, RR)
2.3 Threads: Definition and Types, Concept of
Multithreading
Syllabus
Mod
ule
No
Module Content
3. Process
Synchronization
and Deadlocks
3.1 Concurrency: Principles of Concurrency,
Inter-Process Communication, Process
Synchronization.
3.2 Mutual Exclusion: Requirements, Hardware
Support (TSL), Operating System Support
(Semaphores),Producer and Consumer problem.
3.3 Principles of Deadlock: Conditions and
Resource Allocation Graphs, Deadlock
Prevention, Deadlock Avoidance: Banker’s
Algorithm, Deadlock Detection and Recovery,
Dining Philosophers Problem.
Syllabus
Mod
ule
No
Module Content
4. Memory
Management
4.1 Memory Management Requirements, Memory
Partitioning: Fixed Partitioning, Dynamic
Partitioning, Memory Allocation Strategies: Best-
Fit, First Fit, Worst Fit, Next Fit. Paging and
Segmentation,TLB.
4.2 Virtual Memory: Demand Paging, Page
Replacement Strategies: FIFO, Optimal, LRU,
Thrashing.
5. File
Management
5.1 Overview, File Organization and Access, File
Directories, File Sharing
Syllabus
Mod
ule
No
Module Content
6. Input /Output
Management
6.1 I/O devices, Organization of the I/O Function, Disk
Organization, I/O Management and Disk
Scheduling: FCFS, SSTF, SCAN, CSCAN, LOOK, C-
LOOK.
Operating System Lab
Term Work:
1 Term work should consist of 10 experiments covering all
modules.
2 Journal must include at least 2 assignments on content
of theory and practical of “Operating System”
3 The final certification and acceptance of term work
ensures that satisfactory performance of laboratory work
and minimum passing marks in term work.
4 Total 25 Marks (Experiments: 15-marks, Attendance
Theory& Practical: 05-marks, Assignments: 05-marks)
K IRT I L M O T WA NI
XIE
Introduction to Operating
Systems
Operating System : Definition
 OS is a program that controls the execution of
application programs and acts as interface
between the application and hardware.
 It is the software layer, nearest to hardware
which facilitates launching of all the other
software utilities and applications.
 OS provides wide range of generic data services.
 Manages keyboard, display, processor, memory
and other devices.
 Schedules input, output and data processing.
User and OS
 OS facilitates use of resources by hiding local details and
presenting an interface which is convenient to use.
 For instance : computer games, e-mail, browsing or
preparing documents are applications launched by simply
clicking on icons.
Operating System Objectives
 Convenience: OS makes a computer more
convenient to use.
 Efficiency: OS should use computer resources in
an efficient manner.
 Ability to evolve: OS should be constructed in
such a way that any development, testing and
introduction of new system functions can be done
without interfering with service.
Services Provided by the OS
 Program development
 Editors and debuggers
 Program execution
 Access I/O devices
 Controlled access to files
 System access
Services Provided by the OS
 Error detection and response
 Internal and external hardware errors
 Software errors
 Operating system cannot grant request of application
 Accounting
 Collect usage statistics
 Monitor performance
 Used to anticipate future enhancements
 On a multi user system, for billing purposes
Operating System
 Responsible for managing resources
 Functions same way as ordinary computer software
 It is a program that is executed
 Operating system relinquishes control of the
processor
OS as Resource Manager
OS as Resource Manager
Basic Elements
 Processor
 Two internal registers
 Memory address resister (MAR)
 Specifies the address for the next read or write
 Memory buffer register (MBR)
 Contains data written into memory or receives data read from
memory
 I/O address register
 I/O buffer register
Basic Elements
 Main Memory
 Volatile
 Referred to as real memory or primary memory
 Another term for main memory is RAM.
 I/O Modules
 Secondary Memory Devices
 Communications equipment
 Terminals
 System bus
 Communication among processors, main memory, and I/O modules
Computer Components: Top-Level View
Evolution of Operating Systems
 Hardware upgrades plus new types of hardware
 New services
 Fixes
Evolution of Operating Systems
 Serial processing
 No operating system
 Machines run from a console with display lights,
toggle switches, input device, and printer
 Drawbacks
o Scheduling
o Set up time
Evolution of Operating Systems
 Simple batch system
 Earlier machines were very expensive, so it was important to
maximize machine utilization.
 To improve utilization concept of batch operating system was
developed.
 Monitor
 Software that controls the sequence of events
 Batch jobs together
 Each program was designed in such a way that after the program
execution, control is returned to monitor.
 Portion of monitor always resides in main memory and available
for execution is called resident monitor.
1. Part of monitor is
running to determine
which program to run
2. Selected program is
running
3. After program
completes execution,
control returns to
monitor.
Job Control Language
 Special type of programming language
 Provides instruction to the monitor
 What compiler to use
 What data to use
Hardware Features
 Memory protection
 Does not allow the memory area containing the monitor to be
altered
 Timer
 Prevents a job from monopolizing the system
Hardware Features
 Privileged instructions
 Certain machine level instructions can only be executed by the
monitor
 Interrupts
 Early computer models did not have this capability
Memory Protection
 User program executes in user mode
 Certain instructions may not be executed
Memory Protection
 Monitor executes in system mode
 Kernel mode
 Privileged instructions are executed
 Protected areas of memory may be accessed
Uniprogramming
 Processor must wait for I/O instruction to complete
before proceeding
Multiprogramming
 When one job needs to wait for I/O, the processor
can switch to the other job
Multiprogramming
Multi Programmed Systems
 Several jobs are kept in main memory at the same time,
and the CPU is multiplexed among them.
 High CPU utilization compared to batch processing.
 Keeps multiple runnable jobs loaded in memory
 Overlaps I/O processing of a job with computation of
another.
 Requires the use of interrupts and DMA.
 Optimizes system throughput (number of jobs finished in a
given amount of time) at the cost of response time.
First Generation Computers
 Vaccum tubes
 Big and Clumsy
 Magnetic Drum
 High Electricity
Consumption
 Hard wire programs in
Computers
 No operating system
Second Generation Computers
 Transistors
 Smaller
 Lower Electricity
Consumption
 Magnetic Cores
 Punch Cards
 computer programming
languages were
developed
 computers had memory
and operating systems.
Third Generation Computers
 Silicon chips
 HLL appeared
 Core IC’s
 Keyboard Entry
Fourth Generation Computers
 more powerful
 compact
 Reliable
 Affordable
 gave rise to Personal
Computer (PC) Revolution
 time sharing, real time
networks, distributed
operating system were used
Kernel and Shell
Kernel
 Heart and core of an Operating System.
 Whenever a system starts, the Kernel is the first program that is
loaded after the bootloader because the Kernel has to handle the
rest of the thing of the system for the Operating System.
 Remains in the main memory until the Operating System is shut-
down.
 Responsible for low-level tasks such as disk management,
memory management, task management, etc.
 Provides an interface between the user and the hardware
components of the system.
 Portion of operating system that is in main memory
 Contains most frequently used functions
 Also called the nucleus
Shell
 The shell program layer is in direct contact with the kernel.
 When a user logs in, the login program checks the username
and password, and then starts another program called the
shell.
 The shell is a command line interpreter (CLI).
 It interprets the commands the user types in and arranges
for them to be carried out.
 The commands are themselves programs: when they
terminate, the shell gives the user another prompt.
 The shell acts as an interface between the user and the
kernel.
Kernel and shell example
 After you finish logging on, the shell program
layer is in direct contact with the kernel.
 As you type a command such as $ ls, the shell
locates the actual program file, /bin/ls, and passes
it to the kernel to execute.
 The kernel creates a new child process area, loads
the program, and executes the instructions in
/bin/ls.
 After program completion, the kernel recovers the
process area and returns control to the parent
shell program.
Types of Shell
 Command Line Interface:
 It is very less resource intensive.
 User needs to remember the commands.
 e.g. DOS, Unix
 Graphic User Interface
 User need not remember the commands.
 It is highly resource intensive.
Kernel
 Innermost layer of the Operating system close to the
hardware.
 Heart of the operating systems.
 It allocates time and memory to programs and handles
the filestore and communications in response to
system calls.
Modes of Execution
 User Mode
 Kernel Mode
User Mode
 The user programs run in this mode.
 Less privileged mode as no system related
activities can be performed in this mode.
Kernel Mode
 Also referred as System mode or control mode
 Operating system runs in this mode.
 High privileged mode as system related activities
can be performed in this mode.
 Primitive I/O operations
 Memory management functions
 Some portion of memory can be accessed only in this mode.
System Call
 System call is the mechanism by which user programs
can request some services from OS.
User Program 1
User Program 2
1
2
3
4
User
Mode
Kernel
Mode
Standard C Library Example
Types of System Calls
 Process control
 File management
 Device management
 Information maintenance
 Communications
 Protection
Examples of Windows and Unix System Calls
Kernel Design Strategies (Operating Structures)
 Monolithic Approach
 Layered Approach
 Microkernel Architecture
Monolithic Approach
Application
Program
System Call Interface
Hardware
Kernel Mode
User Mode
Application
Program
Monolithic Approach
 Modules of OS are not organized in a well-defined manner. i.e.
there is no specific structure.
 A module can call any other module without any major
restriction.
 Since there were very few interfaces between the application
programs and the underlying hardware Monolithic OS deliver
good performance.
 It is extremely difficult to enhance or maintain such OS as
modifications to one module can adversely affect other component
modules.
 Errors were more difficult to isolate, and there was a high risk of
damage due to erroneous or malicious code.
Layered Approach
Layer Function
5 The operator
4 User programs
3 Input/output
Management
2 Operator-process
Communication
1 Memory and drum
Management
0 Processor
allocation and
Multiprogramming
Application
Program
System Call Interface
Hardware
Kernel Mode
User Mode
Application
Program
Layer N
Layer 0
Layer 1
Layered Approach
 OS is broken into number of layers.
 The bottom layer is hardware (layer 0) and the highest layer
is user interface.
 The main advantage of layered approach is simplicity of
construction and debugging.
 The layers are selected so that each uses
functions(operations) and services of only lower layers.
 This approach simplifies debugging and verification.
 Difficulty in defining layers.
Microkernel Architecture
Application
Program
File
Server
Display
Server
Microkernel
Hardware
Kernel Mode
User Mode
Microkernel Architecture
 Though layered OS was more systematic in terms of design
and operation, they were proven less efficient.
 Because as the designers of OS started adding more and more
features the kernel became ‘too heavy’ and unmanageable.
 In microkernel approach, the kernel provides only the most
essential OS functions like process management,
communication primitives and low level memory
management.
 System programs or user level programs are implemented
outside the kernel, provide the remaining OS services. These
programs are called servers.
Microkernel Architecture
 Thus, the size of kernel reduces dramatically making it a
Microkernel.
 Application programs and various servers communicate
with each other using messages that pass through the
Microkernel.
 The Microkernel validates the messages, passes them
between the various models of OS and permits access to the
hardware.
Microkernel Architecture
 Advantages
 This approach makes system very robust.
 If there is problem with a particular server then the service can be
reconfigured and restarted without having to restart the entire OS.
 The system is extensible i.e. a new service can be easily added simply
by adding a new server without affecting the other parts of the system.
 Disadvantages
 This approach is inefficient and slower due to the overheads incurred
by the extensive message passing between application programs and
servers.
 The size of Microkernel was not very small thus occupying considerable
portion of memory.

os-lect 1-Intro (3).pdf by buddha and GOD

  • 1.
    Syllabus Modul e No Module Content 1. Operating System Overview 1.1Introduction, Objectives, Functions and Evolution of Operating System 1.2 Operating system structures: Layered, Monolithic and Microkernel 1.3 Linux Kernel, Shell and System Calls 2. Process and Process Scheduling 2.1 Concept of a Process, Process States, Process Description, Process Control Block. 2.2 Uniprocessor Scheduling-Types: Preemptive and Non-preemptive scheduling algorithms (FCFS, SJF, SRTN, Priority, RR) 2.3 Threads: Definition and Types, Concept of Multithreading
  • 2.
    Syllabus Mod ule No Module Content 3. Process Synchronization andDeadlocks 3.1 Concurrency: Principles of Concurrency, Inter-Process Communication, Process Synchronization. 3.2 Mutual Exclusion: Requirements, Hardware Support (TSL), Operating System Support (Semaphores),Producer and Consumer problem. 3.3 Principles of Deadlock: Conditions and Resource Allocation Graphs, Deadlock Prevention, Deadlock Avoidance: Banker’s Algorithm, Deadlock Detection and Recovery, Dining Philosophers Problem.
  • 3.
    Syllabus Mod ule No Module Content 4. Memory Management 4.1Memory Management Requirements, Memory Partitioning: Fixed Partitioning, Dynamic Partitioning, Memory Allocation Strategies: Best- Fit, First Fit, Worst Fit, Next Fit. Paging and Segmentation,TLB. 4.2 Virtual Memory: Demand Paging, Page Replacement Strategies: FIFO, Optimal, LRU, Thrashing. 5. File Management 5.1 Overview, File Organization and Access, File Directories, File Sharing
  • 4.
    Syllabus Mod ule No Module Content 6. Input/Output Management 6.1 I/O devices, Organization of the I/O Function, Disk Organization, I/O Management and Disk Scheduling: FCFS, SSTF, SCAN, CSCAN, LOOK, C- LOOK.
  • 5.
    Operating System Lab TermWork: 1 Term work should consist of 10 experiments covering all modules. 2 Journal must include at least 2 assignments on content of theory and practical of “Operating System” 3 The final certification and acceptance of term work ensures that satisfactory performance of laboratory work and minimum passing marks in term work. 4 Total 25 Marks (Experiments: 15-marks, Attendance Theory& Practical: 05-marks, Assignments: 05-marks)
  • 6.
    K IRT IL M O T WA NI XIE Introduction to Operating Systems
  • 7.
    Operating System :Definition  OS is a program that controls the execution of application programs and acts as interface between the application and hardware.  It is the software layer, nearest to hardware which facilitates launching of all the other software utilities and applications.  OS provides wide range of generic data services.  Manages keyboard, display, processor, memory and other devices.  Schedules input, output and data processing.
  • 8.
    User and OS OS facilitates use of resources by hiding local details and presenting an interface which is convenient to use.  For instance : computer games, e-mail, browsing or preparing documents are applications launched by simply clicking on icons.
  • 9.
    Operating System Objectives Convenience: OS makes a computer more convenient to use.  Efficiency: OS should use computer resources in an efficient manner.  Ability to evolve: OS should be constructed in such a way that any development, testing and introduction of new system functions can be done without interfering with service.
  • 10.
    Services Provided bythe OS  Program development  Editors and debuggers  Program execution  Access I/O devices  Controlled access to files  System access
  • 11.
    Services Provided bythe OS  Error detection and response  Internal and external hardware errors  Software errors  Operating system cannot grant request of application  Accounting  Collect usage statistics  Monitor performance  Used to anticipate future enhancements  On a multi user system, for billing purposes
  • 12.
    Operating System  Responsiblefor managing resources  Functions same way as ordinary computer software  It is a program that is executed  Operating system relinquishes control of the processor
  • 13.
  • 14.
  • 15.
    Basic Elements  Processor Two internal registers  Memory address resister (MAR)  Specifies the address for the next read or write  Memory buffer register (MBR)  Contains data written into memory or receives data read from memory  I/O address register  I/O buffer register
  • 16.
    Basic Elements  MainMemory  Volatile  Referred to as real memory or primary memory  Another term for main memory is RAM.  I/O Modules  Secondary Memory Devices  Communications equipment  Terminals  System bus  Communication among processors, main memory, and I/O modules
  • 17.
  • 18.
    Evolution of OperatingSystems  Hardware upgrades plus new types of hardware  New services  Fixes
  • 19.
    Evolution of OperatingSystems  Serial processing  No operating system  Machines run from a console with display lights, toggle switches, input device, and printer  Drawbacks o Scheduling o Set up time
  • 20.
    Evolution of OperatingSystems  Simple batch system  Earlier machines were very expensive, so it was important to maximize machine utilization.  To improve utilization concept of batch operating system was developed.  Monitor  Software that controls the sequence of events  Batch jobs together  Each program was designed in such a way that after the program execution, control is returned to monitor.  Portion of monitor always resides in main memory and available for execution is called resident monitor.
  • 21.
    1. Part ofmonitor is running to determine which program to run 2. Selected program is running 3. After program completes execution, control returns to monitor.
  • 22.
    Job Control Language Special type of programming language  Provides instruction to the monitor  What compiler to use  What data to use
  • 23.
    Hardware Features  Memoryprotection  Does not allow the memory area containing the monitor to be altered  Timer  Prevents a job from monopolizing the system
  • 24.
    Hardware Features  Privilegedinstructions  Certain machine level instructions can only be executed by the monitor  Interrupts  Early computer models did not have this capability
  • 25.
    Memory Protection  Userprogram executes in user mode  Certain instructions may not be executed
  • 26.
    Memory Protection  Monitorexecutes in system mode  Kernel mode  Privileged instructions are executed  Protected areas of memory may be accessed
  • 27.
    Uniprogramming  Processor mustwait for I/O instruction to complete before proceeding
  • 28.
    Multiprogramming  When onejob needs to wait for I/O, the processor can switch to the other job
  • 29.
  • 30.
    Multi Programmed Systems Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them.  High CPU utilization compared to batch processing.  Keeps multiple runnable jobs loaded in memory  Overlaps I/O processing of a job with computation of another.  Requires the use of interrupts and DMA.  Optimizes system throughput (number of jobs finished in a given amount of time) at the cost of response time.
  • 31.
    First Generation Computers Vaccum tubes  Big and Clumsy  Magnetic Drum  High Electricity Consumption  Hard wire programs in Computers  No operating system
  • 32.
    Second Generation Computers Transistors  Smaller  Lower Electricity Consumption  Magnetic Cores  Punch Cards  computer programming languages were developed  computers had memory and operating systems.
  • 33.
    Third Generation Computers Silicon chips  HLL appeared  Core IC’s  Keyboard Entry
  • 34.
    Fourth Generation Computers more powerful  compact  Reliable  Affordable  gave rise to Personal Computer (PC) Revolution  time sharing, real time networks, distributed operating system were used
  • 35.
  • 36.
    Kernel  Heart andcore of an Operating System.  Whenever a system starts, the Kernel is the first program that is loaded after the bootloader because the Kernel has to handle the rest of the thing of the system for the Operating System.  Remains in the main memory until the Operating System is shut- down.  Responsible for low-level tasks such as disk management, memory management, task management, etc.  Provides an interface between the user and the hardware components of the system.  Portion of operating system that is in main memory  Contains most frequently used functions  Also called the nucleus
  • 37.
    Shell  The shellprogram layer is in direct contact with the kernel.  When a user logs in, the login program checks the username and password, and then starts another program called the shell.  The shell is a command line interpreter (CLI).  It interprets the commands the user types in and arranges for them to be carried out.  The commands are themselves programs: when they terminate, the shell gives the user another prompt.  The shell acts as an interface between the user and the kernel.
  • 38.
    Kernel and shellexample  After you finish logging on, the shell program layer is in direct contact with the kernel.  As you type a command such as $ ls, the shell locates the actual program file, /bin/ls, and passes it to the kernel to execute.  The kernel creates a new child process area, loads the program, and executes the instructions in /bin/ls.  After program completion, the kernel recovers the process area and returns control to the parent shell program.
  • 39.
    Types of Shell Command Line Interface:  It is very less resource intensive.  User needs to remember the commands.  e.g. DOS, Unix  Graphic User Interface  User need not remember the commands.  It is highly resource intensive.
  • 40.
    Kernel  Innermost layerof the Operating system close to the hardware.  Heart of the operating systems.  It allocates time and memory to programs and handles the filestore and communications in response to system calls.
  • 41.
    Modes of Execution User Mode  Kernel Mode
  • 42.
    User Mode  Theuser programs run in this mode.  Less privileged mode as no system related activities can be performed in this mode.
  • 43.
    Kernel Mode  Alsoreferred as System mode or control mode  Operating system runs in this mode.  High privileged mode as system related activities can be performed in this mode.  Primitive I/O operations  Memory management functions  Some portion of memory can be accessed only in this mode.
  • 44.
    System Call  Systemcall is the mechanism by which user programs can request some services from OS. User Program 1 User Program 2 1 2 3 4 User Mode Kernel Mode
  • 45.
  • 46.
    Types of SystemCalls  Process control  File management  Device management  Information maintenance  Communications  Protection
  • 47.
    Examples of Windowsand Unix System Calls
  • 48.
    Kernel Design Strategies(Operating Structures)  Monolithic Approach  Layered Approach  Microkernel Architecture
  • 49.
    Monolithic Approach Application Program System CallInterface Hardware Kernel Mode User Mode Application Program
  • 50.
    Monolithic Approach  Modulesof OS are not organized in a well-defined manner. i.e. there is no specific structure.  A module can call any other module without any major restriction.  Since there were very few interfaces between the application programs and the underlying hardware Monolithic OS deliver good performance.  It is extremely difficult to enhance or maintain such OS as modifications to one module can adversely affect other component modules.  Errors were more difficult to isolate, and there was a high risk of damage due to erroneous or malicious code.
  • 51.
    Layered Approach Layer Function 5The operator 4 User programs 3 Input/output Management 2 Operator-process Communication 1 Memory and drum Management 0 Processor allocation and Multiprogramming Application Program System Call Interface Hardware Kernel Mode User Mode Application Program Layer N Layer 0 Layer 1
  • 52.
    Layered Approach  OSis broken into number of layers.  The bottom layer is hardware (layer 0) and the highest layer is user interface.  The main advantage of layered approach is simplicity of construction and debugging.  The layers are selected so that each uses functions(operations) and services of only lower layers.  This approach simplifies debugging and verification.  Difficulty in defining layers.
  • 53.
  • 54.
    Microkernel Architecture  Thoughlayered OS was more systematic in terms of design and operation, they were proven less efficient.  Because as the designers of OS started adding more and more features the kernel became ‘too heavy’ and unmanageable.  In microkernel approach, the kernel provides only the most essential OS functions like process management, communication primitives and low level memory management.  System programs or user level programs are implemented outside the kernel, provide the remaining OS services. These programs are called servers.
  • 55.
    Microkernel Architecture  Thus,the size of kernel reduces dramatically making it a Microkernel.  Application programs and various servers communicate with each other using messages that pass through the Microkernel.  The Microkernel validates the messages, passes them between the various models of OS and permits access to the hardware.
  • 56.
    Microkernel Architecture  Advantages This approach makes system very robust.  If there is problem with a particular server then the service can be reconfigured and restarted without having to restart the entire OS.  The system is extensible i.e. a new service can be easily added simply by adding a new server without affecting the other parts of the system.  Disadvantages  This approach is inefficient and slower due to the overheads incurred by the extensive message passing between application programs and servers.  The size of Microkernel was not very small thus occupying considerable portion of memory.