SlideShare a Scribd company logo
1
System Calls and I/O
SUBMITTED BY:- ROHIT MALAV
SID :- 38725
BASIC TOPICS
 Goals
 Get you familiar with necessary basic system & I/O calls to
do programming
 Things covered
 Basic file system calls
 I/O calls
 Signals
System Calls
3
 System Calls
 A request to the operating system to perform some activity
 System calls are expensive
 The system needs to perform many things before
executing a system call
 The computer (hardware) saves its state
 The OS code takes control of the CPU, privileges are
updated.
 The OS examines the call parameters
 The OS performs the requested function
 The OS saves its state (and call results)
 The OS returns control of the CPU to the caller
Examples of System Calls
4
 Examples
 getuid()
 fork()
 exec()
//get the user ID
//create a child process
//executing a program
Major System Calls
5
Process Management
pid = fork( ) Create a child process identical to the parent
pid = waitpid(pid, &statloc, options) Wait for a child to terminate
s = execve(name, argv, environp) Replace a process’ core image
exit(status) Terminate process execution and return status
File Management Today
fd = open(file, how, ...) Open a file for reading, writing or both
s = close(fd) Close an open file
n = read(fd, buffer, nbytes) Read data from a file into a buffer
n = write(fd, buffer, nbytes) Write data from a buffer into a file
position = lseek(fd, offset, whence) Move the file pointer
s = stat(name, &buf) Get a file’s status information
Directory and File System Management
s = mkdir(name, mode) Create a new directory
s = rmdir(name) Remove an empty directory
s = link(name, name) Create a new entry, name, pointing to name
s = unlink(name) Remove a directory entry
s = mount(special,
name,
flag) Mount a file system
s = umount(special) Unmount a file system
Miscellaneous
s = chdir(dirname) Change the working directory
s = chmod(name, mode) Change a file’s protection bits
s = kill(pid, signal) Send a signal to a process
seconds =
time(&seconds)
Get the elapsed time since January 1, 1970
Major System Calls
File System and I/O Related
System Calls
Copyright ©: University of Illinois CS 241 Staff 7
 A file system
 A means to organize, retrieve, and
updated data in persistent storage
 A hierarchical arrangement of directories
 Bookkeeping information (file metadata)
 File length, # bytes, modified timestamp, etc
 Unix file system
 Root file system starts with “/”
Why does the OS control I/O?
8
 Safety
 The computer must ensure that if a program has
a bug in it, then it doesn't crash or mess up
 The system
 Other programs that may be running at the same time
or later
 Fairness
 Make sure other programs have a fair use of
device
Basic Unix Concepts
 Input/Output – I/O
 Per-process table of I/O channels
 Table entries describe files, sockets, devices, pipes, etc.
 Table entry/index into table called “file descriptor”
 Unifies I/O interface
user space
pipe
file
socket
Per-process file
descriptor
table
kernel
system open file
table
9
System Calls for I/O
Copyright ©: University of Illinois CS 241 Staff 10
 Get information about a file
int stat(const char* name, struct stat* buf);
 Open (and/or create) a file for reading, writing or both
int open (const char* name, in flags);
 Read data from one buffer to file descriptor
size_t read (int fd, void* buf, size_t cnt);
 Write data from file descriptor into buffer
size_t write (int fd, void* buf, size_t cnt);
 Close a file
int close(int fd);
System Calls for I/O
Copyright ©: University of Illinois CS 241 Staff 11
 They look like regular procedure calls but
are different
 A system call makes a request to the operating
system by trapping into kernel mode
 A procedure call just jumps to a procedure
defined elsewhere in your program
 Some library procedure calls may
themselves make a system call
 e.g., fopen() calls open()

More Related Content

PPTX
File Management
PPTX
Operating Systems - File Management
PPTX
file system in operating system
PDF
File management
PPT
Xfs file system for linux
PPT
Ch11 file system interface
PPT
Unix File System
PPT
Unix.system.calls
File Management
Operating Systems - File Management
file system in operating system
File management
Xfs file system for linux
Ch11 file system interface
Unix File System
Unix.system.calls

What's hot (20)

