You are on page 1of 7

Operating System

TOPIC OBJECTIVE:

No. Of Hours: 3HRS

At the end of the topic discussion the students should be able to:
1. Compute/Solve the Efficiency and Reliability of CPU.

--

CPU UTILIZATION
It determines how efficient and reliable a computer system. To determine the efficiency of the
CPU, it must be equal to 50%, the card reader must be equal to 25% and line printer must be equal to
25%. If the result of the computation will not meet the required percentage then, it is less efficient and
reliable.
FORMULAS:
CR Time

= number of cards
CR speed

LP Time

= number of lines
LP speed

CPU Time
= number of instruction * CPU speed
TOTAL Time = CPU Time + CR Time + LP Time
To get the efficiency used the following formula:
% Efficiency of Card Reader
% Efficiency of Line Printer
% Efficiency of CPU
_______________________

= (CR Time / Total Time) * 100


= (LP Time / Total Time) * 100
= (CPU Time / Total Time) * 100

100 %
Example:
Given the following characteristics:
1. % Eff. Of CR
= 48.78%
TT
= 0.41 sec
CPU Time
= 10 ms
No. of instructions = 10,000
Required:
a. CPU speed in s
b. CR Time

c. %Eff.of LP
d. % Eff. Of CPU

2. % Eff. Of CPU
TT
LP Speed

= 19.85%
= .001525 hr
= 30 lines / min

Required:
a. LP Time
a. CPU Time

b. CR Time
e. %Eff.of CR

Professor: MELJUN P. CORTES

e. %Eff. Of TT

c.. %Eff. Of LP

Operating System
SOLUTIONS TO PROBLEM GIVEN ABOVE:
1. a) CPU speed

= ___CPU Time__
no. of instruction

CPU speed

= 10 ms__________
10,000 instructions
10ms * 1 x 10-3 secs.
1 ms
10,000 instructions
= .01
10,000 seconds
= 1 x 10-6 sec
= 1s

b) CR Time

CR Time

= Total Time * %Eff.of CR


100
= .41 * 48.78
100
= .199 sec or .2sec

c) %Eff. Of LP = .2sec / .41sec * 100


= 48.78%
d) %Eff. Of CPU

= 100% - 48.78% + 48.78%


= 100% - 97.56%
= 2.44%

e) %Eff. Of TT= 100%

Professor: MELJUN P. CORTES

Operating System
III. PROCESS MANAGEMENT
PROCCES MANAGEMENT allows time sharing of CPU in allocating different processes to the
processor.
PCB is a data structure, which contains important information about certain process. It is also called a
task control block. The information or content of PCB are process state, program counter, CPU
Registers, CPU Scheduling information, Memory-management Information, Accounting Information
and I/O information.
ILLUSTRATION of PCB

Pointer
Process
State
Process number
Program Counter
Registers
Memory limits
List of Open Files

:
Process State. The state may: be new, ready, running, and waiting, halted and so on.
Program Counter. The counter indicates the address of the next instruction to be
executed for this process.
CPU Registers. The registers vary in number and type, depending on the computer
architecture. They include accumulators, index registers, stack pointers, and generalpurpose registers, plus any condition-code information. Along with the program counter,
this state information must be saved when an interrupt occurs, to allow the process to
be continued correctly afterward.
CPU Scheduling Information. This information includes a process priority, pointers to
scheduling queues, and any other scheduling parameters.
Memory-Management information. This information may include such information as
the value of the base and limit registers, the page tables or the segment tables
depending on the memory system used by the operating system.
Accounting information. This information includes the amount of CPU and real time
used, time limits, account numbers, job or process numbers and so on.
I/O status information. The information includes the list of I/O devices (such as tape
drives) allocated to this process, a list of open files, and so on.

PROCESS The designer of Multics system was the first who introduced the word or term process in
the mid 60s. Since that time, process used somewhat interchangeably with task or job, has been
given a lot of definitions. Some of these are:
A program in execution.
An asynchronous activity

Professor: MELJUN P. CORTES

Operating System

The animated spirit of a procedure in execution.


The locus of control of a procedure in execution.
That which is manifested by the existence of a process control block in the operating
system.
That entity to which processors are assigned.
The dispatch able unit.

A process is more than a program code (sometimes known as text section). It also includes the
current activity, as represented by the value of the program counter and the contents of the
processors registers. A process generally includes the process stack, containing temporary data such
as subroutines, parameters, return address, and temporary variables and data section containing
global variables.
A resource of Process includes CPU Time, memory, files, and I/O devices to complete the task.
These resources are either given to the process when it is created, or allocated to it while it is running.
PROCESS TRANSITION DIAGRAM

Run
Subm
it

Hold

Read
y

Compl
ete
Wait

