Os - Unit-1-1
Os - Unit-1-1
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
1
UNIT-1
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
2
Operating System Definition
OS is a resource allocator
Decides between conflicting requests for efficient and fair resource use
OS is a control program
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
3
3. Operating systems operations
Interrupt driven (hardware and software)
a. Hardware interrupt by one of the devices
b. Software interrupt (exception or trap):
i. Software error (e.g., division by zero)
ii. Request for operating system service
iii. Other process problems include infinite loop, processes
modifying each other or the operating system
Dual-mode operation allows OS to protect itself and other system
components
a. User mode and kernel mode
b. Mode bit provided by hardware
i. Provides ability to distinguish when system is running
user code or kernel code
ii. Some instructions designated as privileged, only
executable in kernel mode
iii. System call changes mode to kernel, return from call
resets it to user
Increasingly CPUs support multi-mode operations
a. i.e. virtual machine manager (VMM) mode for guest VMs
4. Computing environments
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
4
Computing Environments - Mobile
Distributed computing
Collection of separate, possibly heterogeneous, systems
networked together
Network is a communications path, TCP/IP most
common
– Local Area Network (LAN)
– Wide Area Network (WAN)
– Metropolitan Area Network (MAN)
– Personal Area Network (PAN)
Network Operating System provides features between systems
across network
Communication scheme allows systems to exchange
messages
Illusion of a single system
Client-Server Computing
Dumb terminals supplanted by smart PCs
Many systems now servers, responding to requests generated
by clients
Compute-server system provides an interface to client to
request services (i.e., database)
File-server system provides interface for clients to store
and retrieve files
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
5
Computing Environments - Peer-to-Peer
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
6
the Internet (i.e., word processor)
o Platform as a Service (PaaS) – software stack ready for application
use via the Internet (i.e., a database server)
o Infrastructure as a Service (IaaS) – servers or storage available over
Internet (i.e., storage available for backup use)
Cloud computing environments composed of traditional OSes, plus
VMMs, plus cloud management tools
o Internet connectivity requires security like firewalls
o Load balancers spread traffic across multiple applications
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
8
II. System Structures :
1. Operating System Services
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
10
2. User and Operating-System Interface
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
11
Graphical User Interface
o Unix and Linux have CLI with optional GUI interfaces (CDE, KDE,
GNOME)
Touchscreen Interfaces
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
12
. Systems calls
System calls provide Programming interface to the services provided by
the OS
Typically written in a high-level language (C or C++)
Mostly accessed by programs via a high-level Application Programming
Interface (API) rather than direct system call use
Three most common APIs are Win32 API for Windows, POSIX API for
POSIX-based systems (including virtually all versions of UNIX, Linux, and
Mac OS X), and Java API for the Java virtual machine (JVM)
Services Provided by System Calls :
Process creation and management
Main memory management
File Access, Directory and File system management
Device handling(I/O)
Protection
Networking, etc.
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
13
Often, more information is required than simply identity of desired
system call
o Exact type and amount of information vary according to OS and
call
Three general methods used to pass parameters to the OS
o Simplest: pass the parameters in registers
In some cases, may be more parameters than registers
o Parameters stored in a block, or table, in memory, and address
of block passed as a parameter in a register
This approach taken by Linux and Solaris
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
14
4. Types of System Calls
i. Process control: end, abort, create, terminate, allocate and free memory.
ii. File management:
create file, delete file
open, close file
read, write, reposition
get and set file attributes
iii. Device management :
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
v. Communication :
create, delete communication connection
vi. Protection
Control access to resources
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
15
Examples of Windows and Unix System Calls
5. System Programs
a) File modification
Text editors to create and modify files
Special commands to search contents of files or perform
transformations of the text
b) Status information
The system for information - date, time, amount of available
memory, disk space, number of users
Detailed performance - logging, and debugging information
Typically, these programs format and print the output to the
terminal or other output devices
c) Programming-language support - Compilers, assemblers, debuggers
and interpreters sometimes provided
d) Program loading and execution- Absolute loaders, relocatable loaders,
linkage editors, and overlay-loaders, debugging systems for higher-level
and machine language
e) Communications - Provide the mechanism for creating virtual
connections among processes, users, and computer systems
o 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
f) Background Services
Launch at boot time
Some for system startup, then terminate
Some from system boot to shutdown
Provide facilities like disk checking, process scheduling, error
logging, printing
Run in user context not kernel context
Known as services, subsystems, daemons
g) Application programs
Don’t pertain to system
Run by users
Not typically considered part of OS
Launched by command line, mouse click, finger poke on touch
screen
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
17
6. Operating system structure
Operating system can be implemented with the help of various structures.
The structure of the OS depends mainly on how the various common
components of the operating system are interconnected and melded into
the kernel. Depending on this we have following structures of the
operating system:
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
19
d. Microkernel -Mach
e. Modules
Many modern operating systems implement loadable kernel modules
i. Uses object-oriented approach
ii. Each core component is separate
iii. Each talks to the others over known interfaces
iv. Each is loadable as needed within the kernel
Overall, similar to layers but with more flexible
i. Linux, Solaris, etc
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
20
f. Mac OS X Structure
g. iOS
Apple mobile OS for iPhone, iPad
Structured on Mac OS X, added functionality
Does not run OS X applications natively
Also runs on different CPU architecture (ARM vs. Intel)
Cocoa Touch Objective-C API for developing apps
Media services layer for graphics, audio, video
Core services provides cloud computing, databases
Core operating system, based on Mac OS X kernel
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
21
h. Android
Developed by Open Handset Alliance (mostly Google)
o Open Source
Similar stack to IOS
Based on Linux kernel but modified
o Provides process, memory, device-driver management
o Adds power management
Runtime environment includes core set of libraries and Dalvik virtual machine
o Apps developed in Java plus Android API
Java class files compiled to Java bytecode then translated to
executable than runs in Dalvik VM
Libraries include frameworks for web browser (webkit), database (SQLite),
multimedia, smaller libc
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
22
Dalvik Virtual Machine (DVM)
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
23
8. System Boot
When power initialized on system, execution starts at a fixed memory
location
o Firmware ROM used to hold initial boot code
Operating system must be made available to hardware so hardware
can start it
o Small piece of code – bootstrap loader, stored in ROM or
EEPROM locates the kernel, loads it into memory, and starts it
o Sometimes two-step process where boot block at fixed location
loaded by ROM code, which loads bootstrap loader from disk
Common bootstrap loader, GRUB, allows selection of kernel from
multiple disks, versions, kernel options
Kernel loads and system is then running
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
24