PPTX
File system implementation
PPTX
Ch11 file system implementation
PDF
Unix files
PDF
File Systems
PPT
Chapter07 Advanced File System Management
PPTX
File System Interface
PDF
The unix file system
PDF
File
PDF
Course 102: Lecture 2: Unwrapping Linux
PPTX
File System Implementation
PPTX
Unix training session 1
PDF
Linux course fhs file hierarchy standard
PDF
Operating Systems - Implementing File Systems
PPTX
physical file system in operating system
PPT
Chapter 10 - File System Interface
PPT
8 1-os file system implementation
PPT
101 4.7 find system files and place files in the correct location
PPT
PPTX
Commands and shell programming (3)
PPT
Unix fundamentals
File system implementation
Ch11 file system implementation
Unix files
File Systems
Chapter07 Advanced File System Management
File System Interface
The unix file system
File
Course 102: Lecture 2: Unwrapping Linux
File System Implementation
Unix training session 1
Linux course fhs file hierarchy standard
Operating Systems - Implementing File Systems
physical file system in operating system
Chapter 10 - File System Interface
8 1-os file system implementation
101 4.7 find system files and place files in the correct location
Commands and shell programming (3)
Unix fundamentals
Ad

Similar to System calls operating system ppt by rohit malav (20)

PPTX
operating system calls input and output by (rohit malav)
PPT
Introduction to System Calls
PDF
Os lab final
PPT
System calls in Linux environment for beginners
DOCX
Linux 系統程式--第一章 i/o 函式
PPT
ch2_OS Structures.ppt To discuss the various ways of structuring an operatin...
PPTX
Lecture_02_Operating System Structures Operating Systems
PDF
System Structure Notes : comprehensive study
PDF
Operating System
PDF
Operating System
PDF
CH02.pdf
PPT
W5 system call, DD, OS structure.ppt
PPT
operating system introduction and organization
PPTX
Services and system calls
PDF
02_os_structures.pdfbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
PPTX
OS SERVICES.pptxJGHHHHHHHHHHHHHHHHGGGGGGGG
PDF
Operating System Lecture Notes Mit 6828 Itebooks
PPTX
System call
PPTX
Systemcall1
PDF
this book is all about operating sys.pdf
operating system calls input and output by (rohit malav)
Introduction to System Calls
Os lab final
System calls in Linux environment for beginners
Linux 系統程式--第一章 i/o 函式
ch2_OS Structures.ppt To discuss the various ways of structuring an operatin...
Lecture_02_Operating System Structures Operating Systems
System Structure Notes : comprehensive study
Operating System
Operating System
CH02.pdf
W5 system call, DD, OS structure.ppt
operating system introduction and organization
Services and system calls
02_os_structures.pdfbnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
OS SERVICES.pptxJGHHHHHHHHHHHHHHHHGGGGGGGG
Operating System Lecture Notes Mit 6828 Itebooks
System call
Systemcall1
this book is all about operating sys.pdf
Ad

More from Rohit malav (20)

PPTX
Aca lab project (rohit malav)
PPTX
Python pandas liberary
PPTX
Presentation by purshotam verma
PPTX
Deep learning in python by purshottam verma
PPTX
Atm Security System Using Steganography Nss ptt by (rohit malav)
DOCX
Samba server Pts report pdf by Rohit malav
PPTX
A project on spring framework by rohit malav
PPTX
android text encryption Network security lab by rohit malav
PPTX
samba server setup Pts ppt (rohit malav)
PPTX
Spring frame work by rohit malav(detailed)
PPTX
spring framework ppt by Rohit malav
PPTX
Samba server linux (SMB) BY ROHIT MALAV
PPTX
Payroll system ppt1 (rohit malav)
PPTX
Payroll system ppt2 (rohit malav) version point 2
PPTX
ONLINE STUDENT MANAGEMENT SYSTEM
PPTX
digital unlock power point slide
PDF
Rohit android lab projects in suresh gyan vihar
DOCX
Snake report ROHIT MALAV
PPTX
Gyan vihar app
PPTX
Payroll system ppt1(ads) (rohit malav)
Aca lab project (rohit malav)
Python pandas liberary
Presentation by purshotam verma
Deep learning in python by purshottam verma
Atm Security System Using Steganography Nss ptt by (rohit malav)
Samba server Pts report pdf by Rohit malav
A project on spring framework by rohit malav
android text encryption Network security lab by rohit malav
samba server setup Pts ppt (rohit malav)
Spring frame work by rohit malav(detailed)
spring framework ppt by Rohit malav
Samba server linux (SMB) BY ROHIT MALAV
Payroll system ppt1 (rohit malav)
Payroll system ppt2 (rohit malav) version point 2
ONLINE STUDENT MANAGEMENT SYSTEM
digital unlock power point slide
Rohit android lab projects in suresh gyan vihar
Snake report ROHIT MALAV
Gyan vihar app
Payroll system ppt1(ads) (rohit malav)

