SlideShare a Scribd company logo
1 of 71
Download to read offline
Operating System
CSI-503
Lecture # 2
Processor Management
Processor Management
• If you were assembling some IKEA furniture, and following the step-
by-step guide of 20 steps.
• Imagine you did step 1, then step 2, then step 3, suddenly the
doorbell rang, and you are interrupted.
Processor Management
• You would stop what you are doing and deal with whoever is at the
door.
• Then you would return to the assembly, check what step you were
on, and then continue on from there (step 4).
Processor Management
• This is how the computer runs multiple processes simultaneously …
you do a few steps on one process, get interrupted, work on other
processes, then return to the first process, remembering where you
left off from, and continue on.
• This swapping of processes is called a pre- emptive scheduling policy.
Processor Management
• A “Process” is the basic unit of execution in the operating system
• A “Process” is the name we give to a program when it is running in
memory
• So a “Program” is the complied executable
• And a “Process” is the running executable with the execution state.
Processor Management
• The same program being run by two different users in the operating
system are two different processes
Processor Management
• The Processor Manager is made up of two sub-managers:
Processor Management
Job Scheduler
• We describe a collection of processes as a “job”.
• When the operating systems is presented with a queue of jobs or
processes to run, the Job Scheduler has the task of deciding which
order to run the are jobs in.
• The Job Scheduler wants to ensure that the all components of the
operating system are busy, and there is no component that is idle.
Job Scheduler
• Let’s think about this program:
PROGRAM Print Value:
BEGIN
Input A;
Input B; C = A + B; D = A – B;
Print “The sum of inputs is: “, C;
Print “The Difference of inputs is: “, D; END.
Job Scheduler
• Let’s think about this program:
PROGRAM Print Value:
BEGIN
C = A + B; D = A – B; Print “The sum of inputs is: “, C; Print “The Difference of
inputs is: “, D; END. Reading from keyboard
Input A; I/O
Input B;
Job Scheduler
• Let’s think about this program:
• PROGRAM Print Value:
BEGIN
Input A; Input B;
C = A + B; D = A – B;
Print “The sum of inputs is: “, C;
Print “The Difference of inputs is: “, D; END.
Input A; I/O
Input B;
Reading From
keyboard
Job Scheduler
Job Scheduler
• Let’s think about this program:
PROGRAM Print Value:
BEGIN
Job Scheduler
Job Scheduler
Job Scheduler
• Some programs do a lot of I/O, e.g. Graphics programs:
Job Scheduler
• Others do a lot of computation, but little I/O, e.g. math's programs:
Job Scheduler
• If the job scheduler gets jobs like this:
Job Scheduler
• If the job scheduler gets jobs like this:
Job Scheduler
• So the job scheduler will take these jobs:
Job Scheduler
• And swap them around, and pass them onto the Process Scheduler
Job Scheduler
• So in this case the Job Scheduler wants to balance the jobs coming in,
so that the components of the operating system are all kept busy.
• If we don’t change the order of job, the CPU will be very busy, but
the I/O component will be idle, and then vice versa.
• This is not an optimal use of resources, so we swap them around.
Job Scheduler
• We'll call jobs that are CPU-bound Batch Jobs, and we’ll call jobs that
have a lot of I/O operations Interactive Jobs.
Job Scheduler
• This is the first level of swapping of processes that will occur, and
more will be done by the Process Scheduler. The Job Scheduler is
looking at jobs (or groups of processes), and looking at the whole
process from a high-level.
• For obvious reasons, the Job Scheduler is also called the High-Level
Scheduler.
Job Scheduler
• Every process has a field that records their current status, called the
Process Status.
• When the process is first passed to the Job Scheduler from the
operating system, its status is always set as HOLD.
• When the Job Scheduler passes the process onto the Process
Scheduler, its status is always changed to READY.
Processor Management
Processor Management
• Other statuses that a process can have are:
Process Scheduler
Process Scheduler
Process Scheduler
• Think about traffic lights:
Process Scheduler
• This is the sequence:
Process Scheduler
• As mentioned previously the process is first passed to the Job
Scheduler from the operating system, its status is always set as HOLD.
When the Job Scheduler passes the process onto the Process
Scheduler, its status is always changed to READY.
Process Scheduler
• When the CPU is available, the Process Scheduler will look at all of
the upcoming processes and will select one of them (based on a
predefined algorithm) and assuming there is memory free, the
process will start running and its status is changed to RUNNING by
the Process Scheduler.
Process Scheduler
• After a predefined time, the process will be interrupted, and another
process will take over the CPU, and the interrupted process will have
its status changed to READY by the Process Scheduler. We will
remember that this swapping of processes is called a pre- emptive
scheduling policy.
• When is CPU is available for this process again the process status be
changed to RUNNING by the Process Scheduler.
Process Scheduler
Process Scheduler
• If the process has to wait for some I/O from the user or some other
event, it is put in a status of WAITING by the Process Scheduler
• When the I/O device lets the Process Scheduler know that the I/O is
completed, the process status will be changed to READY by the
Process Scheduler.
Process Scheduler
• Finally the process status will be changed to FINISHED either when
the process has successful completed, or if an error occurs and the
process has to terminate prematurely. The status change is usually
handled by the Process Scheduler informing the Job Scheduler of the
process completion, and the Job Scheduler of changing the status.
Process Management
Process Control Block (PCB)
• The Process status is only one of a collection of descriptors that are
associated with a process.
• Each process has a data structure called a Process Control Block (PCB)
associated with it, rather like a passport.
Process Control Block ( PCB)
Process Control Block (PCB)
Process Control Block (PCB)
• PROCESS IDENTIFIER
• Each process is uniquely identified by both the user’s identification, and a
pointer connecting it to its descriptor.
Process Control Block (PCB)
• PROCESS STATUS
• The current status of the process, it is either:
Process Control Block (PCB)
• PROCESS STATE
• Program counter
• Record the current value of the program counter
Process Control Block (PCB)
• PROCESS STATE
• Register Contents
• Record the values of the data registers
Process Control Block (PCB)
• PROCESS STATE
• Main Memory
• Record all important information from memory, including most importantly
the process location.
Process Control Block (PCB)
• PROCESS STATE
• Resources
• Record the resources that have been allocated to this job, including files, disk
drives, and printers.
Process Control Block (PCB)
• PROCESS STATE
• Process Priority
• The process is assigned a priority, and if the operating system using priorities
to schedule processes.
Process Control Block (PCB)
• PROCESS STATE
• Process Priority
• The process is assigned a priority, and if the operating system using priorities
to schedule processes.
Process Control Block (PCB)
• PROCESS STATE
• Process Priority
• The process is assigned a priority, and if the operating system using priorities
to schedule processes.
Process Control Block (PCB)
• ACCOUNTING
• This section records some of the performance statistics associated
with this process, including:
• CPU time used so far
• Time process has been in the system
• Time taken in memory (Main and secondary)
• Space taken in memory (Main and secondary)
• System programs used, compliers, editors, etc.
• Number and type of I/O operations
• Time spent waiting for I/O operations completion
• Number of Input records read and Output records written
Process Control Block (PCB)
Process Control Block (PCB)
Process Scheduling Policies
Process Scheduling Policies
• What are good policies to schedule processes?
Process Scheduling Policies
• MAXIMUM THROUGHPUT
• Get as many jobs done as quickly as possible.
• There are several ways to achieve this, e.g. run only short jobs, run
jobs without interruptions.
Process Scheduling Policies
• MINIMIZE RESPONSE TIME
• Ensure that interactive requests are dealt with as quickly as possible.
• This could be achieved by scheduling just with a lot of I/O jobs first,
and leave the computational jobs for later.
Process Scheduling Policies
• MINIMIZE TURNAROUND TIME
• Ensure that jobs are completed as quickly as possible.
• This could be achieved by scheduling just with a lot of computation
jobs first, and leave the I/O jobs for later, so there is no user delays.
Process Scheduling Policies
• MINIMIZE WAITING TIME
• Move jobs out of the READY status as soon as possible.
• This could be achieved by reduce the number of users allowed on the
system, so that the CPU would be available whenever a job enters the
READY status.
Process Scheduling Policies
• MINIMIZE WAITING TIME
• Move jobs out of the READY status as soon as possible.
• This could be achieved by reduce the number of users allowed on the
system, so that the CPU would be available whenever a job enters the
READY status.
Process Scheduling Policies
• MAXIMISE CPU EFFICIENCY
• Keep the CPU busy 100% of the time.
• This could be achieved by scheduling just with a lot of computation
jobs, and never run the I/O jobs.
Process Scheduling Policies
• ENSURE FAIRNESS FOR ALL JOBS
• Give everyone an equal amount of CPU time and I/O time.
• This could be achieved by giving all jobs equal priority, regardless of
it’s characteristics.
Processor Scheduling
Algorithm
Process Scheduling Algorithms
• Here are six commonly used process scheduling algorithms
Process Scheduling Algorithms
• First Come, First Served (FCFS)
• A very simple algorithm that uses a FIFO structure.
• Implemented as a non-pre-emptive scheduling algorithm.
• Works well for Batch Processes, where users don’t expect any
interaction.
Process Scheduling Algorithms
• Shortest Job Next (SJN)
• Also called Shortest Job First (SJF)
• A very simple algorithm that schedules processes based on CPU cycle
time.
• Implemented as a non-pre-emptive scheduling algorithm.
• Works well for Batch Processes, where it is easy to estimate CPU
time.
Process Scheduling Algorithms
• Priority Scheduling
• An algorithm that schedules processes based on priority.
• Implemented as a non-pre-emptive scheduling algorithm.
• One of the most common algorithms used in systems that are mainly
Batch Processes.
• If two jobs come in of equal priority are READY, if works on a FIRST
COME, FIRST SERVED basis.
Process Scheduling Algorithms
• Shortest Remaining Time (SRT)
• A pre-emptive scheduling version of the Shortest Job Next (SJN)
algorithm.
• An algorithm that schedules processes based on the one which is
nearest to completion.
• It can only be implemented on systems that are only Batch Processes,
since you have to know the CPU time required to complete each job.
Process Scheduling Algorithms
• Round Robin
• A pre-emptive scheduling algorithm that is used extensively in
interactive systems
• All active processes are given a pre- determined slice of time (“time
quantum”).
• Choosing the time quantum is the key decision, for interactive
systems the quantum must be small, whereas for batch systems it can
be longer.
Process Scheduling Algorithms
• Multi-Level Queues
• This isn’t really a separate scheduling algorithm, it can be used with
others.
• Jobs are grouped together based on common characteristics.
• For example, CPU-bound jobs based in one queue, and the I/O-bound
jobs in another queue, and the process scheduler can select jobs from
each queue based on balancing the load.

