0% found this document useful (0 votes)
5 views24 pages

Os - Unit-1-1

The document provides an overview of operating systems, detailing their functions, structure, operations, and various computing environments, including traditional, mobile, distributed, client-server, peer-to-peer, cloud computing, and real-time embedded systems. It also discusses system structures, operating system services, user interfaces, system calls, and types of system calls. Additionally, it covers open-source operating systems and their significance in the computing landscape.

Uploaded by

kdsiddu7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views24 pages

Os - Unit-1-1

The document provides an overview of operating systems, detailing their functions, structure, operations, and various computing environments, including traditional, mobile, distributed, client-server, peer-to-peer, cloud computing, and real-time embedded systems. It also discusses system structures, operating system services, user interfaces, system calls, and types of system calls. Additionally, it covers open-source operating systems and their significance in the computing landscape.

Uploaded by

kdsiddu7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

UNIT-1

I. Operating Systems Overview :


1. Operating system functions
2. Operating system structure
3. Operating systems operations
4. Computing environments
5. Open-Source Operating Systems.

II. System Structures :


1. Operating System Services
2. User and Operating-System Interface
3. Systems calls
4. Types of System Calls
5. System programs
6. Operating system structure
7. Operating system debugging
8. System Boot

Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
1
UNIT-1

I. Operating Systems Overview:

1. Operating System Functions

A program that acts as an interface between a user and the


computer hardware
Operating system goals:
a. Execute user programs and make solving user problems easier
b. Make the computer system convenient to use
c. Use the computer hardware in an efficient manner

Computer system can be divided into four components:

Hardware – provides basic computing resources


 CPU, memory, I/O devices
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

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

 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

2. Operating System Structure


Multiprogramming (Batch system) needed for efficiency
 Single user cannot keep CPU and I/O devices busy at all times
 Multiprogramming organizes jobs (code and data) so CPU always has one
to execute
 A subset of total jobs in system is kept in memory
 One job selected and run via job scheduling
 When it has to wait (for I/O for example), OS switches to another job

Timesharing (multitasking) is logical extension in which CPU switches jobs


