• No results found

OS Unit - 2 part 1.pptx

N/A
N/A
Protected

Academic year: 2020

Share "OS Unit - 2 part 1.pptx"

Copied!
50
0
0

Loading.... (view fulltext now)

Full text

(1)

CSE3007

OPERATING SYSTEM

UNIT - II

Department of computer Science and Engineering SCHOOL OF ENGINEERING

(2)

Course Content

Course Content/Syllabus

Unit I Introduction 8 lectures

Introduction to Operating System Concepts (including Multitasking, multiprogramming, multi user, Multithreading etc)., Classification of Operating systems- Batch, Time sharing, Real Time System, Distributed OS, Network OS, Real Time OS; Various Operating system services, architecture, System programs and calls

Unit II Process Management 8 lectures

Process concept, process scheduling, operation on processes; CPU scheduling, scheduling criteria, scheduling algorithms -First Come First Serve (FCFS), Shortest-Job-First (SJF), Priority Scheduling, Round Robin(RR), Multilevel Queue Scheduling

Unit III Memory Management 7 lectures

Logical & Physical Address Space, swapping, contiguous memory allocation, non-contiguous memory allocation paging and segmentation techniques, segmentation with paging; virtual memory management - Demand Paging & Page-Replacement Algorithms; Demand Segmentation.

Unit IV File System 8 lectures

Different types of files and their access methods, directory structures, various allocation methods, disk scheduling and management and its associated algorithms, Introduction to distributed file system.

Critical Section Problems, semaphores; methods for handling deadlocks-deadlock prevention, avoidance & detection; deadlock recovery.

Unit V I/O Systems 8 lectures

I/O Hardware, Application I/O Interface, Kernel, Transforming I/O requests, Performance Issues.

(3)

PROCESS

INTRODUCTION

A process is a program in execution.

A process is more than the program code, which is sometimes

known as the text section.

It also includes the current activity, as represented by the value

(4)

PROCESS STATE

INTRODUCTION

As a process executes, it changes state. The state of a process

is defined in part by the current activity of that process.

new: The process is being created

running: Instructions are being executed

waiting: The process is waiting for some event to occurready: The process is waiting to be assigned to a

processor

(5)
(6)
(7)
(8)

CONTEXT SWITCHING

When CPU switches to another process, the system must save

the state of the old process and load the saved state for the new process via a context switch

Context of a process represented in the PCB

Context-switch time is overhead; the system does no useful

work while switching

The more complex the OS and the PCB the longer the context switch

Time dependent on hardware support

Some hardware provides multiple sets of registers per CPU

(9)

PROCESS SCHEDULING

The objective of multiprogramming is to have some process running at all times, so as to maximize CPU utilization.

(10)

PROCESS SCHEDULING – Scheduling Queues

Maintains scheduling queues of processes

Job queue – set of all processes in the system

Ready queue – set of all processes residing in main memory,

ready and waiting to execute

Device queues – set of processes waiting for an I/O device

Processes migrate among the various queues

(11)
(12)

Representation of Process Scheduling

(13)

Operations on Processes

The processes in most systems can execute concurrently, and

they may be created and deleted dynamically. Thus, these systems must provide a mechanism for process creation and termination.

Two main operations on processes are:

1. Process Creation

(14)

Operations on Processes – Process Creation

A process may create several new processes, via a create –

process system call, during the course of execution.

The creating process is called a parent process, and the new

processes are called the children of that process.

Each of these new processes may in turn create other

processes, forming a tree of processes.

Generally, process identified and managed via a process

(15)
(16)

Operations on Processes – Process Creation

Resource sharing options

Parent and children share all resources

Children share subset of parent’s resources – this

restriction avoids system overloading

Execution options

(17)
(18)

Process Creation

fork() creates a duplicate of the  current process

exec() replaces the program in the  current process with another 

(19)
(20)

Operations on Processes – Process Deletion

• Some operating systems do not allow child to exists if its parent has terminated.

• If a process terminates, then all its children must also be terminated.

cascading termination. All children, grandchildren, etc. are terminated.

The termination is initiated by the operating system.

The parent process may wait for termination of a child process by using the

wait()system call. The call returns status information and the pid of the terminated

process

(21)

Operations on Processes – Process Deletion

If no parent waiting (did not invoke wait()) process is a zombie

