SlideShare a Scribd company logo
1 of 17
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
CSS308 – OPERATING SYSTEMS
IIIYEAR / V SEMESTER
Prepared by
Dr.Thanuja R
Assistant Professor/ CSE
UNIT-I
OPERATING SYSTEMS OVERVIEW
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
Introduction: What Operating systems do - Structure -
Operations - Process management -Operating system Structure:
Services - User Interfaces - Systems calls and types – Systems
programs - Design and implementation - Operating System
Structure - System boot
SystemCalls
 Programminginterface to the servicesprovided by the O
S
 Typicallywritten in ahigh-levellanguage(Cor C++)
 Mostly accessed by programs via a high-level Application Programming
Interface(API)rather than direct systemcalluse
 Three most common APIs are Win32 API for Windows, POSIXAPI for
POSIX-basedsystems (including virtually all versions of UNIX, Linux, and
MacO
SX),andJavaAPIfor the Javavirtual machine (JVM)
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
Exampleof SystemCalls
 Systemcall sequenceto copythe contents of one file to another file
4
SystemCallImplementation
Typically,anumber associatedwith eachsystemcall
System-callinterfacemaintains atable indexedaccordingto these
numbers
The system call interface invokes the intended system call in OS
kernel and returns status of the systemcall and any return values
The caller need know nothing about how the system call is
implemented
Justneedsto obeyAPIandunderstand what OSwill do asaresult call
Most details of OSinterface hidden from programmer byAPI
Managedbyrun-time supportlibrary (set of functionsbuilt into libraries
included with compiler)
Why we use APIs rather than system call?
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
API–SystemCall–OSRelationship
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
SystemCallParameter Passing
Often, more information isrequired than simplyidentity of
desired systemcall
Exacttype andamount of information vary accordingtoOSand call
Threegeneral methods usedto passparameters to theOS
Simplest: passthe parameters inregisters
 In somecases,maybe more parameters thanregisters
Parametersstored in ablock, or table, inmemory, and addressof block
passedasaparameter in aregister
Thisapproach taken by LinuxandSolaris
Parametersplaced, or pushed,onto the stackby theprogram and
poppedoff the stackby the operatingsystem
Blockandstackmethods do not limit the number or length of
parameters beingpassed
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
Parameter Passingvia Table
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
Typesof SystemCalls
Typesof SystemCalls
Processcontrol
create process,terminateprocess
end, abort
load, execute
get processattributes, set processattributes
wait fortime
wait event, signalevent
allocate and free memory
Dump memory if error
Debuggerfor determining bugs,singlestep execution
Locksfor managingaccessto shareddata betweenprocesses
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
Typesof SystemCalls
 Filemanagement
 create file, deletefile
 open, closefile
 read, write, reposition
 get and set fileattributes
 Devicemanagement
 request device, releasedevice
 read, write, reposition
 Get& set deviceattributes
 logically attach or detachdevices
 Protection
 Control accessto resources
 Getand setpermissions
 Allow and denyuseraccess
 Information maintenance
 gettime or date,set time or date
 get systemdata, set systemdata
 get and set process,file, ordevice
attributes
 Communications
 create, delete communication
connection
 send,receive messagesif message
passingmodelto hostnameor
processname
Fromclientto server
 Shared-memorymodelcreate and
gainaccessto memoryregions
 transfer statusinformation
 attach and detach remotedevices
Pipe() system call Communications
PIPE() …
•int pipe(int fds[2]);
Parameters :
• fd[0] will be the fd(file descriptor) for the read
end of pipe.
•fd[1] will be the fd for the write end of pipe.
Returns : 0 on Success. -1 on error.
Ex:Windows and Unix SystemCalls
StandardCLibraryExample
 C program invoking
printf() library call,
which calls write()
system call
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
Example:MS-DOS
 Single-tasking
 Shellinvoked whensystem
booted
 Simplemethod torun
program
 Noprocesscreated
 Singlememory space
 Loadsprogram into memory,
overwriting all but thekernel
 Programexit ->shellreloaded
