MODULE 1 - Introduction To OS
MODULE 1 - Introduction To OS
Introduction to OS
What is an Operating System? 2
Mainframe OS
Optimize hardware utilization
Computer standard OS
Standard Application, Games, etc.
Handheld OS -> Apps, etc.
4
OS as a base for Application Programs 5
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
OS plays an important role to determine which application you need, because some
applications may exists only in some OS.
Example:
Words in windows
Libre office in linux
6
User Interface: There are different kinds, like touchscreen, GUI, and command-line.
Program Execution: (Execute programs for users)
I/O operations: It is much too difficult for users to operate the I/O hardware correctly
without help.
File System Manipulation: The OS helps us store, organize, manage, and protect our
information.
Communications: Users need their processes to exchange information. OSs help. The
two main ways to do it are with shared memory and by message passing.
Error Detection: An OS continually checks to see if something is going wrong. The OS
is programmed to take appropriate action.
Resource Allocation
Logging:
Records for accounting, fault detection, failure, protection, maintenance, update, security, etc.
Protection and Security.
Different types of OS 8
Microsoft Windows
Mainframe
DOS
OS/2
Mac OS
AmigaOS
Design Goals 9
Design Goals:
system that is convenient,
reliable,
safe, and
fast.
Implementation: The implementation of the operating system, that is
the manner in which the ideas of the design are written in programming
language(s).
Assembly
High Level Language
Earlier assembly could make the code run faster but nowadays high-level
are translated to equivalently good assembly code.
Instead performance of OS will increase if selection data structure and
algorithms are done rather than proper assembly code.
OS Design Issues 10
Simple
Monolithic
Micro-kernel models
Layered (conceptual)
Modular
Monolithic Kernel
Micro Kernel
Hybrid Kernel
Simple Structure 12
Ex – MS DOS
Monolithic Structure 13
Monolithic Kernel
value on speed and efficiency.
Monolithic is a single static
binary file.
It executes in a single address
space.
Debugging and modification is
difficult
Too many things packed in
one level
Ex – Earlier Unix
Keep only necessary component in kernel. Others are implemented as programs (system or user
level).
Resulting in a kernel smaller in size.
Minimal process management
Minimal memory management
Main role is that it facilitates communication between the client program and the various services
that are running in user space.
Mach example of microkernel
Mac OS X kernel (Darwin) partly based on Mach
Communication takes place between user modules using message passing
Benefits:
Easier to extend a microkernel
Easier to port the operating system to new architectures
More reliable (less code is running in kernel mode)
More secure
Detriments:
Performance overhead of user space to kernel space communication
16
Microkernel 17
Security If a service crashes, it does effect on If a service crashes, the whole system
working of microkernel. crashes in monolithic kernel.
Code To write a microkernel, more code is To write a monolithic kernel, less code
required. is required.
Typically employs:
dynamic loadable kernel module (LKM). i.e.
Different modules communicate through
kernel (core part).
System call sequence to copy the contents of one file to another file
23
Process control
File manipulation
Device Management
Information Maintenance
Communications
System Call – Types 26
Process control
create process, terminate process
end, abort
load, execute
get process attributes, set process attributes
wait for time
wait event, signal event
allocate and free memory
Dump memory if error
Debugger for determining bugs, single step execution
Locks for managing access to shared data between processes
System Call – Types (Cont.) 27
File management
create file, delete file
open, close file
read, write, reposition
get and set file attributes
Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
System Call – Types (Cont.) 28
Information maintenance
get time or date, set time or date
get system data, set system data
get and set process, file, or device attributes
Communications
create, delete communication connection
send, receive messages if message passing model to
host name or process name
• From client to server
Shared-memory model create and gain access to
memory regions
transfer status information
attach and detach remote devices
Examples of Windows and Unix System Calls
29
Standard C Library Example 30
The operating system preserves the state of the CPU by storing registers and the
program counter
Determines which type of interrupt has occurred:
polling
vectored interrupt system
Separate segments of code determine what action should be taken for each type of
interrupt
A von Neumann Architecture 35
References
36