0% found this document useful (0 votes)
67 views51 pages

OS Services - OS Operations - Services System Calls OS Structure - System Boot

This document provides an overview of operating system services and operations. It discusses the services an OS provides to users like program execution, I/O, file manipulation, and communication. It also covers system-related services like resource allocation, accounting, and protection. The document describes how OS operations are interrupt-driven and use dual-mode operation to protect the kernel. It defines system calls as the mechanism for user programs to request services from the kernel via library functions. Finally, it briefly mentions different OS structures like simple, layered, and microkernel designs.

Uploaded by

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

OS Services - OS Operations - Services System Calls OS Structure - System Boot

This document provides an overview of operating system services and operations. It discusses the services an OS provides to users like program execution, I/O, file manipulation, and communication. It also covers system-related services like resource allocation, accounting, and protection. The document describes how OS operations are interrupt-driven and use dual-mode operation to protect the kernel. It defines system calls as the mechanism for user programs to request services from the kernel via library functions. Finally, it briefly mentions different OS structures like simple, layered, and microkernel designs.

Uploaded by

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

1

Module 1
OS Services –OS Operations - Services System Calls
OS Structure - System Boot

Dr. Abdul Quadir Md, SCOPE


VIT Chennai
2

Operating System Services


Operating system services 3

 OS provides an environment for the execution of


programs

 It provides set of services to programs and to users of


those programs
Operating system services 4

 One set of services to the user


– User interface
– Program execution
– I/O operations
– File system manipulations
– Communications
– Error detection
Operating system services 5

 Set of services ensuring the efficient operation of the


system

– Resource allocation
– Accounting
– Protection and security
6
OS - User services

 User interface

– Nearly all OS have a user interface


– These can CLI, Batch and GUI

 Program execution
– The system must be able to load the
program in memory and execute
7
OS - User services

 I/O operation

– a running program may require I/O


– users cannot control I/O devices directly
– OS must provides means to do I/O

 File system manipulations


–read and write files and directories
– create, delete, search and list files
– Permission management
8
OS - User services

 Communication

- tied together by computer networks

– shared memory or through message passing

- packets of information moves between processes


by the OS
9
OS - User services

 Error detection

In CPU - power failure

Memory hardware - memory error

In I/O devices - lack of paper in printer

In User programs - arithmetic over flow


10
OS - System related services

 Resource allocation
–multiple users running at the same time
-resources must be allocated to all

–types of resources managed are

• Main memory
• File storage
• CPU cycles
11
OS - System related services

 Accounting

Keeps track of
-users activity
-resource allocation
- utilization

– Usage statistics may be valuable tool for


researchers to improve computing services
12
OS - System related services

 Protection and security

– When several processes runs concurrently, it not be possible


for one process to interfere

–It ensuring that all access to system resources is controlled

– Security of the system from the outsiders is also important

–Each user to authenticate by password to gain access


13

Operating-System Operations
Operating-System Operations 14

 Interrupt driven (hardware and software)

 Hardware interrupt by one of the devices

 Software interrupt (exception or trap):


 Software error (e.g., division by zero)
 Request for operating system service
 Other process problems include infinite loop, processes modifying
each other or the operating system
Operating-System Operations (cont.) 15

 Dual-mode operation allows OS to protect itself and other system


components
 User mode and kernel mode
 Mode bit provided by hardware
 Provides ability to distinguish when system is running user code or kernel
code
 Some instructions designated as privileged, only executable in kernel mode
 System call changes mode to kernel, return from call resets it to user
 Increasingly CPUs support multi-mode operations
 i.e. virtual machine manager (VMM) mode for guest VMs
Transition from User to Kernel Mode 16

 Timer to prevent infinite loop / process hogging resources


 Timer is set to interrupt the computer after some time period
 Keep a counter that is decremented by the physical clock.
 Operating system set the counter (privileged instruction)
 When counter zero generate an interrupt
 Set up before scheduling process to regain control or terminate program that
exceeds allotted time
Kernal 17

 Source: WIkipedia
18

Systems Calls
System calls
19

 OS - mechanism to request services from the kernel

 Service request points are called “system calls”

 In Linux system - interface layer between the user space and


