Sie sind auf Seite 1von 13

Computer Science ICS-I Notes Chapter: 7

Operating System: -

Operating System is a set of programs or some


automatic procedures which helps a computer
application to run effectively.
It creates an environment which
enables us to use computer installation efficiently. Windows
is system software and the others are the application
software.

Software

System Application
(Dependency) (Little bid of Dependency)

Operating System’s point of view: -

Usage Functions
1) Single user – 1) Processor or Process
Windows XP Management
2) Multi user – Linux, 2) Memory Management
Windows 2000 3) File Management
Server. 4) I/O Management
3) Multitasking 5) User Management.
4) Batch Processing
5) Real Time.

1
Computer Science ICS-I Notes Chapter: 7

What is an Operating System? Describe and define it?


An O.S is a set of automatic or manual procedures or
programs which helps user to use or share a computer
sufficiently.
We can view O.S as a resource manager. A system has
many resources (Hardware & Software) that may be
required to solve a problem, CPU time, Memory space, File
storage space, I/O devices and so on. The O.S acts as a
manager of those resources and allocates them to specific
programs and users as necessary for tasks. Since there
may be many possible conflicting requests for resources.
The O.S must decide which requests are allocated
resources to operate the computer system efficiently and
fairly. It is a control program and the common functions of
controlling and allocating resources are then brought
together into a piece of software.
Why Operating System is called Resource Manager?

User

Application Programs, Text Editor, Database,


Spencer’s, Science City Mall, Local Application
Software. Markets etc.

O.S Government.

Hardware Garments, Foods etc.

2
Computer Science ICS-I Notes Chapter: 7

Goals of an Operating System: -

1) The primary goal of an O.S is convenience for the user.


O.S exists because are suppose to make it easier to
computer with them than without them.
2) The secondary goal is efficient operation of the
computer systems. This goal is particularly important for
large shared multi-user system.

Classification of Operating System: -

Simple batch processing system: -


A batch O.S normally
reads a stream of separate jobs each with its own control
that predefine what the job does. When the job is complete
its output is usually printed on a printer. The definitive feature
of a batch system is the lack of interaction between the user
and the job while job is prepared and submitted and at some
later time the output appears. The delay between job
submission and completion is called Turn Around Time may
result from the amount of computing needed or from delays
before the O.S start to process the job.
[N: B: Batch files extension - .bat]

Functions of An Operating System:

An O.S provides the environments within these programs


are executed. Internally O.S varies greatly in their make up
being organized along many different lines.
We can create system as large and complex as an
O.S only by partitioning it into smaller pieces. Each of these
pieces should be well defined portion of the system.
3
Computer Science ICS-I Notes Chapter: 7

1) Process Management: -
A program does nothing unless its
instructions are executed by a CPU. A process can be
thought of as a program in execution. Typically, a batch job is
a process, a time-shared user program is a process. A
system task such as schooling output to a printer is a
process.
A process needs sudden resources, including CPU time,
memory, files, I/O devices accomplish its task. These
resources are either given to this process when it is created
or allocated to it why it is running. In addition to the various
physical and logical resources that a process obtains when it
is created some initializing data may be passed along. The
process will be given as an improved the name of the file
and will execute the appropriate instruction and the system
to obtain the desired information and display it on the
terminal. A program is a passive entity search as the
contents of the file stored on the disc whereas process is an
active entity with a pointer called program counter that
indicates next instructions to execute. The CPU executes
one instruction of the process after another until the process
completes it is in a sequential fashion. The O.S is
responsible for the following activities in connection the
management of the process.

1) The creation and the deletion of both user and system


process.
2) The suspension and the resumption of the process.
3) The provision of mechanism for process
synchronization.

4
Computer Science ICS-I Notes Chapter: 7

4) The provision of mechanism for process


communication.
5) The provision of mechanism for deadlock handling.

2) Memory Management: -
Main memory is the central to the
operation of a modern Computer system. Main memory is a
large array of words of bytes. Each word of bytes has its own
address. Memory is a repository of quickly accessible data
share by the CPU and I/O devices. There are two kinds of
memory management performed by the O.S.

