TOPIC
TYPES OF OPERATING SYSTEM &CPU
SCHEDULING ALGORITHM
Name:-Aman patra
Subject:-Operating system
Roll;-16
Lecturer:-sudha madam
College:-Sr degree and pg college
WHAT IS AN OPERATINGSYSTEM

Aprogramthatactsasanintermediarybetweenau
serofacomputerandthecomputerhardware.
 AnoperatingSystemisacollectionofsystemprogramst
hattogethercontroltheoperationsofacomputer
system.
 Some examples of operating systems are UNIX,
Mach, MS-DOS, MS-Windows, Windows/NT,
Chicago, OS/2,MacOS, VMS, MVS, and VM
TYPES OF OPERATING SYSTEM
 MainframeSystems
 Reduce setup time by batching similar jobs Automatic job sequencing – automatically
transfers control from one job to another. First rudimentary
 operatingsystem.
 BatchProcessingOperatingSystem:
 This type of OS accepts more than one jobs and these jobs are batched/ grouped
together according to their similar requirements. This is done by computer operator.
Whenever the computer becomes available, the batched jobs are sent for execution
and gradually the output is sent back to the user.
 Itallowedonlyoneprogramatatime.
 MultiprogrammingOperatingSystem:
 This type of OS is used to execute more than one jobs simultaneously by a single
processor. it increases CPU utilization by organizing jobs so that the CPU always
has one job to execute.
 Theconceptofmultiprogrammingisdescribedasfollows:
 Allthe jobsthatenter the systemarestoredinthe job pool( indisc).The
operatingsystemloadsaset of jobs from job pool into main memory and begins to
execute.
TYPES OF OPERATING SYSTEM
 Time-Sharing/multitaskingOperatingSystems
 Timesharing(ormultitasking)OSisalogicalextensionofmultiprogram
ming.Itprovidesextrafacilitiessuch as:
 Fasterswitchingbetweenmultiplejobstomakeprocessingfaster.
 Allowsmultipleuserstosharecomputersystemsimultaneously.
 Theuserscaninteractwitheachjobwhileitisrunning.
 These systems use a concept of virtual memory for effective
utilization of memory space. Hence, in this OS, no jobs are
discarded. Each one is executed using virtual memory concept. It
uses CPU scheduling, memory management, disc management
and security management. Examples: CTSS, MULTICS, CAL,
UNIX etc.
 MultiprocessorOperatingSystems
 Multiprocessor operating systems are also known as parallel OS
or tightly coupled OS. Such operating systems have more than
one processor in close communication that sharing the computer
bus, the clock and sometimes memory and peripheral devices. It
executes multiple jobs at same time and makes the processing
faster.
TYPES OF OPERATING SYSTEM
 DistributedOperatingSystems
 Indistributedsystem,thedifferentmachinesareconnectedinanet
workandeachmachinehasitsown processor and own local
memory.
 In this system, the operating systems on all the machines
work together to manage the collective network resource.
 DesktopSystems/PersonalComputerSystems
 ThePCoperatingsystemisdesignedformaximizinguserconvenie
nceandresponsiveness.Thissystemis neither multi-user nor
multitasking.
 ThesesystemsincludePCsrunningMicrosoftWindowsandtheAp
pleMacintosh.TheMS-DOSoperating system from Microsoft
has been superseded by multiple flavors of Microsoft
Windows and IBM hasupgraded MS-DOS to the OS/2
multitasking system.
CPU SCHEDULING
 Selects from among the processes in memory that are ready to
execute, and allocates the CPU to one of them
 CPU scheduling decisions may take place when a process:
1. Switches from running to waiting state
2. Switches from running to ready state
3. Switches from waiting to ready
4. Terminates
FIRST-COME, FIRST SERVED
 ( FCFS) same as FIFO
 Simple, fair, but poor performance. Average queueing
time may be long.
 What are the average queueing and residence times
for this scenario?
 How do average queueing and residence times
depend on ordering of these processes in the queue
CPU SCHEDULING
5:
CPU-Scheduling
8
EXAMPLE DATA:
Process Arrival Service
Time Time
1 0 8
2 1 4
3 2 9
4 3 5
0 8 12 21 26
P1 P2 P3 P4
FCFS
Average wait = ( (8-0) + (12-1) + (21-2) + (26-3) )/4 = 61/4 = 15.25
Scheduling
Algorithms
Residence Time
at the CPU
CPU SCHEDULING
5:
CPU-Scheduling
9
PRIORITY BASED SCHEDULING:
 Assign each process a priority. Schedule highest priority first. All
