Académique Documents
Professionnel Documents
Culture Documents
Definition:
An Operating system is software that manages the computer hardware.
It acts as an intermediatery between user and computer hardware.
It provides an environment in which a user can execute programs in a
convenient and efficient manner.
It is a monitoring program.
It is a resource allocator.
1. Hardware: Provides basic computing resources for the system. Like CPU, Memory, I/O
Devices.
2. System and Application Programs: Defines the ways in which the resources are used to
solve user’s computing problem.
1. User Interface: Allows interacting with system. The various user interfaces are
a. Command Line Interface: Uses text commands and a method for entering them.
Uses Command prompt. eg: shell (UNIX), DOS.
b. Batch Interface: All the commands and directives are entered into files and the
file is executed.eg: shell script in UNIX/LINUX
c. Graphical User Interface: The interface is a window system with a pointing
device to direct I/O, choose from menus, and make selections and a keyboard to
enter text. Eg: Windows, Apple Mac OS X, UNIX and Linux have CLI with
optional GUI interfaces.
2. Program Execution:
a. The system must be able to load program into memory and to run that
program.
b. The program must end its execution either normally or abnormally (Indicating
error).
3. I/O Operations: A running program may require I/O, for efficiency and protection;
users usually cannot control I/O devices directly. Hence Operating system has to
perform I/O.
4. File System Manipulation: For files
a. Files can be created, deleted, searched by name
b. File permissions to allow or deny access to file or directory based on ownership.
c. Programs need to read and write files and directories.
d. Organizing file system structure
All these services must be provided by Operating System.
5. Communications:
a. One process needs to exchange information with another process.
b. Process communication occurs between two processes that are executing on
same computer or different computers in a network.
c. Operating system provides process communication by using pipes, shared
memory and message passing.
6. Error Detection: Operating system needs to be constantly aware of possible errors and
it has to take appropriate action to ensure correct and consistent computing. The
errors may occur in
a. CPU , Memory (Power failure, Timer error , Memory Insufficient)
b. I/O Devices (Parity errors, Printer Errors, Connection failure in network).
c. User Program (Arithmetic Overflow , Illegal memory access , use of more CPU
time)
The services those are helpful to for efficient operation of the system can be
2. Accounting: The operating system has to record and keep track of which users how
much and what kind of resources.
This information is for
a) Accounting (Billing)
b) Using statistics the researchers can reconfigure system to improve
computing services.
Example to writing a simple program to read data from one files and copy them to another
file.
The system call sequence to copy the contents of one file to another
To write, accept, open, create, abort, read, close and terminate on file operations require
system calls provided by the operating system in the form of API.
The run-time support system (a set of functions built into libraries included with a compiler)
for most programming languages provides a system-call interface that serves as the link to
system calls made available by the operating system.
1. The system call interface takes the function and invokes the necessary system call
within the operating system.
2. A number is associated with each system call; the interface maintains a table indexed
according to these numbers.
3. After invoking the system call, returns the status of system call and any return values.
The callers need not to know anything about how the system call is implemented. Just needs
to obey API and understand what OS will do as a result call.
1. File management: These programs create, delete, copy, rename, print, dump, list, and
generally manipulate files and directories.
2. 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
3. File modification:
Text editors to create and modify files
Special commands to search contents of files or perform transformations of the
text
7. Application Programs: Operating system provides programs like web browsers, word
processors, text formatters, database systems, compilers, games and statistical
packages.
Operating System Operations
Most of the operating systems are Interrupt Driven. An operating system performs any service
with an event. Events are signaled by an interrupt or trap(exception).
For each type of interrupt, separate segment of code (Interrupt Service Routine-ISR) in the
operating system determine what action is taken.
Since the operating system and users share the hardware and software resources of the
computer, Operating system must ensure that an incorrect program cannot cause other
programs to execute incorrectly.
Main Memory
User Area
User Programs - User
Computer systems provide hardware support that allows us to differentiate among various
modes of execution.
1. User Mode / Non- Privileged Mode: The computer system is operated on behalf of a
user application .i.e .Executes user program.
2. System/Priviliged/supervisory/Kernel Mode: The computer system executed operating
system programs to obtain the system services.
When a user program requires the service of an operating system, the CPU switch from user to
kernel mode.
A mode bit is added to the hardware of the computer to indicate the current mode.
With mode bit we can distinguish between a tasks is executed on behalf of operating system
or user.
The dual mode operation provides, protecting operating system from errant users by keeping
all user services is stored in OS area. So that only privileged instructions can allow to execute
OS program.
The instruction to switch from user mode to kernel mode is a privileged instruction
The user obtains the services of the system by means of system calls. When a system call is
executed it is treated by CPU as Software Interrupt. It causes to switch from user mode to
system mode or vice versa.
1. Initially Control resides in Operating System, Where instructions are executed in Kernel
Mode.
2. When control is given to the user application based on interrupt, the mode is set to
user mode.
3. Eventually, control is switched back to the operating system via a trap, interrupt or a
system call.
Most of the operating systems Windows, UNIX, LINUX, and Solaris use Dual-Mode operation
to protect the system.
2. Timer:
A timer can be set to interrupt the computer after a specified period of time.
The period may be fixed or variable, set by operating system.
A privileged instruction can only modify the content of timer.
Before running the control to user, the Operating system ensures that the timer is set
to interrupt. If the timer interrupts, control transfers automatically to operating
system. The Operating system then decides to give more time or treat as a fatal error.
A simple method is to initialize counter with an amount of time that the program is
allowed to run. As long as the counter is positive, the control is with user program.
When the counter becomes negative, Operating system terminates the program.
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner