Operating systems
Download
1 / 21

Operating Systems - PowerPoint PPT Presentation


  • 71 Views
  • Uploaded on

Operating Systems. Process Management. What is a Process?. The basic unit of software that the operating system deals with in scheduling the work done by the processor. Not the same as an application, since an application can cause multiple processes to be executed.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Operating Systems' - solana


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Operating systems

Operating Systems

Process Management


What is a process
What is a Process?

  • The basic unit of software that the operating system deals with in scheduling the work done by the processor.

  • Not the same as an application, since an application can cause multiple processes to be executed.

  • Can be defined as software that performs some action and can be controlled - by a user, by other applications or by the operating system.


What is a process1
What Is A Process

  • A process consists of the machine code image of the program and a Process Control Block (PCB).

  • The PCB typically contains:

    • An ID number that identifies the process

    • Pointers to the locations in the program and its data where processing last occurred

    • Register contents

    • States of various flags and switches

    • Pointers to the upper and lower bounds of the memory required for the process

    • A list of files opened by the process

    • The priority of the process

    • The status of all I/O devices needed by the process


Listing processes in unix
Listing Processes in UNIX

  • The ps command displays process information in the following format:

    • PID: process id

    • TTY: id of terminal owning process

    • TIME: cumulative amount of CPU time used

    • COMMAND: command which generated the process.

PID TTY TIME COMMAND

291 01 00:02 sh

353 01 00:00 ps


Listing processes in windows
Listing Processes in Windows

  • Right-click on task bar

  • Select Task Manager

  • Applications tab shows running application

  • Processes tab shows running processes and the system resources each is using.

  • Status Bar shows the number of processes running and the CPU utilization.


Process life cycle

Running

Ready

Blocked

Process Life-Cycle

I/O Completion

Process Entry

Dispatch

I/O Wait

Timeout

Termination


Process life cycle1
Process Life-Cycle

  • READY

    • process is able to use the CPU when it is assigned to it

    • many processes may be in a READY state at any instant

  • BLOCKED

    • process is waiting for an I/O operation to complete and cannot utilise the CPU

    • many processes may be in a BLOCKED state at any instant

  • RUNNING

    • process is using the CPU

    • for a single-CPU computer only one process can be in a RUNNING state at any instant


Process scheduling
Process Scheduling

  • The CPU can only do one thing at a time.

  • In order to give the appearance of lots of things happening at the same time, the operating system has to switch between different processes thousands of times a second.

  • This function is performed by the process scheduler.


Objectives of scheduling
Objectives of Scheduling

  • Equity

  • Maximize throughput

  • Be predictable

  • Balance resource use

  • Avoid indefinite postponement

  • Enforce priorities

  • Give preference to processes holding key resources

  • Degrade gracefully under heavy loads


Criteria for scheduling
Criteria for Scheduling

  • Priority assigned to a process.

  • Class of process – batch, online or real-time.

  • Resource requirements.

  • CPU-bound or I/O bound.

  • Resources used to date.

  • Waiting time to date.


Scheduling policies
Scheduling Policies

  • Preemptive

    • scheduler may suspend a process in order to allow another process to run.

  • Non-preemptive

    • process runs until it terminates or incurs an I/O wait.

  • Cooperative

    • process periodically relinquishes control of the CPU.


Scheduling algorithms
Scheduling Algorithms

  • First-Come-First-Served (FCFS)

    • the first process in the READY state gets the CPU

    • non-preemptive

    • long jobs favored over short ones

    • I/O bound processes will be idle for long periods.

  • Shortest Job First (SJF)

    • the process with the shortest estimated run-time gets the CPU

    • non-preemptive

    • long-running processes could be starved for the CPU


Scheduling algorithms1
Scheduling Algorithms

  • Shortest Remaining Time (SRT)

    • preemptive version of SJF

    • a process with a shorter estimated run-time than the current process’ remaining run-time will get the CPU.

    • long-running processes could be starved for the CPU

  • Highest Response Ratio Next

    • non-preemptive

    • a process is assigned a priority based on the time it has spent waiting and its estimated run-time

    • higher priority processes get the CPU first


Scheduling algorithms2
Scheduling Algorithms

  • Round Robin (RR)

    • preemptive

    • processes get the CPU in FCFS sequence

    • once the process has run for a defined period (time quantum) it is interrupted and the next process gets the CPU

    • no process can “hog” the CPU

  • Multi-level Feedback Queues (MFQ)

    • maintains a number of separate queues, each of which represents a different priority

    • processes in a lower priority queue do not get the CPU unless the higher priority queues are empty

    • each queue uses RR, if a process uses up its time quantum is moves to the end of the queue on the next lower level.


Scheduling in unix
Scheduling in UNIX

  • Uses the MFQ algorithm.

  • Processes are assigned an initial priority.

  • The priority is represented by an integer, the higher the integer the lower the priority.

  • Priority is increased the longer the process waits.

  • Priority is reduced the longer the process runs.

  • A process’ initial priority can be adjusted using the nice command.

  • Only a superuser can increase a process’ initial priority.


Scheduling in windows
Scheduling in Windows

  • Windows 95 and 98 used a cooperative policy.

  • Windows NT (and later) use a preemptive policy with a round-robin algorithm similar to UNIX.

  • Process priority is represented by six (6) states – realtime, high, abovenormal, normal, belownormal, low.

  • A process’ initial priority can be changed with the START command.

  • Only a superuser can increase a process’ priority.


Process thrashing
Process Thrashing

  • Process switching happens without direct user interference, and each process gets enough CPU cycles to accomplish its task in a reasonable amount of time.

  • If enough processes are started, and if the operating system hasn't been carefully designed, the system can begin to use the vast majority of its available CPU cycles to swap between processes rather than run processes.

  • This situation is known as thrashing.


Interrupt system
Interrupt System

  • In addition to executing processes, the CPU must also respond to interrupts.

  • Interrupts are special signals sent by hardware or software to the CPU.

  • Sometimes the operating system will schedule the priority of processes so that interrupts are masked - that is, the operating system will ignore the interrupts from some sources so that a particular job can be finished as quickly as possible.


Interrupt system1
Interrupt System

  • There are some interrupts that are so important that they can't be ignored. These non-maskable interrupts (NMIs) must be dealt with immediately.

  • The importance of the interrupt system is that it permits several programs and I/O activities to proceed independently.


Types of interrupts
Types of Interrupts

  • I/O – Generated by the controller of an I/O device, to signal normal completion or the occurrence of an error or failure condition.

  • Timer – Generated by the internal clock, used to alert the operating system at predetermined intervals.

  • Hardware Error – Generated by hardware faults.

  • Program – Generated by error conditions within user programs.


Multi cpu systems
Multi-CPU Systems

  • In a system with two or more CPUs, the operating system must divide the workload among the CPUs.

  • Asymmetric operating systems use one CPU for their own needs and divide application processes among the remaining CPUs.

  • Symmetric operating systems divide processes among the various CPUs, balancing demand versus CPU availability even when the operating system itself is all that's running.


ad