2. System services :- the OS provides the environment for the
execution of program. It provides users the services to execute
the programs in a convenient manner. The specific services
provided will different form one to another OS ,but there are
some common services of OS that we can identify .these OS
services are provided for the convenience of the programmer ,to
make the programming task easier.
4. Program execution :-The purpose of computer system is to allow
the users to execute programs in an efficient manner. The operating
system provides an environment where the user can conveniently run
these programs. The user doesn’t have to worry about
the memory allocation or de-allocation or any other thing because these
things are taken care by the operating system.
To run program , first loaded into the RAM and then to assign CPU time for
its execution.
other important tasks like allocation and de-allocation of memory, CPU
scheduling etc perform OS itself.
5. Input/Output operation :-Each program requires an input and after
processing the input submitted by user it produces output. The operating
system hides the user from all these details of underlying hardware for the
I/O. So the operating system makes the users convenient to run programs
by providing I/O functions. The I/O service cannot be provided by user-level
programs and it must be provided by the operating system.
6. File-system manipulation :-While working on the computer, generally a user is
required to manipulate various types of files like as opening a file, saving a file
and deleting a file from the storage disk. This is an important task that is also
performed by the operating system.
Thus operating system makes it easier for the user programs to accomplish their
task by providing the file system manipulation service. This service is performed
by the 'Secondary Storage Management' a part of the operating system.
Communications :-Operating system performs the communication among various
types of processes in the form of shared memory. In multitasking environment,
the processes need to communicate with each other and to exchange
their information. These processes are created under a hierarchical structure
where the main process is known as parent process and the sub processes are
known as child processes.
7. Error detection :-OS also deals with hardware problems. To avoid hardware
problems the OS constantly monitors the system for detecting the errors and
fixing these errors (if found). The main function of OS is to detect the errors
like bad sectors on hard disk, memory overflow and errors related to I/O
devices. After detecting the errors, OS takes an appropriate action for
consistent computing.
This service of error detection and error correction cannot be handled by
user programs because it involves monitoring the entire computing process.
These tasks are too critical to be handed over to the user programs.
8. Resource allocation :-In the multitasking environment, when multiple jobs are
running at a time, it is the responsibility of an OS to allocate the required
resources (like as CPU, main memory, tape drive or secondary storage etc.)
to each process for its better utilization. For this purpose various types of
algorithms are implemented such as process scheduling, CPU scheduling,
disk scheduling etc.
Protection :-If a computer system has multiple users and allows the
concurrent execution of multiple processes, then the various processes
must be protected from one another's activities.
9. System calls provide the interface b/w a process and OS .these calls are generally available
as assembly-language instructions .these are usually listen in the manuals used by
assembly-language programmers.
Some system may allow system calls to be made directly from a higher level language
program .they may generate a call to a special run-time routine that makes the system
call or the system call may be generated directly in-line.
C(Compiler) , Bliss(Basic Language for Implementation of System Software)
BCPL (Basic Combined Programming Language)
PERL(Practical Extraction and Reporting Language)
These language are defined to replace assembly language for system programming .some
Pascal also provide an ability to make system calls directly form a Pascal program to the
OS.
10. To understand system calls, first one needs to understand the difference between kernel
mode and user mode of a CPU.
System Call
When a program in user mode requires access to RAM or a hardware resource, it must ask
the kernel to provide access to that resource. This is done via something called a system
call.
When a program makes a system call, the mode is switched from user mode to kernel mode.
This is called a context switch.
Generally, system calls are made by the user level programs in the following situations:
A. Creating, opening, closing and deleting files in the file system.
B. Creating and managing new processes.
C. Creating a connection in the network, sending and receiving packets.
D. Requesting access to a hardware device, like a mouse or a printer.
E. system supports these two modes.
11. Kernel Mode
When CPU is in kernel mode, the code being executed can access any memory
address and any hardware resource.
• It is a very privileged and powerful mode.
• If a program crashes in kernel mode, the entire system will be halted.
User Mode
When CPU is in user mode, the programs don’t have access to memory and
hardware resources .
In user mode, if any program crashes, only that particular program is halted.
That means the system will be in a safe state even if
a program in user mode crashes .most
programs in an OS run in user mode.