0% found this document useful (0 votes)
31 views31 pages

3 CS ServicesandCall

The document discusses operating system services and system calls. It describes various services provided by operating systems like user interface, program execution, file system manipulation, I/O operations, communication, resource allocation, error detection, accounting, protection and security, command interpretation, and resource management. It also explains system calls and how they provide an interface to operating system services.

Uploaded by

hasnaatdon1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views31 pages

3 CS ServicesandCall

The document discusses operating system services and system calls. It describes various services provided by operating systems like user interface, program execution, file system manipulation, I/O operations, communication, resource allocation, error detection, accounting, protection and security, command interpretation, and resource management. It also explains system calls and how they provide an interface to operating system services.

Uploaded by

hasnaatdon1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Operating-System Services &

System Calls
System Services
Operating System Services
 An operating system executes
programs and makes the process of
solving them easier.
 It also makes the computer system
easier to use and helps the user use
the computer hardware efficiently.
 Apart from these, it also provides an
array of services both to the users and
the programs.
Services of Operating System

 The OS is the resource manager of a system.


 Thus, there are multiple services it provides in
order to have an efficient system that can utilize
these resources to the fullest.
 Following are the services provided by
operating systems:
1. User Interface
2. Program Execution
3. File System Manipulation
4. I/O Operations
Services of Operating System
5. Communication systems
6. Resource Allocation
7. Error Detection
8. Accounting
9. Protection and Security
10. Command Interpretation
11. Resource Manager
1. User Interface

 An interface is required to communicate with the


user.
 Then it can either be a Command Line Interface CLI
or a Graphical User Interface GUI.
Touchscreen Interfaces

 Touchscreen devices require new


interfaces
• Mouse not possible or not desired
• Actions and selection based on
gestures
• Virtual keyboard for text entry
 Voice commands
2. Program Execution
 The OS loads a program into memory and then
executes that program.
 It also makes sure that once started that program
can end its execution, either normally or
forcefully.
 The major steps during program management
are:
1. Loading a program into memory.
2. Executing the program.
3. Making sure the program completes its execution.
4. Providing a mechanism for:
1. Process synchronization.
2. Process communication.
3. Deadlock handling.
3. File System Manipulation
 A program is read and then written in the form of
directories and files.
 These files can be stored on the storage disk for the
long term.
 The OS allows the users to create and delete files,
duplicate these files, and search files and their
information or properties.
 It also does permission management for these files i.e.,
allowing or denying access to these files or directories
based on the file ownership.
4. I/O Operations

 I/O operations are required during the execution of


a program.
 To maintain efficiency and protection of the
program, users cannot directly govern the I/O
devices instead the OS allows to read or write
operations with any file using the I/O devices and
also allows access to any required I/O device when
required.
5. Communication systems

 Processes need to swap information among


themselves.
 These processes can be from the same computer
system or different computer systems as long as they
are connected through communication lines in a
network.
 This can be done with the help of OS support using
shared memory or message passing.
 The OS also manages routing, connection strategies,
and the problem of conflict and security.
6. Resource Allocation

 When multiple users or multiple jobs run on a


system concurrently, the resources need to be
allocated equally to all of them.
 CPU scheduling is used to allocate resources fairly
and for the better utilization of the CPU.
 These resources may include CPU cycles, main
memory storage, file storage, and I/O devices.
7. Error Detection

 Errors may occur in any of the resources like CPU,


I/O devices, or memory hardware.
 The OS keeps a lookout for such errors, corrects
errors when they occur, and makes sure that the
system works uninterruptedly.
8. Accounting

 This keeps a check of which resource is being used


by a user and for how long it is being used.
 This is usually done for statistical purposes.
9. Protection and Security

 This is to ensure the safety of the system.


 Thus, user authentication is required to access a
system.
 It is also necessary to protect a process from
another when multiple processes are running on a
system at the same time.
 The OS controls the access to the resources,
protects the I/O devices from invalid access, and
provides authentication through passwords.
10. Command Interpretation

 The OS understands and interprets commands


that are input by the user and displays the input
accordingly.
 Multiple command interpreters can be supported by
an OS.
11. Resource Manager

 The OS manages resources such as processor,


memory, I/O devices etc. efficiently.
 It allocates resources to processes and administers
running programs to ensure user satisfaction.
 It also decides the time at which a program should
run, the amount of memory allocated for execution,
where to save a file, and much more.
A View of Operating System Services
System Calls
System Calls

 Programming interface to the services provided by


the OS
 Typically written in a high-level language (C or C++)
 Mostly accessed by programs via a high-level
Application Programming Interface (API) rather
than direct system call use
 Three most common APIs are Win API for Windows,
and Java API for the Java virtual machine (JVM)
Example of System Calls

 System call sequence to copy the contents of one


file to another file
cp in.txt out.txt
Example of Standard API
System Call Implementation

 Typically, a number is 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)
API – System Call – OS Relationship
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
1. Simplest: pass the parameters in registers
1. In some cases, may be more parameters than registers
2. Parameters stored in a block, or table, in memory, and address
of block passed as a parameter in a register
1. This approach taken by Linux and Solaris
3. Parameters placed, or pushed, onto the stack by the program
and popped off the stack by the operating system
Note: Block and stack methods do not limit the number or
length of parameters being passed
Parameter Passing via Table
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
Types of System Calls (Cont.)

 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
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
Types of System Calls (Cont.)

 Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
Examples of Windows and Unix System Calls

You might also like