a) Primary or Main Memory Management


b) Secondary Storage Management

a) Primary or Main Memory Management: -

Main memory is also a


repository of quickly accessible data shared by CPU and I/O
devices. The CPU reads instructions from main memory
during instruction fetch cycle and both read and write data in
main memory during data fetch cycle. For the CPU to
process data from disc data must first be transferred from
main memory by CPU generated I/O calls and instruction
must be in memory For the CPU to execute them.
For a program to be executed it must be mapped to
absolute address and loaded into memory. As the program
executes it access program instructions and data from
memory by generating this absolute address. Eventually the
program terminates its memory space is declared available
and the next program can be loaded and executed. The O.S

5
Computer Science ICS-I Notes Chapter: 7

is responsible for following activities with memory


management.

1) Keep track of which part of memory are currently


being used and by whom.
2) Decide which process is to be loaded into memory
when memory space becomes available.
3) Allocate and reallocate memory space when
needed.

b) Secondary Memory Management: -

The main purpose of the computer is to execute program.


These programs with the data they access must be in main
memory during execution. Because main memory is too
small to accommodate all data and programs and its data
are loosed when power is loosed. A computer system must
provide secondary storage to back up main memory. Most
programs including compilers, assemblers, and editors are
stored and edit and user used this disc as the source and
destination of data. The O.S is responsible for the following
activities in connection with disc management.

1) Free space management


2) Storage allocation
3) Disc scheduling.

Categories Of An Operating System:

6
Computer Science ICS-I Notes Chapter: 7

Operating System can be classified with the following


categories based on resource management access.

1) Multiprogramming O.S: -
A single user can not in
general keep either CPU or the I/O devices busy at all time.
It increases CPU utilizing by organizing jobs. So that CPU
has always one job to execute. The idea is as follows.
The O.S keeps several jobs in memory
simultaneously there. These set of jobs is a subset of the job
kept in the job pool (Queue). Since the number of jobs that
can be kept in the job pool. The O.S keeps up a job and
execute the job may have to wait for tasks, such as I/O
operation etc. In a non-multiprogramming environment CPU
seats idle. In a multiprogramming environment it is always
busy with jobs.
2) Multiprocessor O.S: -
The multiprocessor O.S supports
more than one processor communication sharing the same
computer Bus, the Clock, Memory, I/O devices and in same
time. Multiprocessor system has three outputs -
a) Increase through book
b) Economy of scale
c) Increase reliability

a) Increase through book: -


By increasing the number of
processors more work can be done in less time. The speed
of ratio may vary but in a multiprocessor environment
multiple processor corporate on a task and share certain
amount of overhead incurred in keeping all the resources
working properly.
7
Computer Science ICS-I Notes Chapter: 7

b) Economy of scale: -
Multiple processor system can save more money
than multiple single processor system. Because they share
save same peripherals, power supply and memory also.
c) Increase reliability: -
If certain function can be distributed properly among
several processors then failing of one processor will not held
the system, only show it down which increased tremendous
work flow and reliability among the system.
3) Time sharing O.S: -
It is a logical extension of multiprogramming operating
system. The CPU executes multiple jobs by switching among
them but the switching so frequently that the user can
interact with each program while it is running.
It allows many users to share the computers each action or
command in a time-sharing O.S to be short because only a
little CPU time is given to a user. It uses CPU scheduling
and multiprogramming to provide each user with a small
portion of computer.
4) Real time O.S: -
It is used when the time constrains have been
placed on the operation of the processor of flow of data.
Thus, it is often used as a control device in a dedicated
application. It can be of two types-
Hard Real Time O.S - Which guarantees the critical task, be
completed on time.
Soft Real Time O.S – Where a critical real-time task gets
priority over other task and retains that priority until it
completes.
What Is Process?

8
Computer Science ICS-I Notes Chapter: 7

Informally a process is more than a program code. It is a