A process goes through a series of discrete process states. Various events can cause a
process to change states.
Submit state, a state where a process is being submitted to the system and the system will
respond to the request.
Eventually, when a job is submitted to the system or CPU, a corresponding process is created
and normally inserted at the back of the ready list. The assignment of the CPU to the first process on
the ready list is called dispatching, and is performed by a system hardware called dispatcher.
Hold state, a state where a process is being transformed into a machine readable form.
Ready state a state where a process submitted is ready for execution, but there are more
processes running than the processor available.
To prevent any process from monopolizing the system, the operating system sets a hardware
interrupting clock or interval timer (idle) to allow particular user to run for a specific time interval called
quantum time. The interrupting clock generates an interrupt, causing the operating system to regain
control. The operating system then makes the previously running process ready, and makes the first
process on the ready list running.
A running state a currently procedure of processing takes place were from the ready list
provided that the English like language used by a specific users the operating system handles the
operation to transformed the English like language into a machine readable form. After a thorough
procedure of transformation of language and when it is successfully done it is immediately scheduled
to the processor for processing.
A process is said to be running if it is currently has the CPU. A process is said to be ready if it
is used a CPU if one were available. A process is said to be blocked if it is waiting for some event to
happen before it can proceed.

Professor: MELJUN P. CORTES

Operating System
A wait state was some of the processes are waiting for some event. Once, the CPU reset the
resource it means that it is ready to accept another process. Timer or interrupt clock queue the waiting
jobs to dispatcher or ready state to prepare for next execution.
Complete State the process is already finished and the resources used are reclaimed for the
next process in the queue.
Before a process will be submitted (next) to the system, TRAFFIC CONTROLLER will check
the Available resources. It will keep track the status of all hardware and software resources.
There are two types of scheduler in operating system that will manage the flow of the system.
SCHEDULER. A process migrates between the various scheduling queues throughout its lifetime. The
operating system must select, for scheduling purposes, processes from these queues in some
fashion. The selection process is carried out by the appropriate scheduler.
1. JOB SCHEDULER also known as Long Term Scheduler. It will select jobs being submitted to
the system and will put all the jobs selected in the physical memory of the system.
There are several criteria for job selection:
a. capacity of the job
b. priority of process
c. expected runtime
d. amount of input and output
e. special resources required
2. CPU SCHEDULER or also known as Short Term Scheduler. This scheduler will select process
in the memory and put it on time of the queue.
There are types of queue.
a. Ready Queue will hold processes that are ready to be dispatched or ready for
execution. The process that resides in main memory and are ready and waiting to
execute are kept on a list are called ready queue.
b. Device Queue will hold processes that are listed for a particular input output deices.
In CPU scheduler, there are different algorithms used for handling processes, which are
categorized into two:
1. Non Deterministic Scheduling Algorithms
2. Deterministic Scheduling Algorithms
Deterministic Scheduling Algorithms is an algorithm wherein all characteristics of a process
are known in advance or before execution. These characteristics are:
a. execution time (ti)
b. priority time (wi)
c. deadline time (di)
d. finishing time
There are three algorithms under this class.
1. Minimum Mean Response Time (MMRT) all processes are arranged according to increasing
execution time. Execution time is denoted as ti. In case of the same execution time, first come
first serve is supplied.
2. Minimum Weighted Response Time (MWRT) all processes are arranged according to
increasing execution time divided by the priority. Priority is denoted as wi.

Professor: MELJUN P. CORTES

Operating System
3. Maximum/Minimum Lateness (MML) all processes are arranged according to increasing
deadlines. Deadline time is denoted as di. In case of the same deadlines, the process having
the lower or smallest execution time will be loaded first.
Example: Considering the following execution time, deadline and priority time. Schedule the given
process and arranged them according to MMRT, MWRT and MML algorithm.
PROCESS
P1
P2
P3

Execution Time
10 ms
5ms
15 ms

Priority Time
2
1
3

Deadline Time
12
6
16

SOLUTION:
MMRT ti

CPU

P2
5 ms

P1

P3

10 ms

15 ms

MWRT ti / wi
P1 10 / 2 = 5
P2 5 / 5 = 1
P3 15 / 3 = 5

CPU

P2
1ms

P1
5 ms

P3
5 ms

MML di

CPU

P2
6 ms

P1
12 ms

P3
16 ms

EXERCISES:
Schedule the following jobs using MMRT, MWRT and MML where:
A = 5, B= 3 C = 2.
PROCESS
J
U
L
Y

Execution Time
A*A
AB*2
B * A/ 3
A*C

Professor: MELJUN P. CORTES

Priority Time
C*C
BC
A*C
B*3

Deadline Time
A*BC
C*2
A*A
A-B

Operating System

Professor: MELJUN P. CORTES