Operating System Concepts

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 16

CHAPTER TWO

Operating System Services

1
2.1 Type of Services
An operating system provides an
environment for the execution of programs.

1. Program Execution
2. Input/Output Operation
3. File System Manipulation
4. Error Detection
5. Resource Allocation
6. Accounting
2 7. Protection
1. Program Execution:
* User will want to execute programs.
*The system must be able to load a program
into memory and run it.
*The program must be able to end its
execution, either normally or abnormally.

2. Input/Output Operation:
A running program may require input and
output.
This I/O may involve a file or an I/O device. For
specific devices, special function may be
desired.
3
3. File System Manipulation:
The file system is of particular interest.
It should obvious that we will want to read
and write files.

4. Error Detection:
The O.S. constantly needs to be aware of
possible errors.
Errors may occur in the CPU and memory H/W,
I/O devices, or in user program.
For each type of error, the O.S. should take the
appropriate action to assure correct and
consistent computer.
4
5. Resource Allocation:
When there are multiple users of multiple jobs
running at the same time, resources must be
allocated to each of them.

6. Accounting:
We want to keep track of which users use how much
and what kinds of computer resources.
This record-keeping statistics are required to
improve computing services.

7. Protection:
The owners of information stored in multi-user
computer system may want to control it’s used to
be
5 reconciled fairly and scheduled reasonably.
2.2 The User View
O.S. Services are provided in many different ways.
Two basic methods of providing services are
system calls and system programs.
2.2.1 System calls
The more fundamental level of services is handled
through the use of system calls,
which provides the interface between a running
program and the O.S.
These calls are generally available as assembly
language instruction, and are usually listed in
manuals used by assembly language
programmers.
System calls can be grouped into three major
categories:
6
1. Process and job control ; end, abort, load,
execute, create process, submit job,
get process attributes, set process attributes,
terminate process, etc…

2. Device and file manipulation; ex., create,


delete, open, read, write, reposition, etc…

3. Information maintenance; time, date, set


process (file) attributes etc…

7
2.2.2 System Programs
Another aspect of modern system is its collection of
systems programs.
System program can be divided into:
1. File manipulation: These programs are; create,
delete, copy, rename, print, dump, list, and
generally manipulate files and directories.
2. Status information: some programs simply ask
the O.S. for the data, time, amount of available
memory or disk space, number of users, etc..
3. File modification: several text editors may be
available to create and modify the content of files
stored on disk or tape.
8
4. Programming language Support: compilers, assemblers
and interprets for common programming languages (such
as FORTRAN, COBOL, PASCAL, BASIC, C, C++, etc.) are
often provided with the operating system.
5. Program Loading and Execution: once a program is
assembled or compiled, it must be loaded into memory to
be executed.
The system may provide absolute loaders, reload able
loaders, linkage editions. Debugging systems are needed
for both high level and a machine language.
6. Application Programs: most O.S.’s come with programs
which are useful to solve some problems.
7.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
9
to another
2.3 The Operating System View
The view of an O.S. seen by the user is defined
mainly by the systems programs,
particularly the command interpreter.

Operating systems are event-driven programs.


If there are no jobs to execute, no I/O devices to
service and no users to response to, an O.S. will
sit quietly, waiting for something to happen.
Events are almost always signaled by the
occurrence of an interrupt or trap. Thus an O.S. is
interrupt-driven.

10
There are several different type of interrupt
may occur:
* A system call.
* An I/O device interrupts.
• A program error.

• For each type of interrupt, separate


segments of code in the operating system
determine what action should be taken.
11
2.3.1 System Calls
System calls to the operating system are
further classified according to the type of
call.
Each call has its own segment of code to
implement the desired action. Such as:
# Normal termination.
# Abnormal termination.
# Status requests.
# Resource requests.
# I/O requests.
12
2.3.2 I/O device interrupts
A major class of events which an operating system
must handle is the class of I/O interrupts.
Waiting for I/O completion may be accomplished in
one of two ways:
* A wait instruction that idles the CPU until the next
interrupt.
• A wait loop

One advantage of always waiting for I/O completion


is that at most one I/O request is outstanding at a
time.
An alternative is to star the I/O and immediately
return
13
control to the user program.
2.3.3 Program Errors
A third kind of interrupt involves certain type of
program errors (such as an: illegal instruction
an attempt to execute a privileged instruction
an illegal memory reference)
that cause hardware traps.
traps
The trap transfers control through the interrupt
vector to the operating system just like an
interrupt.
14
2.4 General Flow an O.S.
The following figure illustrates the general
flow of an O.S., clearly no real O.S.
will exactly match this structure.
Most Operating systems, however, will be
similar.
We can now identify certain common parts of
an operating system.
An operating system will have device drivers,
an interrupt handler, a set of system call
routines, and a command or control card
interpreter.
15
16

You might also like