Вы находитесь на странице: 1из 21

Operating Systems

R.Sivashankari

Vellore Institute of Technology, Vellore

December 5, 2017

R.Sivashankari Operating Systems


Instructor :- Prof. R. Sivashankari
Designation :- Assistant Professor Senior, SITE
Research Interest :- Natural Language Processing & Machine
Learning
Email :- sivashankari.r@vit.ac.in
Cabin no :- SJT 116 A–34

R.Sivashankari Operating Systems


Operating System

SWE3001-Operating Systems [L T P J C 3 0 2 0 4 ]
Text Book :- Operating System Concepts, Silberschatz,
Galvin, Gagne, 5th edition to 9th Edition
Reference Book : - Operating systems -Internals and
Design Principles, W. Stallings, Seventh Edition

R.Sivashankari Operating Systems


Mode of Evaluations

CAT 1 – 15 Marks
CAT 2 – 15 Marks
Digital Assessment(3) – 30Marks
FAT – 40 Marks

R.Sivashankari Operating Systems


Course Goal

Understand the purpose of an operating system.


Describe various functions performed by the OS.
Understand operating system implementations.
Understand operating system performance.
Learn to deal with larger software systems.

R.Sivashankari Operating Systems


Outline - Unit 1

Role & purpose of an OS.


History
Functionality
Design issue

R.Sivashankari Operating Systems


Outline - Unit 2

Process Concept.
Process Scheduling
Thread
CPU Scheduling
Process Synchronization
Deadlock

R.Sivashankari Operating Systems


Outline - Unit 3

Memory management
Paging
Segmentation
Demand Paging
page Replacement Tech
thrashing

R.Sivashankari Operating Systems


Outline - Unit 4

File Concept
Directory Structure
File System Implementation
Directory Implementation
Allocation Method
Free Space management
Disk Structure
disk scheduling

R.Sivashankari Operating Systems


Outline - Unit 5

System Security
Security Methods
Encryption
Recovery management

R.Sivashankari Operating Systems


What is an operating system?

Interface between application and hardware.

emacs gcc firefox


OS
Hardware

R.Sivashankari Operating Systems


Why study operating systems?

Operating systems are a mature field


Most people use a handful of mature OSes
Hard to get people to switch operating systems
Hard to have impact with a new OS
High-performance servers are an OS issue
Resource consumption is an OS issue (Battery life).
Security is an OS issue
New “smart” devices need new OSes

R.Sivashankari Operating Systems


What Does an OS do?

Provides abstractions for applications.


Hide complex details of the underlying hardware
Provides common API to applications and services
Resource Manager
Controls accesses to shared resources
CPU, memory, disk, network, · · ·
Provides protection
Prevents one process/user from clobbering another

R.Sivashankari Operating Systems


Why abstraction is required?

Without OSs and abstract interfaces, application writers


must program all device access directly
very complicated maintenance and upgrading
no portability

R.Sivashankari Operating Systems


OS as a resource manager

Allocating resources to applications across space and time


time sharing a resource (scheduling)
space sharing a resource (allocation)
Making efficient use of limited resources
improving utilization
minimizing overhead
improving throughput/good put
Protecting applications from each other
enforcement of boundaries

R.Sivashankari Operating Systems


Typical OS structure

P1 P2 P3 P4
user
kernel
VM file
IPC system
sockets scheduler
TCP/IP device device device
driver driver driver

network console disk


Most software runs as user-level processes (P[1-4])
OS kernel runs in privileged mode (shaded)
Creates/deletes processes
Provides access to hardware
Applications can invoke kernel through system calls
R.Sivashankari Operating Systems
Kernel and User Space

System memory in Linux can be divided into two distinct


regions: kernel space and user space.
Kernel space is where the kernel (i.e., the core of the
operating system) executes (i.e., runs) and provides its
services.
User space is that set of memory locations in which user
processes (i.e., everything other than the kernel) run. A
process is an executing instance of a program.
One of the roles of the kernel is to manage individual user
processes within this space and to prevent them from
interfering with each other.
Kernel space can be accessed by user processes only
through the use of system calls.

R.Sivashankari Operating Systems


System Call
System calls kernel space function that user space
programs call to handle some request.
The Linux kernel provides a set of System calls and each
architecture provides its own set.
For reasons of security and reliability, user-space
applications must not be allowed to directly execute kernel
code or manipulate kernel data.
kernel must provide a mechanism by which a user-space
application can signal the kernel that it wishes to invoke a
system call.
The exact mechanism varies from architecture to
architecture.
On i386, for example, a user-space application executes a
software interrupt instruction, int , with a value of 0x80.
The application tells the kernel which system call to
execute and with what parameters via machine registers.
R.Sivashankari Operating Systems
System Call
System calls are denoted by number, starting at 0. On the
i386 architecture, to request system call 5 (which happens
to be open( ) ), the user-space application stuffs 5 in
register eax before issuing the int instruction.
As a system programmer, you usually do not need any
knowledge of how the kernel handles system call
invocation. That knowledge is encoded into the standard
calling conventions for the architecture, and handled
automatically by the compiler and the C library.
We do not call system calls directly in our code, but using
wrapper functions from the standard library.
The main reason of this is simple: a system call must be
performed quickly, very quickly.
The standard library takes responsibility to perform system
calls with the correct set parameters and makes different
checks before it will call the given system call.
R.Sivashankari Operating Systems
System call flow of control

R.Sivashankari Operating Systems


Some Linux System Call

Process related
fork – Create a child process identical to the parent
waitpid – Wait for a child to terminate
execve – Replace a process code image
exit – Terminate Process execution
File related
open – open a file for reading, writing, or both
close – Close an open file
read – Read data from a file into a buffer
write – Write data from a buffer into a file
Networking Related
bind – Assign a local IP address and port for a socket.
connect – Establish a connection between the given socket
and remote socket.
gethostname – Return local host name

R.Sivashankari Operating Systems

Вам также может понравиться