More Related Content

What's hot

Process in operating system
Process in operating systemProcess in operating system
Process in operating systemChetan Mahawar
 
Lecture5
Lecture5Lecture5
Lecture5Ali Shah
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process managementArnav Chowdhury
 
Process concept
Process conceptProcess concept
Process conceptjangezkhan
 
Operating System
Operating SystemOperating System
Operating SystemGowriLatha1
 
Processes Control Block (Operating System)
Processes Control Block (Operating System)Processes Control Block (Operating System)
Processes Control Block (Operating System)Imdad Ullah
 
Processes and operating systems
Processes and operating systemsProcesses and operating systems
Processes and operating systemsRAMPRAKASHT1
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management ghayour abbas
 
Operating system 06 operating system classification
Operating system 06 operating system classificationOperating system 06 operating system classification
Operating system 06 operating system classificationVaibhav Khanna
 
OperatingSystem01..(B.SC Part 2)
OperatingSystem01..(B.SC Part 2)OperatingSystem01..(B.SC Part 2)
OperatingSystem01..(B.SC Part 2)Muhammad Osama
 
Operating system
Operating systemOperating system
Operating systemMark Muhama
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2) rohassanie
 
OS Chapter03
OS Chapter03OS Chapter03
OS Chapter03jh.cloudnine
 
