SlideShare a Scribd company logo
1 of 11
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

What's hot

Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementationAbdullah Al Shiam
 
Unix files
Unix filesUnix files
Unix filesSunil Rm
 
Chapter07 Advanced File System Management
Chapter07      Advanced  File  System  ManagementChapter07      Advanced  File  System  Management
Chapter07 Advanced File System ManagementRaja Waseem Akhtar
 
File System Interface
File System InterfaceFile System Interface
File System Interfacechandinisanz
 
The unix file system
The unix file systemThe unix file system
The unix file systemgsandeepmenon
 
Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux Ahmed El-Arabawy
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsMukesh Chinta
 
physical file system in operating system
physical file system in operating systemphysical file system in operating system
physical file system in operating systemtittuajay
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System InterfaceWayne Jones Jnr
 
8 1-os file system implementation
8 1-os file system implementation8 1-os file system implementation
8 1-os file system implementationGol D Roger
 
101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct location101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct locationAcácio Oliveira
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)christ university
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentalsDima Gomaa
 

What's hot (20)

File system implementation
File system implementationFile system implementation
File system implementation
 
Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementation
 
Unix files
Unix filesUnix files
Unix files
 
File Systems
File SystemsFile Systems
File Systems
 
Chapter07 Advanced File System Management
Chapter07      Advanced  File  System  ManagementChapter07      Advanced  File  System  Management
Chapter07 Advanced File System Management
 
File System Interface
File System InterfaceFile System Interface
File System Interface
 
The unix file system
The unix file systemThe unix file system
The unix file system
 
File
FileFile
File
 
Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 2: Unwrapping Linux
 
File System Implementation
File System ImplementationFile System Implementation
File System Implementation
 
Unix training session 1
Unix training   session 1Unix training   session 1
Unix training session 1
 
Linux course fhs file hierarchy standard
Linux   course   fhs file hierarchy standardLinux   course   fhs file hierarchy standard
Linux course fhs file hierarchy standard
 
Operating Systems - Implementing File Systems
Operating Systems - Implementing File SystemsOperating Systems - Implementing File Systems
Operating Systems - Implementing File Systems
 
physical file system in operating system
physical file system in operating systemphysical file system in operating system
physical file system in operating system
 
Chapter 10 - File System Interface
Chapter 10 - File System InterfaceChapter 10 - File System Interface
Chapter 10 - File System Interface
 
8 1-os file system implementation
8 1-os file system implementation8 1-os file system implementation
8 1-os file system implementation
 
101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct location101 4.7 find system files and place files in the correct location
101 4.7 find system files and place files in the correct location
 
OSCh12
OSCh12OSCh12
OSCh12
 
Commands and shell programming (3)
Commands and shell programming (3)Commands and shell programming (3)
Commands and shell programming (3)
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 

Similar to System calls operating system ppt by rohit malav

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

Systemcall1
Systemcall1Systemcall1
Systemcall1
 
2_System Calls.pptx
2_System Calls.pptx2_System Calls.pptx
2_System Calls.pptx
 
Unit 7
Unit 7Unit 7
Unit 7
 
System call
System callSystem call
System call
 
DFSNov1.pptx
DFSNov1.pptxDFSNov1.pptx
DFSNov1.pptx
 
Chapter 01 New
Chapter 01 NewChapter 01 New
Chapter 01 New
 
App A
App AApp A
App A
 
17 files and streams
17 files and streams17 files and streams
17 files and streams
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
File management
File managementFile management
File management
 
Applecmdlista zs
Applecmdlista zsApplecmdlista zs
Applecmdlista zs
 
Unix-module3.pptx
Unix-module3.pptxUnix-module3.pptx
Unix-module3.pptx
 
Operating system
Operating systemOperating system
Operating system
 
Ch10
Ch10Ch10
Ch10
 
Presentasi SisOp_1
Presentasi SisOp_1Presentasi SisOp_1
Presentasi SisOp_1
 
Aix administration
Aix administrationAix administration
Aix administration
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION
OPERATING SYSTEMSDESIGN AND IMPLEMENTATIONOPERATING SYSTEMSDESIGN AND IMPLEMENTATION
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION
 
File Organization
File OrganizationFile Organization
File Organization
 

More from Rohit malav

Aca lab project (rohit malav)
Aca lab project (rohit malav) Aca lab project (rohit malav)
Aca lab project (rohit malav) Rohit malav
 
operating system calls input and output by (rohit malav)
operating system calls input and output by (rohit malav)operating system calls input and output by (rohit malav)
operating system calls input and output by (rohit malav)Rohit malav
 
Python pandas liberary
Python pandas liberaryPython pandas liberary
Python pandas liberaryRohit malav
 
Presentation by purshotam verma
Presentation by purshotam vermaPresentation by purshotam verma
Presentation by purshotam vermaRohit malav
 
Deep learning in python by purshottam verma
Deep learning in python by purshottam vermaDeep learning in python by purshottam verma
Deep learning in python by purshottam vermaRohit malav
 
Atm Security System Using Steganography Nss ptt by (rohit malav)
Atm Security System Using  Steganography Nss ptt by (rohit malav)Atm Security System Using  Steganography Nss ptt by (rohit malav)
Atm Security System Using Steganography Nss ptt by (rohit malav)Rohit malav
 
Samba server Pts report pdf by Rohit malav
Samba server Pts report pdf by Rohit malavSamba server Pts report pdf by Rohit malav
Samba server Pts report pdf by Rohit malavRohit malav
 
A project on spring framework by rohit malav
A project on spring framework by rohit malavA project on spring framework by rohit malav
A project on spring framework by rohit malavRohit malav
 