processes within same priority are FCFS.
 Priority may be determined by user or by some default mechanism. The
system may determine the priority based on memory requirements, time
limits, or other resource usage.
 Starvation occurs if a low priority process never runs. Solution: build
aging into a variable priority.
 Delicate balance between giving favorable response for interactive jobs,
but not starving batch jobs.
Scheduling
Algorithms
ROUND ROBIN:
 Use a timer to cause an interrupt after a predetermined time. Preempts if task
exceeds it’s quantum.
 Train of events
Dispatch
Time slice occurs OR process suspends on event
Put process on some queue and dispatch next
 Use numbers in last example to find queueing and residence times. (Use quantum
= 4 sec.)
 Definitions:
 Context Switch Changing the processor from running one task (or process)
to another. Implies changing memory.
 Processor Sharing Use of a small quantum such that each process runs
frequently at speed 1/n.
 Reschedule latency How long it takes from when a process requests to
run, until it finally gets control of the CPU.
10
CPU SCHEDULING Scheduling
Algorithms
CPU SCHEDULING
5:
CPU-Scheduling
11
EXAMPLE DATA:
Process Arrival Service
Time Time
1 0 8
2 1 4
3 2 9
4 3 5
0 8 12 16 26
P2 P3 P4 P1
Round Robin, quantum = 4, no priority-based preemption
Average wait = ( (20-0) + (8-1) + (26-2) + (25-3) )/4 = 74/4 = 18.5
P1
4
P3 P4
20 24 25
P3
Scheduling
Algorithms
Note:
Example violates rules for
quantum size since most
processes don’t finish in
one quantum.
SHORTEST-JOB-FIRSTSCHEDULING

 A different approach to CPU scheduling is the shortest-
job-first (SJF) scheduling algorithm. This algorithm
associates with each process the length of the latter's
next CPU burst.When the CPU is available, it is
assigned to the process that has the smallest next CPU
burst. If two processes have the same length next CPU
burst, FCFS scheduling is used to break the tie. Note
that a more appropriate term would be the shortest next
CPU burst,becausetheschedulingis
donebyexaminingthelengthof thenextCPUburstof
aprocess,ratherthanits total length. We use the term SJF
because most people and textbooks refer to this type of
scheduling discipline as SJF.
THANKYOU

