2. What is Operating System?
• Acts as an intermediary between the computer
user and the computer hardware.
• Some operating systems are designed to be
convenient, others to be efficient, and others
some combination of the two.
An operating system is a program that manages the computer hardware.
05-02-2024 Ms. Rashmi Bhat 2
3. A little History…
• 1st generation computers introduced in the year 1940, did not have any
operating systems.
• First operating system was introduced in 1956 by General Motors and it
was developed for IBM mainframe computers, known as GMOS.
• Unix and MS-DOS
• Linux and Microsoft Windows
• Android and IOS
05-02-2024 Ms. Rashmi Bhat 3
4. Overview of an Operating System
05-02-2024 Ms. Rashmi Bhat 4
• Hardware
• Provides basic computing resources
• CPU
• Memory
• I/O Devices
• Application Programs
• Define the ways in which these resources are used
to solve users' computing problems.
• Operating System
• Controls the hardware and coordinates its use
among the various application programs for the
various users.
System and Application Programs
Operating System
Hardware
Components of a computer System
. . .
5. Overview of an Operating System
User View
• Ease of use
• Performance
• Resource utilization
System View
• Resource allocator
• Control program
05-02-2024 Ms. Rashmi Bhat 5
The fundamental goal of computer systems is to execute user programs and
to make solving user problems easier.
6. Operating System Objectives
Makes a computer more convenient to
use
Convenience
Allows the computer system resources to
be used in an efficient manner.
Efficiency
Permits the effective development, testing
and introduction of new system functions
without interfering with service.
Ability to
evolve
05-02-2024 Ms. Rashmi Bhat 7
7. Operating System Services (Functions)
Services provided for user Services provided for system
05-02-2024 Ms. Rashmi Bhat 8
User interface
Program execution
I/O operations
File System manipulation
Communications
Error detection
Resource allocation
Accounting
Protection and security
8. Evolution of Operating Systems
• Serial Processing
• No operating system
• Programs were loaded using punch cards, magnetic
tape
• Two main Problems
• Scheduling
• Some times resulting in wasted computer processing time
• User was forced to stop if times out
• Setup time
• Considerable amount of time was spent in setting up the
program to run.
05-02-2024 Ms. Rashmi Bhat 9
9. Evolution of Operating Systems
• Simple Batch Processing
• The first operating system developed to maximize the processor utilization
• Main idea is Use of special software called as monitor.
• User submits the job on cards or tape to computer operator, who batches the
job together sequentially and places the entire batch on an input device for
use by the monitor.
• Each programs branch back to the monitor upon completion, so monitor
automatically begins loading the next program.
• Monitor:
• Controls sequence of events
• Resides in main memory called as resident monitor
05-02-2024 Ms. Rashmi Bhat 10
10. Evolution of Operating Systems
• Simple Batch Processing
• Desirable hardware features
• Memory protection
• A program must not alter the memory area containing
the monitor
• Timer
• Prevents a single job from monopolizing the system
• Privileged instructions
• Executed only by the monitor.
• Interrupts
• Gives more flexibility to OS in relinquishing control to
and regaining control from the user program.
05-02-2024 Ms. Rashmi Bhat 11
11. Evolution of Operating Systems
• Multi-programmed Batch System
• In simple batch OS, the processor was often idle because of slower I/O
devices.
• When one job needs to wait for I/O, the processor can switch to the other
job, which is likely not waiting for I/O.
• Expand memory to hold multiple programs and switch among all of them
• This approach is known as Multiprogramming or multitasking.
• This is the center theme of modern operating systems.
• More sophisticated than uni-programming systems
• To keep many jobs in main memory, some sort of memory management is
required
05-02-2024 Ms. Rashmi Bhat 12
12. Evolution of Operating Systems
• Multi-programmed Batch System
05-02-2024 Ms. Rashmi Bhat 13
13. Evolution of Operating Systems
• Multi-programmed Batch System
05-02-2024 Ms. Rashmi Bhat 14
14. Evolution of Operating Systems
• Time-Sharing Systems
• With the need of user interaction with the computer, time sharing systems
evolved.
• Multiple users simultaneously accessing the system through terminals
• OS interleaves the execution of each use program in a short burst.
• If n users are using OS, then each user will only see on an average 1/n of the
effective computer capacity.
Both batch processing and time-sharing use multiprogramming. But still the
differ from each other
05-02-2024 Ms. Rashmi Bhat 15
15. Evolution of Operating Systems
Batch Multiprogramming Time-Sharing
Principal Objective Maximize processor use Minimize response time
Source of directive to
Operating System
Job control language commands
provided with the job
Commands entered at the
terminals
05-02-2024 Ms. Rashmi Bhat 16
Batch Multiprogramming Vs Time Sharing Systems
16. Operating System Structure
• Simple Structure
• Provides the most functionalities in least
space.
• In MS-DOS system, Interfaces and levels of
functionalities are not well separated.
• Such systems are vulnerable to malicious
programs causing entire system crashes
• In UNIX system functionality is divided into
two parts: Kernel and System Programs
05-02-2024 Ms. Rashmi Bhat 17
Application program
Resident system program
MS-DOS device drivers
ROM BIOS device drivers
Fig. MS-DOS Layer Structure
kernel
Fig. Traditional UNIX System Structure
17. Operating System Structure
• Monolithic Structure
• Each component of the operating system was
contained within the kernel
• Each component could communicate directly with
any other component, and had unrestricted
system access.
• Device drivers were loaded into the running
kernel and become part of the kernel.
• This made OS very efficient.
• But errors were more difficult to isolate, and there
was a high risk of damage due to erroneous or
malicious code.
05-02-2024 Ms. Rashmi Bhat 18
Fig. Monolithic Structure
18. Operating System Structure
• Layered Structure
• OS is broken into a number of layers (levels)
• The bottom layer (Layer 0) is hardware; the highest layer
(Layer n) is user interface.
• Each layer uses functions/services only of lower level
layers.
• Simple to construct and debug
• Once we debug first layer, its correct functioning can be assumed
while second layer is debugged, and so on.
• If an error occurs while debugging a particular layer, the error must
be on that layer.
• Only difficulty involves is appropriately defining the various
layers.
• This structure tends to be less efficient.
05-02-2024 Ms. Rashmi Bhat 19
Layer N
User Interface
.
.
Layer 1
Layer 0
Hardware
Fig. Layered Operating System
19. Operating System Structure
• Microkernel
• Structures the OS by removing all nonessential components from the kernel and implements
them as system and user level programs.
• Results into smaller kernel.
• Provides minimal process and memory management
• Main function is to provide communication facility between client program and the various
services running in user space.
• Communication is provided by message passing.
• This structure is easy to extend.
• Can suffer from performance decreased due to increased system overhead
05-02-2024 Ms. Rashmi Bhat 20
21. Kernel
05-02-2024 Ms. Rashmi Bhat 22
• Kernel
• Kernel is the core part of Linux.
• It is responsible for all major activities of this operating system.
• It consists of various modules and it interacts directly with the underlying hardware.
• It provides the required abstraction to hide low level hardware details to system or
application programs.
• Kernel Mode Vs User Mode
• Kernel component code executes in a special privileged mode called Kernel mode with full access to all
resources of the computer.
• User programs and other system programs works in User Mode which has no access to system hardware and
kernel code.
22. 05-02-2024 Ms. Rashmi Bhat 23
Application, Tools
Process
Management
Memory
Management
File
Systems
Device
Drivers
Network
Scheduler
Scheduler
Memory
Manager
File System
types
Block Devices
Character
Devices
Network
Protocols
Network
Drivers
CPU RAM
Hard disk,
CPU, Floppy
Disk
Terminal
equipment
Network
Adapter
Multitasking Virtual Memory File, Directories
Device access,
terminals
Network
Functionality
System calls
User Space
Linux Kernel
Components
Functionality
Software
Support
Hardware
Support
Hardware
Fig. Linux Kernel Architecture
Kernel
23. Kernel
05-02-2024 Ms. Rashmi Bhat 24
Character device driver
Block device driver
Network device driver
Traps and faults
Physical memory
Interrupts
Signals
System calls
Processes and scheduler
Virtual memory
File systems
Network protocols
Principal Components of Kernel
25. Shell
• The shell provides you with an interface to the Unix system.
• The shell is a program that takes commands from the keyboard and gives them to
the operating system to perform.
• There are different flavors of a shell. Each flavor of shell has its own set of
recognized commands and functions.
• Shell Prompt:
• The prompt, $, which is called the command prompt, is issued by the shell.
• It determines the command you want executed by looking at the first word of your input.
05-02-2024 Ms. Rashmi Bhat 26
27. Shell
• Shell Types
• Bourne Shell
• The $ character is the default prompt.
• Subcategories
• Bourne Shell (sh)
• Korn Shell (ksh)
• Bourne Again Shell (bash)
• POSIX Shell (sh)
• C Shell
• The % character is the default prompt.
• Subcategories
• C shell (csh)
• TENEX/TOPS C Shell (tcsh)
05-02-2024 Ms. Rashmi Bhat 28
28. Shell
• Shell Script
• A list of commands, which are listed in the order of execution.
• Comments are preceded by # sign, describing the steps.
• Shell scripts are interpreted.
• E.g.
• Write a shell script to create a directory
• Start writing your shell script with shebang construct
#!/bin/sh
This tells the system that the commands that follow are to be executed by the Bourne shell.
• To execute a program available in the current directory, use
./program_name
05-02-2024 Ms. Rashmi Bhat 29
38. System Calls
• Process requests a specific kernel service
by means of a system call.
• It is a mechanism that provides the
interface between a process and the
operating system.
• System call offers the services of the
operating system to the user programs via
API (Application Programming Interface).
05-02-2024 Ms. Rashmi Bhat 39
39. System Call
• How does a System Call works?
05-02-2024 Ms. Rashmi Bhat 40
User Mode
Kernel Mode
User Process
Executing
Gets System
Call
Return from
System Call
Execute
System Call
1 2 3
4
40. System Call
• How to pass parameters to the operating system?
• Pass the parameters in registers.
• Store the parameters in a block, or table, in memory, and pass the address of
the block as a parameter in a register.
• Push the parameters onto the stack.
05-02-2024 Ms. Rashmi Bhat 41
41. System Call
• Why do you need System Calls in OS?
• Following are situations which need system calls in OS:
• Reading and writing from files demand system calls.
• If a file system wants to create or delete files, system calls are required.
• System calls are used for the creation and management of new processes.
• Network connections need system calls for sending and receiving packets.
• Access to hardware devices like scanner, printer, need a system call.
05-02-2024 Ms. Rashmi Bhat 42
42. System Calls
05-02-2024 Ms. Rashmi Bhat 43
System
Calls
Process
Control
File
Management
Device
Management
Information
Maintenance
Communication
Protection
43. System Call
• Process Control
• This system calls perform the task of process creation, process termination, etc.
• Functions:
• End and Abort
• Load and Execute
• Create Process and Terminate Process
• Wait and Signal Event
• Allocate and free memory
05-02-2024 Ms. Rashmi Bhat 44
44. System Call
• File Management
• File management system calls handle file manipulation jobs like creating a file, reading, and
writing, etc.
• Functions:
• Create a file
• Delete file
• Open and close file
• Read, write, and reposition
• Get and set file attributes
05-02-2024 Ms. Rashmi Bhat 45
45. System Call
• Device Management
• Device management does the job of device manipulation like reading from device buffers,
writing into device buffers, etc.
• Functions:
• Request and release device
• Logically attach/ detach devices
• Get and Set device attributes
05-02-2024 Ms. Rashmi Bhat 46
46. System Call
• Information Maintenance
• It handles information and its transfer between the OS and the user program.
• Functions:
• Get or set time and date
• Get process and device attributes
• Communication
• Specially used for inter-process communications.
• Functions:
• Create, delete communications connections
• Send, receive message
• Help OS to transfer status information
• Attach or detach remote devices
05-02-2024 Ms. Rashmi Bhat 47
47. System Call
• Protection
• Protection provides a mechanism for controlling access to the resources provided by a
computer system.
• Functions:
• Set and get permission
• Allow and deny user
05-02-2024 Ms. Rashmi Bhat 48
48. System Call
• Some Important System Calls
• wait()
• A process needs to wait for another process to complete its execution.
• fork()
• Processes use this system call to create processes that are a copy of themselves.
• exec()
• This system call runs when an executable file in the context of an already running process that
replaces the older executable file.
• kill()
• The kill() system call is used by OS to send a termination signal to a process that urges the process
to exit.
• exit()
• The exit() system call is used to terminate program execution.
05-02-2024 Ms. Rashmi Bhat 49
50. Home Work - 1
• List the various operating systems in the order they have launched.
• List the mobile operating systems that you know.
05-02-2024 Ms. Rashmi Bhat 53