android text encryption Network security lab by rohit malav
android text encryption Network security lab by rohit malavandroid text encryption Network security lab by rohit malav
android text encryption Network security lab by rohit malavRohit malav
 
samba server setup Pts ppt (rohit malav)
samba server setup Pts ppt (rohit malav)samba server setup Pts ppt (rohit malav)
samba server setup Pts ppt (rohit malav)Rohit malav
 
Spring frame work by rohit malav(detailed)
Spring frame work by rohit malav(detailed)Spring frame work by rohit malav(detailed)
Spring frame work by rohit malav(detailed)Rohit malav
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malavRohit malav
 
Samba server linux (SMB) BY ROHIT MALAV
Samba server linux (SMB) BY ROHIT MALAVSamba server linux (SMB) BY ROHIT MALAV
Samba server linux (SMB) BY ROHIT MALAVRohit malav
 
Payroll system ppt1 (rohit malav)
Payroll system ppt1 (rohit malav)Payroll system ppt1 (rohit malav)
Payroll system ppt1 (rohit malav)Rohit malav
 
Payroll system ppt2 (rohit malav) version point 2
Payroll system ppt2 (rohit malav) version point 2Payroll system ppt2 (rohit malav) version point 2
Payroll system ppt2 (rohit malav) version point 2Rohit malav
 
ONLINE STUDENT MANAGEMENT SYSTEM
ONLINE STUDENT MANAGEMENT SYSTEMONLINE STUDENT MANAGEMENT SYSTEM
ONLINE STUDENT MANAGEMENT SYSTEMRohit malav
 
digital unlock power point slide
digital unlock power point slidedigital unlock power point slide
digital unlock power point slideRohit malav
 
Rohit android lab projects in suresh gyan vihar
Rohit android lab projects in suresh gyan viharRohit android lab projects in suresh gyan vihar
Rohit android lab projects in suresh gyan viharRohit malav
 
Snake report ROHIT MALAV
Snake report ROHIT MALAVSnake report ROHIT MALAV
Snake report ROHIT MALAVRohit malav
 

More from Rohit malav (20)

Aca lab project (rohit malav)
Aca lab project (rohit malav) Aca lab project (rohit malav)
Aca lab project (rohit malav)
 
operating system calls input and output by (rohit malav)
operating system calls input and output by (rohit malav)operating system calls input and output by (rohit malav)
operating system calls input and output by (rohit malav)
 
Python pandas liberary
Python pandas liberaryPython pandas liberary
Python pandas liberary
 
Presentation by purshotam verma
Presentation by purshotam vermaPresentation by purshotam verma
Presentation by purshotam verma
 
Deep learning in python by purshottam verma
Deep learning in python by purshottam vermaDeep learning in python by purshottam verma
Deep learning in python by purshottam verma
 
Atm Security System Using Steganography Nss ptt by (rohit malav)
Atm Security System Using  Steganography Nss ptt by (rohit malav)Atm Security System Using  Steganography Nss ptt by (rohit malav)
Atm Security System Using Steganography Nss ptt by (rohit malav)
 
Samba server Pts report pdf by Rohit malav
Samba server Pts report pdf by Rohit malavSamba server Pts report pdf by Rohit malav
Samba server Pts report pdf by Rohit malav
 
A project on spring framework by rohit malav
A project on spring framework by rohit malavA project on spring framework by rohit malav
A project on spring framework by rohit malav
 
android text encryption Network security lab by rohit malav
android text encryption Network security lab by rohit malavandroid text encryption Network security lab by rohit malav
android text encryption Network security lab by rohit malav
 
samba server setup Pts ppt (rohit malav)
samba server setup Pts ppt (rohit malav)samba server setup Pts ppt (rohit malav)
samba server setup Pts ppt (rohit malav)
 
Spring frame work by rohit malav(detailed)
Spring frame work by rohit malav(detailed)Spring frame work by rohit malav(detailed)
Spring frame work by rohit malav(detailed)
 
spring framework ppt by Rohit malav
spring framework ppt by Rohit malavspring framework ppt by Rohit malav
spring framework ppt by Rohit malav
 
Samba server linux (SMB) BY ROHIT MALAV
Samba server linux (SMB) BY ROHIT MALAVSamba server linux (SMB) BY ROHIT MALAV
Samba server linux (SMB) BY ROHIT MALAV
 
Payroll system ppt1 (rohit malav)
Payroll system ppt1 (rohit malav)Payroll system ppt1 (rohit malav)
Payroll system ppt1 (rohit malav)
 
Payroll system ppt2 (rohit malav) version point 2
Payroll system ppt2 (rohit malav) version point 2Payroll system ppt2 (rohit malav) version point 2
Payroll system ppt2 (rohit malav) version point 2
 
ONLINE STUDENT MANAGEMENT SYSTEM
ONLINE STUDENT MANAGEMENT SYSTEMONLINE STUDENT MANAGEMENT SYSTEM
ONLINE STUDENT MANAGEMENT SYSTEM
 
digital unlock power point slide
digital unlock power point slidedigital unlock power point slide
digital unlock power point slide
 
Rohit android lab projects in suresh gyan vihar
Rohit android lab projects in suresh gyan viharRohit android lab projects in suresh gyan vihar
Rohit android lab projects in suresh gyan vihar
 
Snake report ROHIT MALAV
Snake report ROHIT MALAVSnake report ROHIT MALAV
Snake report ROHIT MALAV
 
Gyan vihar app
Gyan vihar appGyan vihar app
Gyan vihar app
 

Recently uploaded

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 

Recently uploaded (20)

Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 

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()