SlideShare a Scribd company logo
OPERATING SYSTEM
(R18 II(II Sem))
Department of computer science and engineering (AI & ML)
LEC 5
by
Asst.Prof.M.Gokilavani
VITS
6/11/2023 Department of CSE (AI/ML) 1
Syllabus
6/11/2023 Department of CSE (AI/ML) 2
6/11/2023 Department of CSE (AI/ML) 3
TEXTBOOK:
• Operating System Principles- Abraham Silberchatz, Peter B. Galvin, Greg
Gagne 7th Edition, John Wiley.
• Advanced programming in the UNIX environment, W.R. Stevens, Pearson
education.
REFERENCES:
• Operating Systems – Internals and Design Principles Stallings, Fifth Edition–
2005, Pearson Education/PHI.
• Operating System A Design Approach- Crowley, TMH.
• Modern Operating Systems, Andrew S. Tanenbaum 2nd edition, Pearson/PHI.
• UNIX programming environment, Kernighan and Pike, PHI/ Pearson Education.
• UNIX Internals -The New Frontiers, U. Vahalia, Pearson Education
6/11/2023 Department of CSE (AI/ML) 4
Topics covered in Lec 5
6/11/2023 Department of CSE (AI/ML) 5
UNIT – I: Operating System - Introduction, Structures - Simple Batch,
Multiprogrammed, Time-shared, Personal Computer, Parallel, Distributed
Systems, Real-Time Systems, System components, Operating System
services, System Calls.
System calls in OS
• A system call is a way for a user program to interface with the
operating system.
• The program requests several services, and the OS responds by
invoking a series of system calls to satisfy the request.
• A system call can be written in assembly language or a high-level
language like C or Pascal.
• System calls are predefined functions that the operating system may
directly invoke if a high-level language is used.
6/11/2023 Department of CSE (AI/ML) 6
What is a System Call?
• A system call is a method for a computer program to request a service from
the kernel of the operating system on which it is running.
• A system call is a method of interacting with the operating system via
programs.
• A system call is a request from computer software to an operating system's
kernel.
• The Application Program Interface (API) connects the operating system's
functions to user programs.
• It acts as a link between the operating system and a process, allowing user-
level programs to request operating system services.
• The kernel system can only be accessed using system calls.
• System calls are required for any programs that use resources.
6/11/2023 Department of CSE (AI/ML) 7
How are system calls made?
• When a computer software needs to access the operating system's kernel, it makes a system call.
• The system call uses an API to expose the operating system's services to user programs.
• It is the only method to access the kernel system.
• All programs or processes that require resources for execution must use system calls, as they serve
as an interface between the operating system and user programs.
Below are some examples of how a system call varies from a user function.
• A system call function may create and use kernel processes to execute the asynchronous
processing.
• A system call has greater authority than a standard subroutine. A system call with kernel-mode
privilege executes in the kernel protection domain.
• System calls are not permitted to use shared libraries or any symbols that are not present in the
kernel protection domain.
• The code and data for system calls are stored in global kernel memory.
6/11/2023 Department of CSE (AI/ML) 8
Example of System Calls
• System call sequence to copy the contents of one file to another file.
6/11/2023 Department of CSE (AI/ML) 9
Example of Standard API
6/11/2023 Department of CSE (AI/ML) 10
Why do you need system calls in Operating System?
There are various situations where you must require system calls in the
operating system. Following of the situations are as follows:
• It is must require when a file system wants to create or delete a file.
• Network connections require the system calls to sending and receiving
data packets.
• If you want to read or write a file, you need to system calls.
• If you want to access hardware devices, including a printer, scanner,
you need a system call.
• System calls are used to create and manage new processes.
6/11/2023 Department of CSE (AI/ML) 11
How System call works?
• Typically, a number associated with each system call
• System-call interface maintains a table indexed according to these
numbers
• The system call interface invokes the intended system call in OS kernel and
returns status of the system call and any return values
• The caller need know nothing about how the system call is implemented
• Just needs to obey API and understand what OS will do as a result call
• Most details of OS interface hidden from programmer by API
• Managed by run-time support library (set of functions built into
libraries included with compiler)
6/11/2023 Department of CSE (AI/ML) 12
API – System Call – OS Relationship
6/11/2023 Department of CSE (AI/ML) 13
System Call Parameter Passing
• Often, more information is required than simply identity of desired system
call
• Exact type and amount of information vary according to OS and call
• Three general methods used to pass parameters to the OS
• Simplest: pass the 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
6/11/2023 Department of CSE (AI/ML) 14
Parameter Passing via Table
6/11/2023 Department of CSE (AI/ML) 15
Types of System Calls
6/11/2023 Department of CSE (AI/ML) 16
Types of System Calls
• Process control
• create process, terminate process
• end, abort
• load, execute
• get process attributes, set process attributes
• wait for time
• wait event, signal event
• allocate and free memory
• Dump memory if error
• Debugger for determining bugs, single step execution
• Locks for managing access to shared data between processes
6/11/2023 Department of CSE (AI/ML) 17
Types of System Calls
• File management
• create file, delete file
• open, close file
• read, write, reposition
• get and set file attributes
• Device management
• request device, release device
• read, write, reposition
• get device attributes, set device attributes
• logically attach or detach devices
• Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
6/11/2023 Department of CSE (AI/ML) 18
Types of System Calls (Cont.)
• Information maintenance
• get time or date, set time or date
• get system data, set system data
• get and set process, file, or device attributes
• 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
6/11/2023 Department of CSE (AI/ML) 19
Examples of Windows and Unix System Calls
6/11/2023 Department of CSE (AI/ML) 20
Standard C Library Example
• C program invoking printf() library call, which calls write() system
call.
6/11/2023 Department of CSE (AI/ML) 21
Example: MS-DOS
6/11/2023 Department of CSE (AI/ML) 22
• Single-tasking
• Shell invoked when system booted
• Simple method to run program
• No process created
• Single memory space
• Loads program into memory, overwriting all but the kernel
• Program exit -> shell reloaded
System Programs
• System programs provide a convenient environment for program development and
execution.
• They can be divided into:
• File manipulation
• Status information sometimes stored in a File modification
• Programming language support
• Program loading and execution
• Communications
• Background services
• Application programs
• Most users’ view of the operation system is defined by system programs, not the
actual system calls
6/11/2023 Department of CSE (AI/ML) 23
System program
6/11/2023 Department of CSE (AI/ML) 24
System Programs
• Provide a convenient environment for program development and execution
• Some of them are simply user interfaces to system calls; others are
considerably more complex.
• File management - Create, delete, copy, rename, print, dump, list, and
generally manipulate files and directories.
• Status information
• Some ask the system for info - date, time, amount of available memory,
disk space, number of users.
• Others provide detailed performance, logging, and debugging information
• Typically, these programs format and print the output to the terminal or
other output devices.
• Some systems implement a registry - used to store and retrieve
configuration information.
6/11/2023 Department of CSE (AI/ML) 25
System Programs
• File modification
• Text editors to create and modify files
• Special commands to search contents of files or perform transformations of the
text
• Programming-language support - Compilers, assemblers, debuggers and
interpreters sometimes provided
• Program loading and execution- Absolute loaders, relocatable loaders, linkage
editors, and overlay-loaders, debugging systems for higher-level and machine
language
• Communications - Provide the mechanism for creating virtual connections
among processes, users, and computer systems
• Allow users to send messages to one another’s screens, browse web pages,
send electronic-mail messages, log in remotely, transfer files from one
machine to another.
6/11/2023 Department of CSE (AI/ML) 26
System Programs
• Background Services
• Launch at boot time
• Some for system startup, then terminate
• Some from system boot to shutdown
• Provide facilities like disk checking, process scheduling, error logging,
printing
• Run in user context not kernel context
• Known as services, subsystems, daemons
• Application programs
• Don’t pertain to system
• Run by users
• Not typically considered part of OS
• Launched by command line, mouse click, finger poke
6/11/2023 Department of CSE (AI/ML) 27
Topics to be covered in next Lec 6
•Operating System Structure
6/11/2023 Department of CSE (AI/ML) 28
Thank you!!!