Operating system 05 functions of os
Operating system 05 functions of osOperating system 05 functions of os
Operating system 05 functions of osVaibhav Khanna
 
Processes description and process control.
Processes description and process control.Processes description and process control.
Processes description and process control.Ahsan Rahim
 
Basic concept of process
Basic concept of processBasic concept of process
Basic concept of processNabin Dahal
 
Os concepts 4 functions of os
Os concepts 4 functions of osOs concepts 4 functions of os
Os concepts 4 functions of osVaibhav Khanna
 

What's hot (20)

Process in operating system
Process in operating systemProcess in operating system
Process in operating system
 
Lecture5
Lecture5Lecture5
Lecture5
 
Os unit 3 , process management
Os unit 3 , process managementOs unit 3 , process management
Os unit 3 , process management
 
Process concept
Process conceptProcess concept
Process concept
 
Operating System
Operating SystemOperating System
Operating System
 
Lecture 2 process
Lecture 2   processLecture 2   process
Lecture 2 process
 
Processes Control Block (Operating System)
Processes Control Block (Operating System)Processes Control Block (Operating System)
Processes Control Block (Operating System)
 
Processes and operating systems
Processes and operating systemsProcesses and operating systems
Processes and operating systems
 
CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management CSI-503 - 6. Memory Management
CSI-503 - 6. Memory Management
 