A process which has finished the execution but still has entry in the process table to

report to its parent process is known as a zombie process. A child process always

first becomes a zombie before being removed from the process table. The parent

process reads the exit status of the child process which reaps off the child process

entry from the process table.

If parent terminated without invoking wait , process is an orphan

A process whose parent process no more exists i.e. either finished or terminated

(22)

Schedulers

A  process migrates among 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 

(23)

Schedulers

Long-term scheduler (or job scheduler) – selects from job

queue which processes should be brought into the ready queue  Long-term scheduler is invoked infrequently (seconds,

minutes)  (may be slow)

The long-term scheduler controls the degree of

multiprogramming

Short-term scheduler (or CPU scheduler) – selects from the

ready queue which processes should be executed next and allocates CPU

Sometimes the only scheduler in a system

(24)

Schedulers

Processes can be described as either:

I/O-bound process – spends more time doing I/O than computations, many short CPU bursts

CPU-bound process – spends more time doing computations; few very long CPU bursts

Long-term scheduler strives for good process mix otherwise the 

(25)

Addition of Medium Term Scheduling

Medium-term scheduler can be added if degree of multiple

programming needs to decrease

(26)

Dispatcher

The dispatcher module gives control of the CPU to the process

selected by the short-term scheduler; this involves:  switching context

switching to user mode

jumping to the proper location in the user program to restart that program

The dispatcher needs to run as fast as possible, since it is

invoked during process context switch

The time it takes for the dispatcher to stop one process and

(27)
(28)
(29)
(30)
(31)
(32)
(33)
(34)
(35)
(36)
(37)
(38)
(39)

Although the SJF algorithm is optimal, in that it gives the minimal average waiting time for a given set of processes, it cannot be implemented at the level of short term CPU scheduling. There is no way to know the length of the next CPU burst.

(40)

Priority Scheduling

A priority number (integer) is associated with each processThe CPU is allocated to the process with the highest priority.Equal priority processes are scheduled in FCFS order.

Priority are generally some fixed range of numbers such as from

0 to 7, or from 0 to 4095. However, there is no general agreement on whether 0 is the highest or lowest priority.

Some systems use low numbers to represent low priority;

others use low numbers to represent high priority,

(41)

Priority scheduling

Priority scheduling can be either pre-emptive or non-preemptiveA pre-emptive approach will preempt the CPU if the priority of

the newly-arrived process is higher than the priority of the currently running process

A non-preemptive approach will simply put the new process

(with the highest priority) at the head of the ready queue

SJF is a priority scheduling algorithm where priority is the

predicted next CPU burst time

The main problem with priority scheduling is starvation, that is,

low priority processes may never execute

A solution is aging; as time progresses, the priority of a process in

(42)

Priority Scheduling

For example, if priorities range from 127 (low)

to 0 (high)., we could decrement the priority

(43)

Priority Scheduling

This method is quite same as the SJF but the difference is that

instead of choosing the next process to work on by the shortest

burst time, CPU chooses the next process by the shortest priority

value. Here, all the processes are given a priority value. The process

with the shortest (The most shortest is 1) priority will be worked on

first and so on. Now consider a CPU and also consider a list in which

(44)
(45)
(46)
(47)
(48)
(49)
(50)

References

Related documents

(Counsel for Genworth Life Insurance Company and Genworth Life and Annuity Insurance Company (formerly General Electric Capital Assurance Company, First Colony Life Insurance

The paper presents a model based on an Elman recurrent neural network for the prediction, one hour ahead, of the intensity of the electric current supplied to the residential

The TCAM-based deep packet inspection algorithm developed in this paper uses a jumping window scheme, which is supported by position-aware sub-patterns and the state transition

!  Block access to files based on appraisal results    Hardware root of trust. !  Build a root of trust starting in

This target group is clustered under the term effectiveness (“Do the right things). In table I the target group effectiveness is shown. Furthermore, the table shows the

Requests for ALRM to visit patients are phoned through from the Liaison and Medical staff for either criminal or Civil Field Officers to assist by supporting clients that need

Subject to the terms and conditions of the policy, we will reimburse the Vet Expenses incurred by you as a result of a Treatment to the insured Pet for covered Accidental Injury

Target: Customer wants to benefit from Self Services, Business Information Warehouse, portal, and integration capabilities provided by mySAP ERP. Today: Customer operates SAP