Chapter-1 Part 2
Chapter-1 Part 2
Services
Operating System Services
Operating systems provide an environment for
execution of programs and services to programs
and users
• User interface - Almost all operating systems
have a user interface: Command-Line (CLI),
Graphics User Interface (GUI), touch-screen.
• Program execution - The system must be able
to load a program into memory and to run that
program, end execution, either normally or
abnormally (indicating error)
Operating System Services
• I/O operations - A running program may
require I/O, which may involve a file or an I/O
device
• File-system manipulation - The file system
is of particular interest. Programs need to read
and write files and directories, create and
delete them, search them, list file Information
and perform permission management.
Operating System Services (Cont.)
Touchscreen devices
require new interfaces
• Actions and
selection based on
gestures
• Virtual keyboard for
text entry
Voice commands
System Calls
Programming interface to the services provided by
the OS
Generally written in C or C++, although some are
written in assembly for optimal performance.
Mostly accessed by programs via a high-level
Application Programming Interface (API).
Example of System Calls –File copy
Example of Standard API
• scanf() Function.
• Prototype:
• int scanf(const char *format, ...);
• The function returns the total number of
items successfully matched.
• fopen() function.
• Prototype:
• FILE *fopen(const char *filename, const
char *mode)
• This function returns a FILE pointer or NULL.
Invoking the open( ) system call
table lookup to
access specific
numbered
system calls
System Call Parameter Passing
Protection
• Control access to resources
• Get and set permissions
• Allow and deny user access
Examples of Windows and Unix System Calls
Example: Single tasking system (DOS)
File modification
• Text editors to create and modify files
• Special commands to search contents of
files.
Programming-language support
• Compilers, assemblers, debuggers and
interpreters.
System Services (Cont.)
Application programs
• Perform specific task for an end-user
• Run by users
• Are not part of OS
• Launched by command line, mouse click,
voice command.
Linkers and Loaders
Source code compiled into object files designed to
be loaded into any physical memory location –
relocatable object file
Linker combines these into single binary
executable file it also links library code.
Program resides on secondary storage as binary
executable.
Linkers and Loaders
Loader loads program into memory for execution.
Modern general purpose systems don’t link sharable
libraries into executables
• Rather, dynamically linked libraries (in
Windows, DLLs) are loaded (once) as needed
and shared by all applications.
Object and executable files have standard formats,
so operating system knows how to load and start
them.
The Role of the Linker and Loader
Why Applications are Operating System
Specific
Apps compiled on one system usually not
executable on other operating systems.
Each operating system provides its own unique
system calls
• Own file formats, etc.
Why Applications are Operating System
Specific
Apps can be developed for multi-operating system
• Written in interpreted language like Python,
Ruby, and interpreter available on multiple
operating systems
• App written in Java language can run on any OS
using appropriate JVM.
• Use standard language (like C), compile
separately on each operating system to run on
each OS.
Why Applications are Operating System
Specific
Application Binary Interface (ABI) defines how
different components of binary code can interface
with each other for a given operating system on a
given architecture or CPU.
Design and Implementation