0% found this document useful (0 votes)
25 views

Chapter 16a-OS

The document discusses operating systems and key concepts related to them. It covers topics like multiprogramming, time-sharing systems, the main purposes of operating systems in managing computer resources and providing facilities for usage. It also discusses the three fundamental computer resources that operating systems manage - CPU, memory, and I/O systems. Additionally, it covers operating system modes, process scheduling algorithms, process states, interrupts, and virtual machines.

Uploaded by

sivanesshni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Chapter 16a-OS

The document discusses operating systems and key concepts related to them. It covers topics like multiprogramming, time-sharing systems, the main purposes of operating systems in managing computer resources and providing facilities for usage. It also discusses the three fundamental computer resources that operating systems manage - CPU, memory, and I/O systems. Additionally, it covers operating system modes, process scheduling algorithms, process states, interrupts, and virtual machines.

Uploaded by

sivanesshni
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

System Software

OPERATING SYSTEM
▪ An operating system can provide facilities to have
more than one program stored in memory.
▪ Only one program can access the CPU at any given
time, but others are ready when the opportunity arises.
This is described as multi-programming.
▪ Multiprogramming OS is an ability of an operating
system that executes more than one program using a
single processor machine.
▪ This is for single user system.
▪ System with many users(logged in simultaneously),
known as time-sharing system.
OPERATING SYSTEM
Main purpose of an operating system:
▪ Internal = manage the computer's resources provides an
atmosphere in which various programs and apps can do useful
work
▪ External = Facilities provided for system usage. (Chapter 5)
OPERATING SYSTEM
The three fundamental resources in a computer system are:
▪ CPU
▪ Memory
▪ I/O System
A CPU typically operates at GHz frequencies,
IO devices are slower.
CPU management is vital to ensure a good
utilization of CPU recourse(CPU not idle while waiting
I/O is taking place.
OPERATING SYSTEM
0.1s to transfer 1 byte

2x 10-8s to transfer 1 byte 2x 10-7s to transfer 1 byte


OPERATING SYSTEM
▪ The logical structure of the operating system
provides tow modes of operation.
▪ User mode is the one available for user and User Interface
application program.
▪ The Kernel mode/Privileged mode for computer
recourses. It has sole access to the part of memory
and certain system functions.
PROCESS SCHEDULING
In computer systems multiple processes may be waiting to be executed by the
processor and the processor needs to decided and how to schedule processing.
Process Priorities
▪ In most computer systems, processes have different priorities, depending on their
function within the system.

Process: a program in memory that has an associated process control block


Process Control Block(PCB): a complex data structure containing all data
relevant to the running of a process
Thread: part of a process being executed
PROCESS SCHEDULING
The objectives/purpose of scheduling:
1. Maximize the use of the whole computer system
2. Be fair to all the users
3. Provide a reasonable response time to all the users, whether they are on-line users
or a batch processing user
4. Prevent the system failing if it has become overloaded
5. Make sure that the system is consistent by always giving similar response times to
similar activities from day to day.
PROCESS SCHEDULING
The following criteria are considered in determining a schedule which will achieve the
objectives.
1. Priority. Give some jobs a greater priority than others when deciding which job should
be given access to the processor.
2. I/O or Processor Bound. If a processor bound job is given the main access to the
processor, it could prevent the I/O devices being serviced efficiently.
3. Type of job. Batch processing, on-line and real-time jobs all require different
response times.
4. Resource requirements. The amount of time needed to complete the job, the memory
required, I/O and processor time.
5. Resources used so far. The amount of processor time used so far, how much I/O
used so far.
6. Waiting time. The time the job has been waiting to use the system.
PROCESS SCHEDULING CALCULATIONS
Turnaround Time
▪ Turnaround time = Completion time – arrival time
▪ This is the duration between a process arriving and it terminating
Waiting Time
▪ Waiting time = Turnaround time – burst time
▪ This is how long a process waits idle before it is fully executed.
Average Waiting Time
▪ Average Waiting Time = Waiting time for all processes / Number of processes
▪ This is how long a process has to wait on average before it is fully processed.
PROCESS STATES
Processes can be in one of 3 states.
▪ Running - This is where the process is currently being executed by the processor

▪ Ready - This is where the process is loaded into memory, ready to be executed.

▪ Blocked - This is where the process is waiting for an event to occur before it is
processed.
INTERRUPTS
▪ An interrupt is a signal emitted by a device attached to a
computer or from a program within the computer. It requires the
operating system (OS) to stop and figure out what to do next.
▪ An interrupt temporarily stops or terminates a service or a
current process. Most I/O devices have a bus control line called
Interrupt Service Routine (ISR) for this purpose.
▪ An interrupt signal might be planned (i.e., specifically requested
by a program) or it may be unplanned (i.e., caused by an event
that may not be related to a program that's currently running on
the system).
▪ The OS kernel will invoke an interrupts-handling routine. It will decide the priority of the
interrupt. The current value stored in registers must be stored in the process control
block.
INTERRUPTS
Types of Interrupt
1. 1-I/O interrupt: Generated by an I/O
device that a job is complete or an error
has occurred. Example “Printer is out of
paper or printer is not connected.”
2. Time interrupt: Generated by an internal
clock indicating that the processor must
attend to time critical activities.
3. Hardware interrupt: For example, power
failure which indicated that the OS must
close down as safely as possible. The OS must see if an interrupt has occurred. If one
has occurred, the OS must service the interrupt in
4. Program interrupt: Generated due to an the case that it is more important than the task
error in a program such as violation of already being carried out. Interrupts are saved in a
memory use (trying to use part of the queue (FIFO) that holds the next interrupt that have
memory reserved by the OS for other use) to be dealt with.
or an attempt to execute an invalid
instruction (division by zero).
SCHEDULING ALGORITHMS
There are multiple scheduling algorithms that can be used, depending on the system.
These include:
• Round Robin
• First Come First Served
• Short Job First
• Shortest Remaining Time First
ROUND ROBIN SCHEDULING
▪ Each process is assigned an equal time
slot(aka quantum) for execution. P1
▪ Once the quantum time has been reached
the process is blocked and will have to
wait until the next time round to carry on
executing.
▪ If a process completes before it reaches, P4 P2
it's quantum limit then itself terminates the
processor moves onto the next process.

P3

1 2 3 4 1 2 3 4 1 2 3 4
ROUND ROBIN SCHEDULING
In round-robin scheduling the processor works on each process in a circular manner.
Each process is assigned an equal time-slice (aka quantum) for execution.
Once the time-slice has been used up the process is blocked and will have to wait until
the next time round to carry on executing. If a process completes before it reaches, it’s
quantum limit then itself terminates the processor moves onto the next process.
Advantages
• All processes are treated equally
• All processes are guaranteed to be processed eventually
Disadvantages
• Results in a high average waiting time
FIRST COME FIRST SERVED
SCHEDULING
Here jobs are executed in the order in which they arrived. All processes are guaranteed
to be processed, but results in high average waiting times.

1 2 3 4

Advantages
• All processes will be processed eventually.
Disadvantages
• Large processes will cause a bottleneck (Convoy Effect)
SHORTEST JOB FIRST SCHEDULING
Here the process with the shortest estimated burst time is executed first. As new
processes arrive their estimated burst is compared with the current process to see which
process is to be executed.

2 2 4 4 1 1 1 3 3 3 3 3

Advantages
• Can result in a lower average waiting time
Disadvantages
• Requires the ability to accurately estimate burst times
• Can result in priority inversion, depending on the system
SHORTEST REMAINING TIME FIRST
SCHEDULING
Here the job with the least amount of remaining burst time is processed first. If a new
job arrives with a shorter burst time than the job currently being executed, then the
current job is moved to the blocked queue and the new job is executed.
Useful in batch systems where smaller jobs need to be given priority.
▪ Advantages
• Can result in the lowest average waiting time
▪ Disadvantages
• A certain amount of processing time is required to calculate remaining burst times and
switch between tasks (context switching)
• The system must be able to accurately estimate burst times for each process,
therefore SRTF can only be used in certain systems.
▪ https://drive.google.com/drive/folders/16FLTFcTqskvQQiFeT3sTDPxm81GooTle
VIRTUAL MACHINE
▪ Virtual Machine is like fake computer system operating on your hardware. It partially
uses the hardware of the system (like CPU, RAM, disk space, etc.) but its space is
completely separated from your main system.
▪ These types of virtual machines gives complete system platform and gives the
execution of the complete virtual operating system.
▪ Just like virtual box, system virtual machine is providing an environment for an OS to
be installed completely. We can see in the next image that our hardware of Real
Machine is being distributed between two simulated operating systems by Virtual
machine monitor.
VIRTUAL MACHINE

You might also like