Operating system 06 operating system classification
Operating system 06 operating system classificationOperating system 06 operating system classification
Operating system 06 operating system classification
 
OperatingSystem01..(B.SC Part 2)
OperatingSystem01..(B.SC Part 2)OperatingSystem01..(B.SC Part 2)
OperatingSystem01..(B.SC Part 2)
 
Operating system
Operating systemOperating system
Operating system
 
Chapter 2 (Part 2)
Chapter 2 (Part 2) Chapter 2 (Part 2)
Chapter 2 (Part 2)
 
OS Chapter03
OS Chapter03OS Chapter03
OS Chapter03
 
Operating system 05 functions of os
Operating system 05 functions of osOperating system 05 functions of os
Operating system 05 functions of os
 
Lesson 7 Process Control Block
Lesson 7 Process Control BlockLesson 7 Process Control Block
Lesson 7 Process Control Block
 
Processes description and process control.
Processes description and process control.Processes description and process control.
Processes description and process control.
 
Basic concept of process
Basic concept of processBasic concept of process
Basic concept of process
 
Processing management
Processing managementProcessing management
Processing management
 
Os concepts 4 functions of os
Os concepts 4 functions of osOs concepts 4 functions of os
Os concepts 4 functions of os
 

Similar to CSI-503 - 2. Processor Management

Operating Systems - Processor Management
Operating Systems - Processor ManagementOperating Systems - Processor Management
Operating Systems - Processor ManagementDamian T. Gordon
 
Operating Systems: Processor Management
Operating Systems: Processor ManagementOperating Systems: Processor Management
Operating Systems: Processor ManagementDamian T. Gordon
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management JayeshGadhave1
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...ApurvaLaddha
 
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptxCPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptxTSha7
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptxDivyaKS18
 
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Shreya Kumar
 
Lecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptxLecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptxAngelaClarito1
 
Operating System Process Management.pptx
Operating System Process Management.pptxOperating System Process Management.pptx
Operating System Process Management.pptxminaltmv
 
Operating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptxOperating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptxAmanuelmergia
 
Operating Systems chap 2_updated2.pptx
Operating Systems chap 2_updated2.pptxOperating Systems chap 2_updated2.pptx
Operating Systems chap 2_updated2.pptxAmanuelmergia
 
Lecture 2- Processes.pdf
Lecture 2- Processes.pdfLecture 2- Processes.pdf
Lecture 2- Processes.pdfAmanuelmergia
 
Part 1 - PROCESS CONCEPTS
Part 1  - PROCESS CONCEPTSPart 1  - PROCESS CONCEPTS
Part 1 - PROCESS CONCEPTSpriyasoundar
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU SchedulingIzaz Roghani
 
Progress OE performance management
Progress OE performance managementProgress OE performance management
Progress OE performance managementYassine MOALLA
 
Progress Openedge performance management
Progress Openedge performance managementProgress Openedge performance management
Progress Openedge performance managementYassine MOALLA
 
Processes
ProcessesProcesses
ProcessesRaviRaj339
 

Similar to CSI-503 - 2. Processor Management (20)