At system startup running a program
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
Example:FreeBSD
 Unix variant
 Multitasking
 Userlogin ->invokeuser’schoiceofshell
 Shellexecutesfork() systemcall tocreate
process
Executesexec()to load programinto
process
Shellwaits for processto terminateor
continues with usercommands
 Processexits with:
 code=0 –no error
 code>0 –error code
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE

More Related Content

Similar to 1.7 system calls

W5 system call, DD, OS structure.ppt
W5 system call, DD, OS structure.pptW5 system call, DD, OS structure.ppt
W5 system call, DD, OS structure.pptiqrayounus5
 
Operating System 2
Operating System 2Operating System 2
Operating System 2tech2click
 
Operating-System Structures
Operating-System StructuresOperating-System Structures
Operating-System StructuresCloudbells.com
 
FOISDBA-Ver1.1.pptx
FOISDBA-Ver1.1.pptxFOISDBA-Ver1.1.pptx
FOISDBA-Ver1.1.pptxssuser20fcbe
 
Operating system basics, Types of operating systems, Tasks, Process and Thre...
Operating system basics, Types of operating  systems, Tasks, Process and Thre...Operating system basics, Types of operating  systems, Tasks, Process and Thre...
Operating system basics, Types of operating systems, Tasks, Process and Thre...SattiBabu16
 
Operating-System Structures
Operating-System StructuresOperating-System Structures
Operating-System StructuresK Gowsic Gowsic
 
Operating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System StructuresOperating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System Structurescscarcas
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system conceptsGreen Ecosystem
 
Operating system
Operating systemOperating system
Operating systemHaripritha
 
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESOPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESpriyasoundar
 

Similar to 1.7 system calls (20)

W5 system call, DD, OS structure.ppt
W5 system call, DD, OS structure.pptW5 system call, DD, OS structure.ppt
W5 system call, DD, OS structure.ppt
 
Operating System 2
Operating System 2Operating System 2
Operating System 2
 
Operating-System Structures
Operating-System StructuresOperating-System Structures
Operating-System Structures
 
MODULE 2.ppt
MODULE 2.pptMODULE 2.ppt
MODULE 2.ppt
 
FOISDBA-Ver1.1.pptx
FOISDBA-Ver1.1.pptxFOISDBA-Ver1.1.pptx
FOISDBA-Ver1.1.pptx
 
Operating system basics, Types of operating systems, Tasks, Process and Thre...
Operating system basics, Types of operating  systems, Tasks, Process and Thre...Operating system basics, Types of operating  systems, Tasks, Process and Thre...
Operating system basics, Types of operating systems, Tasks, Process and Thre...
 
ch2.ppt
ch2.pptch2.ppt
ch2.ppt
 
ch2.ppt
ch2.pptch2.ppt
ch2.ppt
 
ch2.ppt
ch2.pptch2.ppt
ch2.ppt
 
Operating-System Structures
Operating-System StructuresOperating-System Structures
Operating-System Structures
 
ch2.ppt
ch2.pptch2.ppt
ch2.ppt
 
ch2.ppt
ch2.pptch2.ppt
ch2.ppt
 
ch2.ppt
ch2.pptch2.ppt
ch2.ppt
 
Operating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System StructuresOperating System - Unit I - Operating System Structures
Operating System - Unit I - Operating System Structures
 
Operating system
Operating systemOperating system
Operating system
 
Operating system concepts
Operating system conceptsOperating system concepts
Operating system concepts
 
Operating system
Operating systemOperating system
Operating system
 
2 os structure
2 os structure2 os structure
2 os structure
 
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURESOPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
 
OS-ch02-part-1-2024.ppt
OS-ch02-part-1-2024.pptOS-ch02-part-1-2024.ppt
OS-ch02-part-1-2024.ppt
 