More Related Content

What's hot

Bai giang cau_truc_may_tinh
Bai giang cau_truc_may_tinhBai giang cau_truc_may_tinh
Bai giang cau_truc_may_tinh
Thùy Linh
 
top level view of computer function and interconnection
top level view of computer function and interconnectiontop level view of computer function and interconnection
top level view of computer function and interconnection
Sajid Marwat
 
Classical problem of synchronization
Classical problem of synchronizationClassical problem of synchronization
Classical problem of synchronization
Shakshi Ranawat
 

What's hot (20)

Bai giang cau_truc_may_tinh
Bai giang cau_truc_may_tinhBai giang cau_truc_may_tinh
Bai giang cau_truc_may_tinh
 
introduction to operating system
introduction to operating systemintroduction to operating system
introduction to operating system
 
Operating System Unit 1
Operating System Unit 1Operating System Unit 1
Operating System Unit 1
 
System call
System callSystem call
System call
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
 
OPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTESOPERATING SYSTEM - SHORT NOTES
OPERATING SYSTEM - SHORT NOTES
 
Software 3
Software 3Software 3
Software 3
 
top level view of computer function and interconnection
top level view of computer function and interconnectiontop level view of computer function and interconnection
top level view of computer function and interconnection
 
System call
System callSystem call
System call
 