so frequently that users can interact with each job while it is running, creating
interactive computing

 Response time should be < 1 second


 Each user has at least one program executing in memory [process
 If several jobs ready to run at the same time [ CPU scheduling
 If processes don’t fit in memory, swapping moves them in and out to run
 Virtual memory allows execution of processes not completely in memory

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

Computing Environments - Traditional


 Stand-alone general purpose machines
 But blurred as most systems interconnect with others (i.e., the Internet)
 Portals provide web access to internal systems
 Network computers (thin clients) are like Web terminals
 Mobile computers interconnect via wireless networks
 Networking becoming ubiquitous (found everywhere) – even home
systems use firewalls to protect home computers from Internet
attacks

Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
4
Computing Environments - Mobile

 Handheld smart phones, tablets, etc


 What is the functional difference between them and a “traditional”
laptop?
 Extra feature – more OS features (GPS, gyroscope)
 Allows new types of apps like augmented reality
 Use IEEE 802.11 wireless, or cellular data networks for connectivity
 Leaders are Apple iOS and Google Android

Computing Environments – Distributed

 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

Computing Environments – Client-Server

 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

 Another model of distributed system


 P2P does not distinguish clients and servers
o Instead all nodes are considered peers
o May each act as client, server or both
o Node must join P2P network
 Registers its service with central lookup service on
network, or
 Broadcast request for service and respond to requests
for service via discovery protocol
o Examples include Napster and Gnutella, Voice over IP (VoIP)
such as Skype

Computing Environments – Cloud Computing

 Delivers computing, storage, even apps as a service across a network


 Logical extension of virtualization because it uses virtualization as the
base for it functionality.
o Amazon EC2 has thousands of servers, millions of virtual machines,
petabytes of storage available across the Internet, pay based on
usage
 Many types
o Public cloud – available via Internet to anyone willing to pay
o Private cloud – run by a company for the company’s own use
o Hybrid cloud – includes both public and private cloud components
o Software as a Service (SaaS) – one or more applications available via

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

Computing Environments – Real-Time Embedded Systems


 Real-time embedded systems most prevalent form of computers
o Vary considerable, special purpose, limited purpose OS, real-time
OS
o Use expanding
 Many other special computing environments as well
o Some have OSes, some perform tasks without an OS
 Real-time OS has well-defined fixed time constraints
o Processing must be done within constraint
o Correct operation only if constraints met

5. Open-Source Operating Systems.

 Operating systems made available in source-code format rather than


just binary closed-source
 Counter to the copy protection and Digital Rights Management (DRM)
movement
 Started by Free Software Foundation (FSF), which has “copyleft” GNU
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
7
Public License (GPL)
 Examples include Linux, Open Solaris, Free RTOS, Open BDS, Free BSD,
Minix, GNU/Linux and BSD UNIX (including core of Mac OS X), and
many more
 Can use VMM like VMware Player (Free on Windows), Virtualbox (open
source and free on many platforms - http://www.virtualbox.com)
o Use to run guest operating systems for exploration

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

Operating systems provide an environment for execution of programs and


services to programs and users

 One set of operating-system services provides functions that are


helpful to the user:
a. User interface - Almost all operating systems have a user
interface (UI).
i. Varies between Command-Line (CLI), Graphics User Interface
(GUI), Batch
b. Program execution - The system must be able to load a program
into memory and to run that program, end execution, either
normally or abnormally (indicating error)
c. I/O operations - A running program may require I/O, which may
involve a file or an I/O device
 One set of operating-system services provides functions that are
helpful to the user (Cont.):
a. File-system manipulation - The file system is of particular
interest. Programs need to read and write files and directories,
create and delete them, search them, list file Information,
permission management.
b. Communications – Processes may exchange information, on the
same computer or between computers over a network
i. Communications may be via shared memory or through
message passing (packets moved by the OS)
c. Error detection – OS needs to be constantly aware of possible
errors
i. May occur in the CPU and memory hardware, in I/O devices,
in user program
ii. For each type of error, OS should take the appropriate action
to ensure correct and consistent computing
iii. Debugging facilities can greatly enhance the user’s and
programmer’s abilities to efficiently use the system

 Another set of OS functions exists for ensuring the efficient operation


of the system itself via resource sharing
a. Resource allocation - When multiple users or multiple jobs
running concurrently, resources must be allocated to each of
them
i. Many types of resources - CPU cycles, main memory, file
storage, I/O devices.
b. Accounting - To keep track of which users use how much and
what kinds of computer resources
c. Protection and security - The owners of information stored in a
multiuser or networked computer system may want to control use
of that information, concurrent processes should not interfere
with each other
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
9
i. Protection involves ensuring that all access to system
resources is controlled
ii. Security of the system from outsiders requires user
authentication, extends to defending external I/O devices from
invalid access attempts

Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
10
2. User and Operating-System Interface

Command Line Interpreter (CLI )

CLI or command interpreter allows direct command entry


o Sometimes implemented in kernel, sometimes by systems
program
o Sometimes multiple flavors implemented – shells
o Primarily fetches a command from user and executes it
o Sometimes commands built-in, sometimes just names of
programs
 If the latter, adding new features doesn’t require shell
modification
Bourne Shell Command Interpreter

Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
11
Graphical User Interface

 User-friendly desktop metaphor interface

o Usually mouse, keyboard, and monitor

o Icons represent files, programs, actions, etc

o Various mouse buttons over objects in the interface cause various


actions (provide information, options, execute function, open directory
(known as a folder)

o Invented at Xerox PARC

 Many systems now include both CLI and GUI interfaces

o Microsoft Windows is GUI with CLI “command” shell

o Apple Mac OS X is “Aqua” GUI interface with UNIX kernel underneath


and shells available

o Unix and Linux have CLI with optional GUI interfaces (CDE, KDE,
GNOME)

Touchscreen Interfaces

 Touchscreen devices require new interfaces

o Mouse not possible or not desired


o Actions and selection based on gestures
o Virtual keyboard for text entry
 Voice commands.

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.

API – System Call – OS Relationship

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

o Parameters placed, or pushed, onto the stack by the program


and popped off the stack by the operating system
o Block and stack methods do not limit the number or length of
parameters being passed

Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
14
4. Types of System Calls

Types of System Calls : There are 6 different categories 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

iv. Information maintenance :


 get time or date, set time or date
 get system data, set system data
 get and set process, file, or device attributes

v. Communication :
 create, delete communication connection

 send, receive messages if message passing model to host name or


process name

1. From client to server

 Shared-memory model create and gain access to memory regions

 transfer status information

 attach and detach remote devices

vi. Protection
 Control access to resources

 Get and set permissions

 Allow and deny user access

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

System programs provide a convenient environment for program development


and execution. They can be divided into:
a. File manipulation
b. Status information
c. Programming language support
d. Program loading and execution
e. Communications
f. Background services
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
16
g. Application 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:

a. Simple structure – MS-DOS


b. More complex -- UNIX
c. Layered – an abstraction
d. Microkernel –Mach
e. Modules
f. Mac OS X Structure
g. iOS
h. Android

a. Simple structure – MS-DOS


MS-DOS – written to provide the most functionality in the least
space
 Not divided into modules
 Although MS-DOS has some structure, its interfaces and levels
of functionality are not well separated

b. More complex -- UNIX


UNIX – limited by hardware functionality, the original UNIX
operating system had limited structuring. The UNIX OS consists of
two separable parts
 Systems programs
 The kernel
Consists of everything below the system-call interface
and above the physical hardware
Provides the file system, CPU scheduling, memory
management, and other operating-system functions; a
large number of functions for one level
Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
18
c. Layered – an abstraction
 The operating system is divided into a number of layers (levels),
each built on top of lower layers. The bottom layer (layer 0), is the
hardware; the highest (layer N) is the user interface.
 With modularity, layers are selected such that each uses functions
(operations) and services of only lower-level layers

Prepared by Mr. Isaac Paul P, Assoc Prof & HOD, Dept of CSE, RISE Krishna Sai Gandhi Groups
19
d. Microkernel -Mach

 Moves as much from the kernel into user space


 Mach example of microkernel
o Mac OS X kernel (Darwin) partly based on Mach
 Communication takes place between user modules using message
passing
 Benefits:
o Easier to extend a microkernel
o Easier to port the operating system to new architectures
o More reliable (less code is running in kernel mode)
o More secure
 Detriments:
o Performance overhead of user space to kernel space
communication

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)

7. Operating System Debugging

 Debugging is finding and fixing errors, or bugs


 OS generate log files containing error information
 Failure of an application can generate core dump file capturing
memory of the process.
 Operating system failure can generate crash dump file containing
kernel memory
 Beyond crashes, performance tuning can optimize system
performance
o Sometimes using trace listings of activities, recorded for
analysis
o Profiling is periodic sampling of instruction pointer to look for
statistical trends
Kernighan’s Law: “Debugging is twice as hard as writing the code in the
first place. Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.”

 Improve performance by removing bottlenecks


 OS must provide means of computing and displaying measures of
system behavior
 For example, “top” program or Windows Task Manager

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

You might also like