Professional Documents
Culture Documents
Unit-2 Topic-2 System Calls
Unit-2 Topic-2 System Calls
UNIT-2
Services & Components of OS
Topic – System Calls
Objectives:
To understand the use of System Calls.
To use System Calls
Presentation By:
Mrs. M. P. Bhosale
Lecturer, Computer Dept.
K. K. Wagh Polytechnic, Nashik
2020-21 Mrs. M. P. Bhosale 1
System Calls
System calls provide the interface between a
running program and the operating system.
i.e. 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 Program Interface (API)rather than
direct system call use
E.g. for Microsoft Windows Platform APIs are
Win32 API
Mrs. M. P. Bhosale 2
Example of System Call
System call sequence to copy the contents of one file to
another file
Mrs. M. P. Bhosale 3
System Calls Cont…
Threegeneral methods used to pass parameters to
the OS
Simplest: passthe parameters in registers
In some cases, may be more parameters than registers
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
Parameters placed, or pushed, onto the stack by the
program and popped off the stack by the operating
system
Block and stack methods do not limit the number or
length of parameters being passed
Mrs. M. P. Bhosale 4
API –System Call –OS Relationship
Mrs. M. P. Bhosale 5
Passing of Parameters as A Table
Mrs. M. P. Bhosale 6
Types of System Calls
Systemcalls can be grouped into five
major categories:
Process Control
File Management
Device Management
Information Maintenance
Communications
Mrs. M. P. Bhosale 7
Process Control
end, abort
load, execute
create process, terminate process
get process attributes, set process attributes
wait for time
wait event, signal event
allocate and free memory
Mrs. M. P. Bhosale 8
File Management
create file, delete file
open, close file
read, write, reposition
get and set file attributes
Mrs. M. P. Bhosale 9
Device management
request device, release device
read, write, reposition
get device attributes, set device attributes
logically attach or detach devices
Mrs. M. P. Bhosale 10
Information maintenance
get time or date, set time or date
get system data, set system data
get and set process, file, or device attributes
Mrs. M. P. Bhosale 11
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
Mrs. M. P. Bhosale 12
Examples of
Windows and Unix System Calls
Mrs. M. P. Bhosale 13
Standard C Library Example
C program
invoking printf()
library call, which
calls write()
system call
Mrs. M. P. Bhosale 14
Continued…..
Mrs. M. P. Bhosale 15