Operating system - Process and its concepts
Operating system - Process and its conceptsOperating system - Process and its concepts
Operating system - Process and its concepts
 
Лекція №5
Лекція №5Лекція №5
Лекція №5
 
Classical problem of synchronization
Classical problem of synchronizationClassical problem of synchronization
Classical problem of synchronization
 
CS304PC: Computer Organization and Architecture Session 27 priority interrupt...
CS304PC: Computer Organization and Architecture Session 27 priority interrupt...CS304PC: Computer Organization and Architecture Session 27 priority interrupt...
CS304PC: Computer Organization and Architecture Session 27 priority interrupt...
 
Cpu scheduling in operating System.
Cpu scheduling in operating System.Cpu scheduling in operating System.
Cpu scheduling in operating System.
 
MEMORY MANAGEMENT
MEMORY MANAGEMENTMEMORY MANAGEMENT
MEMORY MANAGEMENT
 
Embedded Linux
Embedded LinuxEmbedded Linux
Embedded Linux
 
Interrupts
InterruptsInterrupts
Interrupts
 
instruction codes
instruction codesinstruction codes
instruction codes
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
 
Input & Output
Input & OutputInput & Output
Input & Output
 

Similar to CS403: Operating System : Lec 5 System calls.pptx

Similar to CS403: Operating System : Lec 5 System calls.pptx (20)

Operating system 11 system calls
Operating system 11 system callsOperating system 11 system calls
Operating system 11 system calls
 
CS403: Operating System : Lec 4 OS services.pptx
CS403: Operating System : Lec 4 OS services.pptxCS403: Operating System : Lec 4 OS services.pptx
CS403: Operating System : Lec 4 OS services.pptx
 
CS403: Operating System : Lec 1 Introduction.pptx
CS403: Operating System : Lec 1 Introduction.pptxCS403: Operating System : Lec 1 Introduction.pptx
CS403: Operating System : Lec 1 Introduction.pptx
 
Ch2 operating-system structures
Ch2   operating-system structuresCh2   operating-system structures
Ch2 operating-system structures
 
CS403: Operating System :Lec 2 Function of OS.pptx
CS403: Operating System :Lec 2 Function of OS.pptxCS403: Operating System :Lec 2 Function of OS.pptx
CS403: Operating System :Lec 2 Function of OS.pptx
 
CS403: Operating System : Lec 3 Types of OS (1) .pptx
CS403: Operating System : Lec 3 Types of OS (1) .pptxCS403: Operating System : Lec 3 Types of OS (1) .pptx
CS403: Operating System : Lec 3 Types of OS (1) .pptx
 
Os unit 1(cont)
Os unit 1(cont)Os unit 1(cont)
Os unit 1(cont)
 
chapter2.pptx
chapter2.pptxchapter2.pptx
chapter2.pptx
 
Unit 4
Unit  4Unit  4
Unit 4
 
Services and system calls
Services and system callsServices and system calls
Services and system calls
 
2 operating system structures
2 operating system structures2 operating system structures
2 operating system structures
 
Operating System Structure Part-I.pdf
Operating System Structure Part-I.pdfOperating System Structure Part-I.pdf
Operating System Structure Part-I.pdf
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
 
System calls
System callsSystem calls
System calls
 