Recently uploaded (20)

PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Well-logging-methods_new................
PDF
Digital Logic Computer Design lecture notes
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPT
Project quality management in manufacturing
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
web development for engineering and engineering
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Geodesy 1.pptx...............................................
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
composite construction of structures.pdf
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
R24 SURVEYING LAB MANUAL for civil enggi
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Well-logging-methods_new................
Digital Logic Computer Design lecture notes
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Project quality management in manufacturing
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Mechanical Engineering MATERIALS Selection
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Operating System & Kernel Study Guide-1 - converted.pdf
web development for engineering and engineering
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Geodesy 1.pptx...............................................
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
composite construction of structures.pdf
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf

System calls operating system ppt by rohit malav

  • 1. 1 System Calls and I/O SUBMITTED BY:- ROHIT MALAV SID :- 38725
  • 2. BASIC TOPICS  Goals  Get you familiar with necessary basic system & I/O calls to do programming  Things covered  Basic file system calls  I/O calls  Signals
  • 3. System Calls 3  System Calls  A request to the operating system to perform some activity  System calls are expensive  The system needs to perform many things before executing a system call  The computer (hardware) saves its state  The OS code takes control of the CPU, privileges are updated.  The OS examines the call parameters  The OS performs the requested function  The OS saves its state (and call results)  The OS returns control of the CPU to the caller
  • 4. Examples of System Calls 4  Examples  getuid()  fork()  exec() //get the user ID //create a child process //executing a program
  • 5. Major System Calls 5 Process Management pid = fork( ) Create a child process identical to the parent pid = waitpid(pid, &statloc, options) Wait for a child to terminate s = execve(name, argv, environp) Replace a process’ core image exit(status) Terminate process execution and return status File Management Today fd = open(file, how, ...) Open a file for reading, writing or both s = close(fd) Close an open file n = read(fd, buffer, nbytes) Read data from a file into a buffer n = write(fd, buffer, nbytes) Write data from a buffer into a file position = lseek(fd, offset, whence) Move the file pointer s = stat(name, &buf) Get a file’s status information
  • 6. Directory and File System Management s = mkdir(name, mode) Create a new directory s = rmdir(name) Remove an empty directory s = link(name, name) Create a new entry, name, pointing to name s = unlink(name) Remove a directory entry s = mount(special, name, flag) Mount a file system s = umount(special) Unmount a file system Miscellaneous s = chdir(dirname) Change the working directory s = chmod(name, mode) Change a file’s protection bits s = kill(pid, signal) Send a signal to a process seconds = time(&seconds) Get the elapsed time since January 1, 1970 Major System Calls
  • 7. File System and I/O Related System Calls Copyright ©: University of Illinois CS 241 Staff 7  A file system  A means to organize, retrieve, and updated data in persistent storage  A hierarchical arrangement of directories  Bookkeeping information (file metadata)  File length, # bytes, modified timestamp, etc  Unix file system  Root file system starts with “/”
  • 8. Why does the OS control I/O? 8  Safety  The computer must ensure that if a program has a bug in it, then it doesn't crash or mess up  The system  Other programs that may be running at the same time or later  Fairness  Make sure other programs have a fair use of device
  • 9. Basic Unix Concepts  Input/Output – I/O  Per-process table of I/O channels  Table entries describe files, sockets, devices, pipes, etc.  Table entry/index into table called “file descriptor”  Unifies I/O interface user space pipe file socket Per-process file descriptor table kernel system open file table 9
  • 10. System Calls for I/O Copyright ©: University of Illinois CS 241 Staff 10  Get information about a file int stat(const char* name, struct stat* buf);  Open (and/or create) a file for reading, writing or both int open (const char* name, in flags);  Read data from one buffer to file descriptor size_t read (int fd, void* buf, size_t cnt);  Write data from file descriptor into buffer size_t write (int fd, void* buf, size_t cnt);  Close a file int close(int fd);
  • 11. System Calls for I/O Copyright ©: University of Illinois CS 241 Staff 11  They look like regular procedure calls but are different  A system call makes a request to the operating system by trapping into kernel mode  A procedure call just jumps to a procedure defined elsewhere in your program  Some library procedure calls may themselves make a system call  e.g., fopen() calls open()