program in execution. It also includes the current activity as
represented by the program counter and the content of the
processors registers. A process generally also includes
process stack – containing temporary data and data section
containing global variable.
A program is a passive entity such as contents
of the file stored on a disc whereas process is an active
entity. If the program counter specifying next instruction to be
executed and a set of additional resources.
Stages of the process: -

State as a process executes it changes state. The state of a


process is defined in part by the current activity of the
process. Each process may be in one of the following states-

New – The process is being created.


Running – Instructions are being created.
Waiting – The process is waiting for some event to occur.
Ready – The process is waiting to reassign to a processor.
Terminated – The process has finished its execution.

New Ready Running Terminated

Waiting

Process Control Block (PCB): -

9
Computer Science ICS-I Notes Chapter: 7

Each Process in O.S is represented by a process control


block or sometimes calls task control block (TCB). It includes
many pieces of instructions into it including –
1) Process State – The state may be new, ready, running,
waiting and so on.
2) Program Counter – The counter indicates the address of
the next instruction to be executed for this process.
3) CPU Register – The registers vary in number and type. It
includes accumulator, index register, stack pointer, general
purpose registers etc. Along with the PC it allows the
process to be continued currently afterward.
4) CPU Scheduling Information – This information includes
a process priority, pointer to scheduling ques d other
scheduling parameters.
5) Memory Management Information – This information
may include value of the page register, segment tables
depending on the memory system used by the O.S.
6) Accounting Information – It includes the amount of CPU
and real time used.
7) I/O Status Information – It includes list of I/O devices
allocated to the process a list of open file etc.

Process
Pointer States
Process
Number
Program
Counter
Register
Memory
Limits
List Of Open
Files 10
Computer Science ICS-I Notes Chapter: 7

Diagram of PCB

Process Scheduling:

The process of multiprogramming is to have some process


running at all times to maximize CPU utilization. The
objective of timesharing is to switch among the processes so
frequently that user can interact with each program why it is
running.

How scheduling que is form?

Step 1 – As process enter the system they are put into a job
Que. This que consists of all processes in the system.
Step 2 – The process that are residing in main memory and
a ready waiting to execute are kept on a list are called
Ready Que. This que is generally store as Link List because
the header of the ready que will contain pointers to the first
and the last PCB in the list. Each PCB has a pointer field
that points to the next process in the ready Que.

How processes are being executed?

A new process is initially put into the job Que from where it is
shifted to ready Que when the process is ready. It waits in
the ready Que until it is selected or the execution and is
given the CPU. Once the process is allocated CPU it
executes and produces results.

Scheduler:-

11
Computer Science ICS-I Notes Chapter: 7

A process migrates between the various scheduling Ques


throughout its lifetime. The O.S must select for scheduling
purposes, processes from this Ques in some fashion. The
selection process is carried out by the appropriate scheduler.

Classification of schedulers:

In general schedulers are of two types –

1) Long term scheduler – Which select processes from the


job pool and loads them into memory
for execution.
2) Short term scheduler – Which selects from among the
processes that are ready Que execute and
allocates the CPU to one of them.

Operations of processes:-

1) Process creation: - A process may create several new


processes via ‘create process’ system call. The creating
process is called parent process whereas the new processes
are called child processes.
In general a process will need certain
resources (CPU, Memory, Files and I/O devices) to
accomplish its task. When a process is creates a sub-
process the sub process may be able to obtain its resources
from the O.S or it may be certain to a subset of the parent
process.

2) Process termination: - A process terminates when it


finishes executing its task statement and asked the O.S to
12
Computer Science ICS-I Notes Chapter: 7

delete it by using ‘Exit’ system call. At that point the process


may return data to its parent’s process. All of the resources
of the process including physical and virtual memory are
deallocated by the O.S.

Co-operating process: -

The Concurrent process executing in the O.S may be either


independent or as co-operating process.
A process is independent if it can’t affect or be
affected by other process executing in the system.
On the other hand, a process is co-operative if it
can affect or be affected by other process executing in the
process. There are several reasons for co-operation of
process.

1) Information sharing
2) Computation speed-up
3) Modularity
4) Convenience.

13

Das könnte Ihnen auch gefallen