Operating System Structure

jaspersugarlandSoftware and s/w Development

Dec 14, 2013 (3 years and 5 months ago)

92 views

Operating System
-
Introduction


An
Operating System
is system software which may be viewed as an organized collection of software consisting of
procedures for operating a computer and providing an environment for execution of programs. It acts as an
interface
between users and the hardware of a computer system.

System Calls



The interface between the OS and the user program is defined by a set of instructions called
System calls.

The Shell



It is the primary interface between a user sitting at his termi
nal and the OS.


Operating System Structure

Ms
-
Dos Structure, Layered Approach, Virtual Machine, Monolithic System, Client
-
Server System

Process



a program in execution; process execution must progress in sequential fashion.

Process Control Block:

Information associated with each process.

Process state

Program counter

CPU registers

CPU scheduling information

Memory
-
management information

Accounting information

I/O status information


Scheduler:

Long
-
term scheduler (or job scheduler)


selects which
processes should be brought into the ready queue.

Short
-
term scheduler (or CPU scheduler)


selects which process should be executed next and allocates
CPU.

Co
-
Operating Processes:

Independent

process cannot affect or be affected by the execution of anothe
r process.

Cooperating

process can affect or be affected by the execution of another process

Inter
-
process Communication:

Mechanism for processes to communicate and to synchronize their actions.

Buffering:

Queue of messages attached to the link; implemente
d in one of three ways.

1.

Zero capacity


0 messages Sender must wait for receiver (rendezvous).

2.

Bounded capacity


finite length of
n

messages Sender must wait if link full.

3.

Unbounded capacity


infinite length Sender never waits.

Exception
Conditions:

1.

Process terminates

Receiver waiting for a message from terminated sender

Notify or terminate receiver

Sending to a terminated receiver

Delete message

Notify sender?

2.

Lost messages

Detect with timeouts
-

expect an ack within some time

Resend
(duplicates)

3.

Scrambled messages

Error checking codes

Process Scheduling:

Maximum CPU utilization obtained with multiprogramming

CPU

I/O Burst Cycle


Process execution consists of a
cycle

of CPU execution and I/O wait.

CPU burst distribution

Scheduling Cri
teria

• CPU utilization


keep the CPU as busy as possible

• Throughput


# of processes that complete their execution per time unit

• Turnaround time


amount of time to execute a particular process

• Waiting time


amount of time a process has been waiti
ng in the ready queue

• Response time


amount of time it takes from when a request was submitted until the first response is
produced,
not
output (for time
-
sharing environment)

There are various scheduling Algorithms like: FCFS, SJF, RR, PRIORITY
SCHEDULING

File System


File:

Collection of similar records and is referenced by name. They have unique file names. Restrictions on access
control usually apply at the file level. But in some systems, such controls are enforced at the record or even at the

field level also.


Memory Management

Main memory is a large array of words or bytes. Each word or byte has its own address. For a program to be
executed, it must be mapped to absolute addresses and loaded into memory. The operating system is responsible f
or
the following activities in connection with memory management.




Keep track of which parts of memory are currently being used and by whom.



Decide which processes are to be loaded into memory when memory space becomes available.



Allocate and deallocate em
ory space as needed.


Logical Vs Physical address space



An address generated by the CPU is commonly referred to as a logical address, whereas an address as seen
by the memory unit (that is, the one loaded into the memory address register

MAR of the memory
) is
commonly referred to as a physical address.


Swapping

Swapping is the act of moving processes between memory and a backing store. This is done to free up available
memory. Swapping is necessary when there are more processes than available memory. At
the coarsest level,
swapping is done a process at a time. That is, an entire process is swapped in/out.

Paging

Physical memory is broken into fixed sized blocks called frames. Logical memory is broken into blocks of the same
size called pages.


Segmentatio
n

In paging, the user’s view is not the same as the actual physical memory. The user’s view is mapped onto physical
memory. The user prefers to view memory as a collection of variable
-
sized segments, with no memory ordering
among segments.

Virtual Memory

V
irtual memory is a technique that allows the execution of a program that may not be completely in memory.


Deadlock


A
deadlock

is a situation where in two or more competing actions are each waiting for the other to finish, and thus
neither ever does.


Necessary conditions

There are four necessary conditions for a deadlock to occur,

1.

Mutual Exclusion: a resource that cannot be used by more than one process at a time

2.

Hold and Wait: processes already holding resources may request new resources held by othe
r processes

3.

No Pre
-
emption: No resource can be forcibly removed from a process holding it, resources can be released
only by the explicit action of the process.

4.

Circular Wait: two or more processes form a circular chain where each process waits for a resource that the
next process in the chain holds. When circular waiting is triggered by mutual exclusion operations it is
sometimes called
lock inversion
.


Protectio
n & Security

Goal of Protection

Operating system consists of a collection of objects, hardware or software Each object has a unique name
and can be accessed through a well
-
defined set of operations

Protection problem
-

ensure that each object is accessed correctly and only by those processes that are
allowed to do so

Domain of Protection

Access
-
right=<
object
-
name
,
rights
-
set
>

where
rights
-
set

is a subset of all valid operations that can be performed on the object.

Doma
in = set of access
-
rights



One
-
time passwords



Each password is valid only once. Hence anyone capturing the password of a session and then trying to use it for
another session will fail.



Problem:

where to keep the password list



A solution:

use one
-
way functions

Program Threats

Trojan Horse

Code segment that misuses its environment

Exploits mechanisms for allowing programs written by users to be executed by other users

Spyware, pop
-
up browser windows, covert channels

Trap Door

Specific user
identifier or password that circumvents normal security procedures

Could be included in a compiler

Logic Bomb

Program that initiates a security incident under certain circumstances

Stack
and
Buffer Overflow

Exploits a bug in a program (overflow either the
stack or memory buffers)


System Threats
-

Worms


use spawn mechanism; standalone program

• Internet worm



Exploited UNIX networking features (remote access) and

bugs in
finger
and
sendmail
programs.



Grappling hook program uploaded main worm program.


Viruses


fragment of code embedded in a legitimate program.



Mainly effect microcomputer systems.



Downloading viral programs from public bulletin boards or

exchanging floppy disks containing an infection.