OS Services, System call, Virtual Machine
OS Services, System call, Virtual MachineOS Services, System call, Virtual Machine
OS Services, System call, Virtual Machine
 
CS403 Operating system Lec 8 - Process concepts.pptx
CS403 Operating system Lec 8 - Process concepts.pptxCS403 Operating system Lec 8 - Process concepts.pptx
CS403 Operating system Lec 8 - Process concepts.pptx
 
1. Unit 1_Introduction to OS.pptx
1. Unit 1_Introduction to OS.pptx1. Unit 1_Introduction to OS.pptx
1. Unit 1_Introduction to OS.pptx
 
Os unit i
Os unit iOs unit i
Os unit i
 
cs-intro-os.ppt
cs-intro-os.pptcs-intro-os.ppt
cs-intro-os.ppt
 
Operating Systems 1 (3/12) - Architectures
Operating Systems 1 (3/12) - ArchitecturesOperating Systems 1 (3/12) - Architectures
Operating Systems 1 (3/12) - Architectures
 

More from Asst.prof M.Gokilavani

More from Asst.prof M.Gokilavani (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
IT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdfIT8073_Information Security_UNIT I _.pdf
IT8073_Information Security_UNIT I _.pdf
 
IT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notesIT8073 _Information Security _UNIT I Full notes
IT8073 _Information Security _UNIT I Full notes
 
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdfGE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
GE3151 PSPP UNIT IV QUESTION BANK.docx.pdf
 
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdfGE3151 PSPP UNIT III QUESTION BANK.docx.pdf
GE3151 PSPP UNIT III QUESTION BANK.docx.pdf
 
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdfGE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
 
GE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdfGE3151 PSPP All unit question bank.pdf
GE3151 PSPP All unit question bank.pdf
 
GE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _NotesGE3151_PSPP_All unit _Notes
GE3151_PSPP_All unit _Notes
 
GE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_NotesGE3151_PSPP_UNIT_5_Notes
GE3151_PSPP_UNIT_5_Notes
 
GE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_NotesGE3151_PSPP_UNIT_4_Notes
GE3151_PSPP_UNIT_4_Notes
 
GE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_NotesGE3151_PSPP_UNIT_3_Notes
GE3151_PSPP_UNIT_3_Notes
 
GE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_NotesGE3151_PSPP_UNIT_2_Notes
GE3151_PSPP_UNIT_2_Notes
 
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdfAI3391 Artificial intelligence Unit IV Notes _ merged.pdf
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
 
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdfAI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
AI3391 Artificial intelligence Session 29 Forward and backward chaining.pdf
 
AI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptxAI3391 Artificial intelligence Session 28 Resolution.pptx
AI3391 Artificial intelligence Session 28 Resolution.pptx
 
AI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptxAI3391 Artificial intelligence session 27 inference and unification.pptx
AI3391 Artificial intelligence session 27 inference and unification.pptx
 
AI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptxAI3391 Artificial Intelligence Session 26 First order logic.pptx
AI3391 Artificial Intelligence Session 26 First order logic.pptx
 

Recently uploaded

CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
AbrahamGadissa
 

Recently uploaded (20)

ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES  INTRODUCTION UNIT-IENERGY STORAGE DEVICES  INTRODUCTION UNIT-I
ENERGY STORAGE DEVICES INTRODUCTION UNIT-I
 
Natalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in KrakówNatalia Rutkowska - BIM School Course in Kraków
Natalia Rutkowska - BIM School Course in Kraków
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
A case study of cinema management system project report..pdf
A case study of cinema management system project report..pdfA case study of cinema management system project report..pdf
A case study of cinema management system project report..pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptxCloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
Cloud-Computing_CSE311_Computer-Networking CSE GUB BD - Shahidul.pptx
 
IT-601 Lecture Notes-UNIT-2.pdf Data Analysis
IT-601 Lecture Notes-UNIT-2.pdf Data AnalysisIT-601 Lecture Notes-UNIT-2.pdf Data Analysis
IT-601 Lecture Notes-UNIT-2.pdf Data Analysis
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Top 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering ScientistTop 13 Famous Civil Engineering Scientist
Top 13 Famous Civil Engineering Scientist
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
Explosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdfExplosives Industry manufacturing process.pdf
Explosives Industry manufacturing process.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
NO1 Pandit Amil Baba In Bahawalpur, Sargodha, Sialkot, Sheikhupura, Rahim Yar...
 
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docxThe Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
The Ultimate Guide to External Floating Roofs for Oil Storage Tanks.docx
 
Digital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdfDigital Signal Processing Lecture notes n.pdf
Digital Signal Processing Lecture notes n.pdf
 
İTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering WorkshopİTÜ CAD and Reverse Engineering Workshop
İTÜ CAD and Reverse Engineering Workshop
 
Toll tax management system project report..pdf
Toll tax management system project report..pdfToll tax management system project report..pdf
Toll tax management system project report..pdf
 

CS403: Operating System : Lec 5 System calls.pptx

  • 1. OPERATING SYSTEM (R18 II(II Sem)) Department of computer science and engineering (AI & ML) LEC 5 by Asst.Prof.M.Gokilavani VITS 6/11/2023 Department of CSE (AI/ML) 1
  • 3. 6/11/2023 Department of CSE (AI/ML) 3
  • 4. TEXTBOOK: • Operating System Principles- Abraham Silberchatz, Peter B. Galvin, Greg Gagne 7th Edition, John Wiley. • Advanced programming in the UNIX environment, W.R. Stevens, Pearson education. REFERENCES: • Operating Systems – Internals and Design Principles Stallings, Fifth Edition– 2005, Pearson Education/PHI. • Operating System A Design Approach- Crowley, TMH. • Modern Operating Systems, Andrew S. Tanenbaum 2nd edition, Pearson/PHI. • UNIX programming environment, Kernighan and Pike, PHI/ Pearson Education. • UNIX Internals -The New Frontiers, U. Vahalia, Pearson Education 6/11/2023 Department of CSE (AI/ML) 4
  • 5. Topics covered in Lec 5 6/11/2023 Department of CSE (AI/ML) 5 UNIT – I: Operating System - Introduction, Structures - Simple Batch, Multiprogrammed, Time-shared, Personal Computer, Parallel, Distributed Systems, Real-Time Systems, System components, Operating System services, System Calls.
  • 6. System calls in OS • A system call is a way for a user program to interface with the operating system. • The program requests several services, and the OS responds by invoking a series of system calls to satisfy the request. • A system call can be written in assembly language or a high-level language like C or Pascal. • System calls are predefined functions that the operating system may directly invoke if a high-level language is used. 6/11/2023 Department of CSE (AI/ML) 6
  • 7. What is a System Call? • A system call is a method for a computer program to request a service from the kernel of the operating system on which it is running. • A system call is a method of interacting with the operating system via programs. • A system call is a request from computer software to an operating system's kernel. • The Application Program Interface (API) connects the operating system's functions to user programs. • It acts as a link between the operating system and a process, allowing user- level programs to request operating system services. • The kernel system can only be accessed using system calls. • System calls are required for any programs that use resources. 6/11/2023 Department of CSE (AI/ML) 7
  • 8. How are system calls made? • When a computer software needs to access the operating system's kernel, it makes a system call. • The system call uses an API to expose the operating system's services to user programs. • It is the only method to access the kernel system. • All programs or processes that require resources for execution must use system calls, as they serve as an interface between the operating system and user programs. Below are some examples of how a system call varies from a user function. • A system call function may create and use kernel processes to execute the asynchronous processing. • A system call has greater authority than a standard subroutine. A system call with kernel-mode privilege executes in the kernel protection domain. • System calls are not permitted to use shared libraries or any symbols that are not present in the kernel protection domain. • The code and data for system calls are stored in global kernel memory. 6/11/2023 Department of CSE (AI/ML) 8
  • 9. Example of System Calls • System call sequence to copy the contents of one file to another file. 6/11/2023 Department of CSE (AI/ML) 9
  • 10. Example of Standard API 6/11/2023 Department of CSE (AI/ML) 10
  • 11. Why do you need system calls in Operating System? There are various situations where you must require system calls in the operating system. Following of the situations are as follows: • It is must require when a file system wants to create or delete a file. • Network connections require the system calls to sending and receiving data packets. • If you want to read or write a file, you need to system calls. • If you want to access hardware devices, including a printer, scanner, you need a system call. • System calls are used to create and manage new processes. 6/11/2023 Department of CSE (AI/ML) 11
  • 12. How System call works? • Typically, a number associated with each system call • System-call interface maintains a table indexed according to these numbers • The system call interface invokes the intended system call in OS kernel and returns status of the system call and any return values • The caller need know nothing about how the system call is implemented • Just needs to obey API and understand what OS will do as a result call • Most details of OS interface hidden from programmer by API • Managed by run-time support library (set of functions built into libraries included with compiler) 6/11/2023 Department of CSE (AI/ML) 12
  • 13. API – System Call – OS Relationship 6/11/2023 Department of CSE (AI/ML) 13
  • 14. System Call Parameter Passing • Often, more information is required than simply identity of desired system call • Exact type and amount of information vary according to OS and call • Three general methods used to pass parameters to the OS • Simplest: pass the 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 6/11/2023 Department of CSE (AI/ML) 14
  • 15. Parameter Passing via Table 6/11/2023 Department of CSE (AI/ML) 15
  • 16. Types of System Calls 6/11/2023 Department of CSE (AI/ML) 16
  • 17. Types of System Calls • Process control • create process, terminate process • end, abort • load, execute • get process attributes, set process attributes • wait for time • wait event, signal event • allocate and free memory • Dump memory if error • Debugger for determining bugs, single step execution • Locks for managing access to shared data between processes 6/11/2023 Department of CSE (AI/ML) 17
  • 18. Types of System Calls • File management • create file, delete file • open, close file • read, write, reposition • get and set file attributes • Device management • request device, release device • read, write, reposition • get device attributes, set device attributes • logically attach or detach devices • Protection • Control access to resources • Get and set permissions • Allow and deny user access 6/11/2023 Department of CSE (AI/ML) 18
  • 19. Types of System Calls (Cont.) • Information maintenance • get time or date, set time or date • get system data, set system data • get and set process, file, or device attributes • 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 6/11/2023 Department of CSE (AI/ML) 19
  • 20. Examples of Windows and Unix System Calls 6/11/2023 Department of CSE (AI/ML) 20
  • 21. Standard C Library Example • C program invoking printf() library call, which calls write() system call. 6/11/2023 Department of CSE (AI/ML) 21
  • 22. Example: MS-DOS 6/11/2023 Department of CSE (AI/ML) 22 • Single-tasking • Shell invoked when system booted • Simple method to run program • No process created • Single memory space • Loads program into memory, overwriting all but the kernel • Program exit -> shell reloaded
  • 23. System Programs • System programs provide a convenient environment for program development and execution. • They can be divided into: • File manipulation • Status information sometimes stored in a File modification • Programming language support • Program loading and execution • Communications • Background services • Application programs • Most users’ view of the operation system is defined by system programs, not the actual system calls 6/11/2023 Department of CSE (AI/ML) 23
  • 25. System Programs • Provide a convenient environment for program development and execution • Some of them are simply user interfaces to system calls; others are considerably more complex. • File management - Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories. • Status information • Some ask the system for info - date, time, amount of available memory, disk space, number of users. • Others provide detailed performance, logging, and debugging information • Typically, these programs format and print the output to the terminal or other output devices. • Some systems implement a registry - used to store and retrieve configuration information. 6/11/2023 Department of CSE (AI/ML) 25
  • 26. System Programs • File modification • Text editors to create and modify files • Special commands to search contents of files or perform transformations of the text • Programming-language support - Compilers, assemblers, debuggers and interpreters sometimes provided • Program loading and execution- Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language • Communications - Provide the mechanism for creating virtual connections among processes, users, and computer systems • Allow users to send messages to one another’s screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another. 6/11/2023 Department of CSE (AI/ML) 26
  • 27. System Programs • Background Services • Launch at boot time • Some for system startup, then terminate • Some from system boot to shutdown • Provide facilities like disk checking, process scheduling, error logging, printing • Run in user context not kernel context • Known as services, subsystems, daemons • Application programs • Don’t pertain to system • Run by users • Not typically considered part of OS • Launched by command line, mouse click, finger poke 6/11/2023 Department of CSE (AI/ML) 27
  • 28. Topics to be covered in next Lec 6 •Operating System Structure 6/11/2023 Department of CSE (AI/ML) 28 Thank you!!!