kernel space.

 This layer consists of library made up of functions that


communicate between normal user applications and the Kernel.
System calls
20

 C library is called libc/glibc

 This provides wrapper functions for the system calls

 Implemented using software interrupt or trap

 Sets the
-System call number
-C arguments into the general registers
-Executes some machine instruction that generates a software
interrupt in the kernel
21
Example on how system calls are used
 Simple program to read data from one file and copy them to another file

 Program inputs
-Name of two files
-opens the input file and creates output file and open it

 Each of these operations require another system calls

 Now that both files are setup, enter into the loop that
-read from input file (system call) and
-writes into the output file(another system call)
Example of System Calls 22

 System call sequence to copy the contents of one file to another


file
23

Interfacing between user and kernel


space
C library interface
24

 the ‘printf’ statement


The C library interprets this call and invokes the
necessary system call(s) in OS

 the write() system call


The C library takes the value returned by write()
and passes it back to the user program.
system call and library function
25

 Examples of systems calls


• Read() / write ()
• Fork()/ exec ()

 Example of library functions


• Date/time
• Strcpy/atoi/printf
System call Categories /Types 26

 Five major Categories/ Types:


– Process management
– File management
– Device management
– Information/Maintenance
– Communication
Process management 27

– create process the process


– Terminate process
– Load the process
– Execute the process
– get/set process attributes
– wait for time, wait event, signal event
File management 28

–create file, delete file


– open, close
– read, write, reposition
– get/set file attributes
Device Management 29

– request device, release device


– read, write, reposition
– get/set device attributes
– logically attach or detach devices
Information Maintenance 30

– get/set time or date


– get/set system data
– get/set process, file, or device attributes
Communication 31

– create, delete communication connection


– send, receive messages
– transfer status information
– attach or detach remote devices
32

Operating System Structure


Operating System Structure 33

 General-purpose OS is very large program


 Various ways to structure ones
 Simple structure – MS-DOS
 More complex -- UNIX
 Layered – an abstrcation
 Microkernel -Mach
Simple Structure -- MS-DOS 34

 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
Non Simple Structure -- UNIX 35

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
Traditional UNIX System Structure 36

Beyond simple but not fully layered


Layered Approach 37

 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
Microkernel System Structure 38

 Moves as much from the kernel into 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
Microkernel System Structure 39
Modules
40

 Many modern operating systems implement loadable kernel


modules
 Uses object-oriented approach
 Each core component is separate
 Each talks to the others over known interfaces
 Each is loadable as needed within the kernel
 Overall, similar to layers but with more flexible
 Linux, Solaris, etc
41

Solaris Modular Approach


Hybrid Systems 42

 Most modern operating systems are actually not one pure model
 Hybrid combines multiple approaches to address performance, security,
usability needs
 Linux and Solaris kernels in kernel address space, so monolithic, plus
modular for dynamic loading of functionality
 Windows mostly monolithic, plus microkernel for different subsystem
personalities
 Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa programming
environment
 Below is kernel consisting of Mach microkernel and BSD Unix parts, plus
I/O kit and dynamically loadable modules (called kernel extensions)
Mac OS X Structure
43
iOS 44

 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
Android 45

 Developed by Open Handset Alliance (mostly Google)


 Open Source
 Similar stack to IOS
 Based on Linux kernel but modified
 Provides process, memory, device-driver management
 Adds power management
 Runtime environment includes core set of libraries and Dalvik virtual machine
 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
Android Architecture 46
47

System Boot
System Boot 48

 When power initialized on system, execution starts at a fixed memory


location
 Firmware ROM used to hold initial boot code
 Operating system must be made available to hardware so hardware can
start it
 Small piece of code – bootstrap loader, stored in ROM or EEPROM locates the
kernel, loads it into memory, and starts it
 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
49

ns ?
e st io
y Q u
A n
50

References

 http://www.digilife.be/quickreferences/qrc/linux%20system%20call%
20quick%

 Silberschatz, Gagne, Galvin: Operating System Concepts, 6th Edition

 http://docs.cs.up.ac.za/programming/asm/derick_tut/syscalls.html
51

You!
hank
T

You might also like