Recently uploaded

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
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
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
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
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
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
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
(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
 
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
 

Recently uploaded (20)

(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
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
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
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
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
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 )
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
(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...
 
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)
 

1.7 system calls

  • 1. DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING CSS308 – OPERATING SYSTEMS IIIYEAR / V SEMESTER Prepared by Dr.Thanuja R Assistant Professor/ CSE
  • 2. UNIT-I OPERATING SYSTEMS OVERVIEW CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE Introduction: What Operating systems do - Structure - Operations - Process management -Operating system Structure: Services - User Interfaces - Systems calls and types – Systems programs - Design and implementation - Operating System Structure - System boot
  • 3. SystemCalls  Programminginterface to the servicesprovided by the O S  Typicallywritten in ahigh-levellanguage(Cor C++)  Mostly accessed by programs via a high-level Application Programming Interface(API)rather than direct systemcalluse  Three most common APIs are Win32 API for Windows, POSIXAPI for POSIX-basedsystems (including virtually all versions of UNIX, Linux, and MacO SX),andJavaAPIfor the Javavirtual machine (JVM) CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 4. Exampleof SystemCalls  Systemcall sequenceto copythe contents of one file to another file 4
  • 5. SystemCallImplementation Typically,anumber associatedwith eachsystemcall System-callinterfacemaintains atable indexedaccordingto these numbers The system call interface invokes the intended system call in OS kernel and returns status of the systemcall and any return values The caller need know nothing about how the system call is implemented Justneedsto obeyAPIandunderstand what OSwill do asaresult call Most details of OSinterface hidden from programmer byAPI Managedbyrun-time supportlibrary (set of functionsbuilt into libraries included with compiler) Why we use APIs rather than system call? CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 7. SystemCallParameter Passing Often, more information isrequired than simplyidentity of desired systemcall Exacttype andamount of information vary accordingtoOSand call Threegeneral methods usedto passparameters to theOS Simplest: passthe parameters inregisters  In somecases,maybe more parameters thanregisters Parametersstored in ablock, or table, inmemory, and addressof block passedasaparameter in aregister Thisapproach taken by LinuxandSolaris Parametersplaced, or pushed,onto the stackby theprogram and poppedoff the stackby the operatingsystem Blockandstackmethods do not limit the number or length of parameters beingpassed CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 8. Parameter Passingvia Table CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 10. Typesof SystemCalls Processcontrol create process,terminateprocess end, abort load, execute get processattributes, set processattributes wait fortime wait event, signalevent allocate and free memory Dump memory if error Debuggerfor determining bugs,singlestep execution Locksfor managingaccessto shareddata betweenprocesses CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 11. Typesof SystemCalls  Filemanagement  create file, deletefile  open, closefile  read, write, reposition  get and set fileattributes  Devicemanagement  request device, releasedevice  read, write, reposition  Get& set deviceattributes  logically attach or detachdevices  Protection  Control accessto resources  Getand setpermissions  Allow and denyuseraccess  Information maintenance  gettime or date,set time or date  get systemdata, set systemdata  get and set process,file, ordevice attributes  Communications  create, delete communication connection  send,receive messagesif message passingmodelto hostnameor processname Fromclientto server  Shared-memorymodelcreate and gainaccessto memoryregions  transfer statusinformation  attach and detach remotedevices
  • 12. Pipe() system call Communications
  • 13. PIPE() … •int pipe(int fds[2]); Parameters : • fd[0] will be the fd(file descriptor) for the read end of pipe. •fd[1] will be the fd for the write end of pipe. Returns : 0 on Success. -1 on error.
  • 14. Ex:Windows and Unix SystemCalls StandardCLibraryExample  C program invoking printf() library call, which calls write() system call CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 15. Example:MS-DOS  Single-tasking  Shellinvoked whensystem booted  Simplemethod torun program  Noprocesscreated  Singlememory space  Loadsprogram into memory, overwriting all but thekernel  Programexit ->shellreloaded At system startup running a program CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 16. Example:FreeBSD  Unix variant  Multitasking  Userlogin ->invokeuser’schoiceofshell  Shellexecutesfork() systemcall tocreate process Executesexec()to load programinto process Shellwaits for processto terminateor continues with usercommands  Processexits with:  code=0 –no error  code>0 –error code CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE
  • 17. CSS308-OPERATING SYSTEMS / Dr.Thanuja R/ AP/ CSE