Operating Systems - Processor Management
Operating Systems - Processor ManagementOperating Systems - Processor Management
Operating Systems - Processor Management
 
Operating Systems: Processor Management
Operating Systems: Processor ManagementOperating Systems: Processor Management
Operating Systems: Processor Management
 
Unit 2_OS process management
Unit 2_OS process management Unit 2_OS process management
Unit 2_OS process management
 
Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...Process management- This ppt contains all required information regarding oper...
Process management- This ppt contains all required information regarding oper...
 
Presentation.pdf
Presentation.pdfPresentation.pdf
Presentation.pdf
 
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptxCPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
CPU Scheduling Criteria CPU Scheduling Criteria (1).pptx
 
PROCESS.pptx
PROCESS.pptxPROCESS.pptx
PROCESS.pptx
 
UNIT I-Processes.pptx
UNIT I-Processes.pptxUNIT I-Processes.pptx
UNIT I-Processes.pptx
 
Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.Process scheduling in Light weight weight and Heavy weight processes.
Process scheduling in Light weight weight and Heavy weight processes.
 
Lecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptxLecture-4.1-Operating-System.pptx
Lecture-4.1-Operating-System.pptx
 
Operating System Process Management.pptx
Operating System Process Management.pptxOperating System Process Management.pptx
Operating System Process Management.pptx
 
Operating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptxOperating Systems chap 2_updated2 (1).pptx
Operating Systems chap 2_updated2 (1).pptx
 
Operating Systems chap 2_updated2.pptx
Operating Systems chap 2_updated2.pptxOperating Systems chap 2_updated2.pptx
Operating Systems chap 2_updated2.pptx
 
Lecture 2- Processes.pdf
Lecture 2- Processes.pdfLecture 2- Processes.pdf
Lecture 2- Processes.pdf
 
Lecture 4 process cpu scheduling
Lecture 4   process cpu schedulingLecture 4   process cpu scheduling
Lecture 4 process cpu scheduling
 
Part 1 - PROCESS CONCEPTS
Part 1  - PROCESS CONCEPTSPart 1  - PROCESS CONCEPTS
Part 1 - PROCESS CONCEPTS
 
Processor / CPU Scheduling
Processor / CPU SchedulingProcessor / CPU Scheduling
Processor / CPU Scheduling
 
Progress OE performance management
Progress OE performance managementProgress OE performance management
Progress OE performance management
 
Progress Openedge performance management
Progress Openedge performance managementProgress Openedge performance management
Progress Openedge performance management
 
Processes
ProcessesProcesses
Processes
 

More from ghayour abbas

Web Development 5
Web Development 5 Web Development 5
Web Development 5 ghayour abbas
 
Web Development 4
Web Development 4Web Development 4
Web Development 4ghayour abbas
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)ghayour abbas
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)ghayour abbas
 
Lab Manual CSI-321
Lab Manual CSI-321Lab Manual CSI-321
Lab Manual CSI-321ghayour abbas
 
Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)ghayour abbas
 
Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)ghayour abbas
 
CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher ghayour abbas
 
CSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating SystemCSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating Systemghayour abbas
 
SWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing OverviewSWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing Overviewghayour abbas
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementationghayour abbas
 
SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Designghayour abbas
 
SWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design StrategiesSWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design Strategiesghayour abbas
 
SWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design BasicsSWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design Basicsghayour abbas
 
SWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design ToolsSWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design Toolsghayour abbas
 
SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications ghayour abbas
 
SWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project ManagementSWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project Managementghayour abbas
 
CSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronizationCSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronizationghayour abbas
 
CSI-503 - 1. Introduction to Operating system
CSI-503 - 1. Introduction to Operating systemCSI-503 - 1. Introduction to Operating system
CSI-503 - 1. Introduction to Operating systemghayour abbas
 

More from ghayour abbas (20)

TCP/IP & UDP
TCP/IP & UDPTCP/IP & UDP
TCP/IP & UDP
 
Web Development 5
Web Development 5 Web Development 5
Web Development 5
 
Web Development 4
Web Development 4Web Development 4
Web Development 4
 
Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)Web Development 4 (HTML & CSS)
Web Development 4 (HTML & CSS)
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)
 