Aman 16 os sheduling algorithm methods.pptx

  • 1.
    TOPIC TYPES OF OPERATINGSYSTEM &CPU SCHEDULING ALGORITHM Name:-Aman patra Subject:-Operating system Roll;-16 Lecturer:-sudha madam College:-Sr degree and pg college
  • 2.
    WHAT IS ANOPERATINGSYSTEM  Aprogramthatactsasanintermediarybetweenau serofacomputerandthecomputerhardware.  AnoperatingSystemisacollectionofsystemprogramst hattogethercontroltheoperationsofacomputer system.  Some examples of operating systems are UNIX, Mach, MS-DOS, MS-Windows, Windows/NT, Chicago, OS/2,MacOS, VMS, MVS, and VM
  • 3.
    TYPES OF OPERATINGSYSTEM  MainframeSystems  Reduce setup time by batching similar jobs Automatic job sequencing – automatically transfers control from one job to another. First rudimentary  operatingsystem.  BatchProcessingOperatingSystem:  This type of OS accepts more than one jobs and these jobs are batched/ grouped together according to their similar requirements. This is done by computer operator. Whenever the computer becomes available, the batched jobs are sent for execution and gradually the output is sent back to the user.  Itallowedonlyoneprogramatatime.  MultiprogrammingOperatingSystem:  This type of OS is used to execute more than one jobs simultaneously by a single processor. it increases CPU utilization by organizing jobs so that the CPU always has one job to execute.  Theconceptofmultiprogrammingisdescribedasfollows:  Allthe jobsthatenter the systemarestoredinthe job pool( indisc).The operatingsystemloadsaset of jobs from job pool into main memory and begins to execute.
  • 4.
    TYPES OF OPERATINGSYSTEM  Time-Sharing/multitaskingOperatingSystems  Timesharing(ormultitasking)OSisalogicalextensionofmultiprogram ming.Itprovidesextrafacilitiessuch as:  Fasterswitchingbetweenmultiplejobstomakeprocessingfaster.  Allowsmultipleuserstosharecomputersystemsimultaneously.  Theuserscaninteractwitheachjobwhileitisrunning.  These systems use a concept of virtual memory for effective utilization of memory space. Hence, in this OS, no jobs are discarded. Each one is executed using virtual memory concept. It uses CPU scheduling, memory management, disc management and security management. Examples: CTSS, MULTICS, CAL, UNIX etc.  MultiprocessorOperatingSystems  Multiprocessor operating systems are also known as parallel OS or tightly coupled OS. Such operating systems have more than one processor in close communication that sharing the computer bus, the clock and sometimes memory and peripheral devices. It executes multiple jobs at same time and makes the processing faster.
  • 5.
    TYPES OF OPERATINGSYSTEM  DistributedOperatingSystems  Indistributedsystem,thedifferentmachinesareconnectedinanet workandeachmachinehasitsown processor and own local memory.  In this system, the operating systems on all the machines work together to manage the collective network resource.  DesktopSystems/PersonalComputerSystems  ThePCoperatingsystemisdesignedformaximizinguserconvenie nceandresponsiveness.Thissystemis neither multi-user nor multitasking.  ThesesystemsincludePCsrunningMicrosoftWindowsandtheAp pleMacintosh.TheMS-DOSoperating system from Microsoft has been superseded by multiple flavors of Microsoft Windows and IBM hasupgraded MS-DOS to the OS/2 multitasking system.
  • 6.
    CPU SCHEDULING  Selectsfrom among the processes in memory that are ready to execute, and allocates the CPU to one of them  CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state 2. Switches from running to ready state 3. Switches from waiting to ready 4. Terminates
  • 7.
    FIRST-COME, FIRST SERVED ( FCFS) same as FIFO  Simple, fair, but poor performance. Average queueing time may be long.  What are the average queueing and residence times for this scenario?  How do average queueing and residence times depend on ordering of these processes in the queue
  • 8.
    CPU SCHEDULING 5: CPU-Scheduling 8 EXAMPLE DATA: ProcessArrival Service Time Time 1 0 8 2 1 4 3 2 9 4 3 5 0 8 12 21 26 P1 P2 P3 P4 FCFS Average wait = ( (8-0) + (12-1) + (21-2) + (26-3) )/4 = 61/4 = 15.25 Scheduling Algorithms Residence Time at the CPU
  • 9.
    CPU SCHEDULING 5: CPU-Scheduling 9 PRIORITY BASEDSCHEDULING:  Assign each process a priority. Schedule highest priority first. All processes within same priority are FCFS.  Priority may be determined by user or by some default mechanism. The system may determine the priority based on memory requirements, time limits, or other resource usage.  Starvation occurs if a low priority process never runs. Solution: build aging into a variable priority.  Delicate balance between giving favorable response for interactive jobs, but not starving batch jobs. Scheduling Algorithms
  • 10.
    ROUND ROBIN:  Usea timer to cause an interrupt after a predetermined time. Preempts if task exceeds it’s quantum.  Train of events Dispatch Time slice occurs OR process suspends on event Put process on some queue and dispatch next  Use numbers in last example to find queueing and residence times. (Use quantum = 4 sec.)  Definitions:  Context Switch Changing the processor from running one task (or process) to another. Implies changing memory.  Processor Sharing Use of a small quantum such that each process runs frequently at speed 1/n.  Reschedule latency How long it takes from when a process requests to run, until it finally gets control of the CPU. 10 CPU SCHEDULING Scheduling Algorithms
  • 11.
    CPU SCHEDULING 5: CPU-Scheduling 11 EXAMPLE DATA: ProcessArrival Service Time Time 1 0 8 2 1 4 3 2 9 4 3 5 0 8 12 16 26 P2 P3 P4 P1 Round Robin, quantum = 4, no priority-based preemption Average wait = ( (20-0) + (8-1) + (26-2) + (25-3) )/4 = 74/4 = 18.5 P1 4 P3 P4 20 24 25 P3 Scheduling Algorithms Note: Example violates rules for quantum size since most processes don’t finish in one quantum.
  • 12.
    SHORTEST-JOB-FIRSTSCHEDULING   A differentapproach to CPU scheduling is the shortest- job-first (SJF) scheduling algorithm. This algorithm associates with each process the length of the latter's next CPU burst.When the CPU is available, it is assigned to the process that has the smallest next CPU burst. If two processes have the same length next CPU burst, FCFS scheduling is used to break the tie. Note that a more appropriate term would be the shortest next CPU burst,becausetheschedulingis donebyexaminingthelengthof thenextCPUburstof aprocess,ratherthanits total length. We use the term SJF because most people and textbooks refer to this type of scheduling discipline as SJF.
  • 13.