Lab Manual CSI-321
Lab Manual CSI-321Lab Manual CSI-321
Lab Manual CSI-321
 
Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)Web Development 2 (HTML & CSS)
Web Development 2 (HTML & CSS)
 
Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)Web Development 1 (HTML & CSS)
Web Development 1 (HTML & CSS)
 
CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher CSI-503 - 13. Scheduler and Dispatcher
CSI-503 - 13. Scheduler and Dispatcher
 
CSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating SystemCSI-503 - 11.Distributed Operating System
CSI-503 - 11.Distributed Operating System
 
SWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing OverviewSWE-401 - 10. Software Testing Overview
SWE-401 - 10. Software Testing Overview
 
SWE-401 - 9. Software Implementation
SWE-401 - 9. Software ImplementationSWE-401 - 9. Software Implementation
SWE-401 - 9. Software Implementation
 
SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Design
 
SWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design StrategiesSWE-401 - 7. Software Design Strategies
SWE-401 - 7. Software Design Strategies
 
SWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design BasicsSWE-401 - 5. Software Design Basics
SWE-401 - 5. Software Design Basics
 
SWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design ToolsSWE-401 - 6. Software Analysis and Design Tools
SWE-401 - 6. Software Analysis and Design Tools
 
SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications SWE-401 - 4. Software Requirement Specifications
SWE-401 - 4. Software Requirement Specifications
 
SWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project ManagementSWE-401 - 3. Software Project Management
SWE-401 - 3. Software Project Management
 
CSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronizationCSI-503 - 4. Process synchronization
CSI-503 - 4. Process synchronization
 
CSI-503 - 1. Introduction to Operating system
CSI-503 - 1. Introduction to Operating systemCSI-503 - 1. Introduction to Operating system
CSI-503 - 1. Introduction to Operating system
 

Recently uploaded

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 

Recently uploaded (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 

CSI-503 - 2. Processor Management

  • 1. Operating System CSI-503 Lecture # 2 Processor Management
  • 2. Processor Management • If you were assembling some IKEA furniture, and following the step- by-step guide of 20 steps. • Imagine you did step 1, then step 2, then step 3, suddenly the doorbell rang, and you are interrupted.
  • 3. Processor Management • You would stop what you are doing and deal with whoever is at the door. • Then you would return to the assembly, check what step you were on, and then continue on from there (step 4).
  • 4. Processor Management • This is how the computer runs multiple processes simultaneously … you do a few steps on one process, get interrupted, work on other processes, then return to the first process, remembering where you left off from, and continue on. • This swapping of processes is called a pre- emptive scheduling policy.
  • 5. Processor Management • A “Process” is the basic unit of execution in the operating system • A “Process” is the name we give to a program when it is running in memory • So a “Program” is the complied executable • And a “Process” is the running executable with the execution state.
  • 6. Processor Management • The same program being run by two different users in the operating system are two different processes
  • 7. Processor Management • The Processor Manager is made up of two sub-managers:
  • 9. Job Scheduler • We describe a collection of processes as a “job”. • When the operating systems is presented with a queue of jobs or processes to run, the Job Scheduler has the task of deciding which order to run the are jobs in. • The Job Scheduler wants to ensure that the all components of the operating system are busy, and there is no component that is idle.
  • 10. Job Scheduler • Let’s think about this program: PROGRAM Print Value: BEGIN Input A; Input B; C = A + B; D = A – B; Print “The sum of inputs is: “, C; Print “The Difference of inputs is: “, D; END.
  • 11. Job Scheduler • Let’s think about this program: PROGRAM Print Value: BEGIN C = A + B; D = A – B; Print “The sum of inputs is: “, C; Print “The Difference of inputs is: “, D; END. Reading from keyboard Input A; I/O Input B;
  • 12. Job Scheduler • Let’s think about this program: • PROGRAM Print Value: BEGIN Input A; Input B; C = A + B; D = A – B; Print “The sum of inputs is: “, C; Print “The Difference of inputs is: “, D; END. Input A; I/O Input B; Reading From keyboard
  • 14. Job Scheduler • Let’s think about this program: PROGRAM Print Value: BEGIN
  • 17. Job Scheduler • Some programs do a lot of I/O, e.g. Graphics programs:
  • 18. Job Scheduler • Others do a lot of computation, but little I/O, e.g. math's programs:
  • 19. Job Scheduler • If the job scheduler gets jobs like this:
  • 20. Job Scheduler • If the job scheduler gets jobs like this:
  • 21. Job Scheduler • So the job scheduler will take these jobs:
  • 22. Job Scheduler • And swap them around, and pass them onto the Process Scheduler
  • 23. Job Scheduler • So in this case the Job Scheduler wants to balance the jobs coming in, so that the components of the operating system are all kept busy. • If we don’t change the order of job, the CPU will be very busy, but the I/O component will be idle, and then vice versa. • This is not an optimal use of resources, so we swap them around.
  • 24. Job Scheduler • We'll call jobs that are CPU-bound Batch Jobs, and we’ll call jobs that have a lot of I/O operations Interactive Jobs.
  • 25. Job Scheduler • This is the first level of swapping of processes that will occur, and more will be done by the Process Scheduler. The Job Scheduler is looking at jobs (or groups of processes), and looking at the whole process from a high-level. • For obvious reasons, the Job Scheduler is also called the High-Level Scheduler.
  • 26. Job Scheduler • Every process has a field that records their current status, called the Process Status. • When the process is first passed to the Job Scheduler from the operating system, its status is always set as HOLD. • When the Job Scheduler passes the process onto the Process Scheduler, its status is always changed to READY.
  • 28. Processor Management • Other statuses that a process can have are:
  • 31. Process Scheduler • Think about traffic lights:
  • 32. Process Scheduler • This is the sequence:
  • 33. Process Scheduler • As mentioned previously the process is first passed to the Job Scheduler from the operating system, its status is always set as HOLD. When the Job Scheduler passes the process onto the Process Scheduler, its status is always changed to READY.
  • 34. Process Scheduler • When the CPU is available, the Process Scheduler will look at all of the upcoming processes and will select one of them (based on a predefined algorithm) and assuming there is memory free, the process will start running and its status is changed to RUNNING by the Process Scheduler.
  • 35. Process Scheduler • After a predefined time, the process will be interrupted, and another process will take over the CPU, and the interrupted process will have its status changed to READY by the Process Scheduler. We will remember that this swapping of processes is called a pre- emptive scheduling policy. • When is CPU is available for this process again the process status be changed to RUNNING by the Process Scheduler.
  • 37. Process Scheduler • If the process has to wait for some I/O from the user or some other event, it is put in a status of WAITING by the Process Scheduler • When the I/O device lets the Process Scheduler know that the I/O is completed, the process status will be changed to READY by the Process Scheduler.
  • 38. Process Scheduler • Finally the process status will be changed to FINISHED either when the process has successful completed, or if an error occurs and the process has to terminate prematurely. The status change is usually handled by the Process Scheduler informing the Job Scheduler of the process completion, and the Job Scheduler of changing the status.
  • 40. Process Control Block (PCB) • The Process status is only one of a collection of descriptors that are associated with a process. • Each process has a data structure called a Process Control Block (PCB) associated with it, rather like a passport.
  • 43. Process Control Block (PCB) • PROCESS IDENTIFIER • Each process is uniquely identified by both the user’s identification, and a pointer connecting it to its descriptor.
  • 44. Process Control Block (PCB) • PROCESS STATUS • The current status of the process, it is either:
  • 45. Process Control Block (PCB) • PROCESS STATE • Program counter • Record the current value of the program counter
  • 46. Process Control Block (PCB) • PROCESS STATE • Register Contents • Record the values of the data registers
  • 47. Process Control Block (PCB) • PROCESS STATE • Main Memory • Record all important information from memory, including most importantly the process location.
  • 48. Process Control Block (PCB) • PROCESS STATE • Resources • Record the resources that have been allocated to this job, including files, disk drives, and printers.
  • 49. Process Control Block (PCB) • PROCESS STATE • Process Priority • The process is assigned a priority, and if the operating system using priorities to schedule processes.
  • 50. Process Control Block (PCB) • PROCESS STATE • Process Priority • The process is assigned a priority, and if the operating system using priorities to schedule processes.
  • 51. Process Control Block (PCB) • PROCESS STATE • Process Priority • The process is assigned a priority, and if the operating system using priorities to schedule processes.
  • 52. Process Control Block (PCB) • ACCOUNTING • This section records some of the performance statistics associated with this process, including: • CPU time used so far • Time process has been in the system • Time taken in memory (Main and secondary) • Space taken in memory (Main and secondary) • System programs used, compliers, editors, etc. • Number and type of I/O operations • Time spent waiting for I/O operations completion • Number of Input records read and Output records written
  • 56. Process Scheduling Policies • What are good policies to schedule processes?
  • 57. Process Scheduling Policies • MAXIMUM THROUGHPUT • Get as many jobs done as quickly as possible. • There are several ways to achieve this, e.g. run only short jobs, run jobs without interruptions.
  • 58. Process Scheduling Policies • MINIMIZE RESPONSE TIME • Ensure that interactive requests are dealt with as quickly as possible. • This could be achieved by scheduling just with a lot of I/O jobs first, and leave the computational jobs for later.
  • 59. Process Scheduling Policies • MINIMIZE TURNAROUND TIME • Ensure that jobs are completed as quickly as possible. • This could be achieved by scheduling just with a lot of computation jobs first, and leave the I/O jobs for later, so there is no user delays.
  • 60. Process Scheduling Policies • MINIMIZE WAITING TIME • Move jobs out of the READY status as soon as possible. • This could be achieved by reduce the number of users allowed on the system, so that the CPU would be available whenever a job enters the READY status.
  • 61. Process Scheduling Policies • MINIMIZE WAITING TIME • Move jobs out of the READY status as soon as possible. • This could be achieved by reduce the number of users allowed on the system, so that the CPU would be available whenever a job enters the READY status.
  • 62. Process Scheduling Policies • MAXIMISE CPU EFFICIENCY • Keep the CPU busy 100% of the time. • This could be achieved by scheduling just with a lot of computation jobs, and never run the I/O jobs.
  • 63. Process Scheduling Policies • ENSURE FAIRNESS FOR ALL JOBS • Give everyone an equal amount of CPU time and I/O time. • This could be achieved by giving all jobs equal priority, regardless of it’s characteristics.
  • 65. Process Scheduling Algorithms • Here are six commonly used process scheduling algorithms
  • 66. Process Scheduling Algorithms • First Come, First Served (FCFS) • A very simple algorithm that uses a FIFO structure. • Implemented as a non-pre-emptive scheduling algorithm. • Works well for Batch Processes, where users don’t expect any interaction.
  • 67. Process Scheduling Algorithms • Shortest Job Next (SJN) • Also called Shortest Job First (SJF) • A very simple algorithm that schedules processes based on CPU cycle time. • Implemented as a non-pre-emptive scheduling algorithm. • Works well for Batch Processes, where it is easy to estimate CPU time.
  • 68. Process Scheduling Algorithms • Priority Scheduling • An algorithm that schedules processes based on priority. • Implemented as a non-pre-emptive scheduling algorithm. • One of the most common algorithms used in systems that are mainly Batch Processes. • If two jobs come in of equal priority are READY, if works on a FIRST COME, FIRST SERVED basis.
  • 69. Process Scheduling Algorithms • Shortest Remaining Time (SRT) • A pre-emptive scheduling version of the Shortest Job Next (SJN) algorithm. • An algorithm that schedules processes based on the one which is nearest to completion. • It can only be implemented on systems that are only Batch Processes, since you have to know the CPU time required to complete each job.
  • 70. Process Scheduling Algorithms • Round Robin • A pre-emptive scheduling algorithm that is used extensively in interactive systems • All active processes are given a pre- determined slice of time (“time quantum”). • Choosing the time quantum is the key decision, for interactive systems the quantum must be small, whereas for batch systems it can be longer.
  • 71. Process Scheduling Algorithms • Multi-Level Queues • This isn’t really a separate scheduling algorithm, it can be used with others. • Jobs are grouped together based on common characteristics. • For example, CPU-bound jobs based in one queue, and the I/O-bound jobs in another queue, and the process scheduler can select jobs from each queue based on balancing the load.