computer fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · making a...

25
1 Computer Fundamentals : Pradeep K. Sinha & Priti Sinha Computer Fundamentals : Pradeep K. Sinha & Priti Sinha Slide 1/74 Chapter 14: Operating Systems Chapter 14 Operating Systems Computer Fundamentals Pradeep K. Sinha Priti Sinha Computer Fundamentals : Pradeep K. Sinha & Priti Sinha Computer Fundamentals : Pradeep K. Sinha & Priti Sinha Slide 2/74 Chapter 14: Operating Systems Learning Objectives Learning Objectives In this chapter you will learn about: Definition and need for operating system Main functions of an operating system Commonly used mechanisms for: Process management Memory management File management Device management Security Command interpretation Some commonly used OS capability enhancement software Some popular operating systems Computer Fundamentals : Pradeep K. Sinha & Priti Sinha Computer Fundamentals : Pradeep K. Sinha & Priti Sinha Slide 3/74 Chapter 14: Operating Systems Definition, Need and Functions of an OS

Upload: others

Post on 27-Apr-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

1

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 1/74Chapter 14: Operating Systems

Chapter 14

Operating Systems

Computer Fundamentals

Pradeep K. Sinha

Priti Sinha

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 2/74Chapter 14: Operating Systems

Learning ObjectivesLearning Objectives

In this chapter you will learn about:

� Definition and need for operating system

� Main functions of an operating system

� Commonly used mechanisms for:

� Process management

� Memory management

� File management

� Device management

� Security

� Command interpretation

� Some commonly used OS capability enhancement software

� Some popular operating systems

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 3/74Chapter 14: Operating Systems

Definition, Need and Functions of an OS

Page 2: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

2

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 4/74Chapter 14: Operating Systems

� Integrated set of programs that controls the resources (the CPU, memory, I/O devices, etc.) of a computer system

� Provides its users with an interface or virtual machine that is more convenient to use than the bare machine

� Two primary objectives of an OS are:

� Making a computer system convenient to use

� Managing the resources of a computer system

Definition and Need for OSDefinition and Need for OS

Ref. Page 270

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 5/74Chapter 14: Operating Systems

Operating system layer hides details of hardware fromprogrammers and other users and provides them with aconvenient interface for using the system

Logical Architecture of a Computer SystemLogical Architecture of a Computer System

Users

Other system software and application programs

Operating system

Computer hardware

Ref. Page 271

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 6/74Chapter 14: Operating Systems

� Process management

� Memory management

� File management

� Device management

� Security

� Command interpretation

Main Functions of an OSMain Functions of an OS

Ref. Page 271

Page 3: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

3

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 7/74Chapter 14: Operating Systems

� Throughput: Amount of work that the system is able to do per unit time

� Turnaround time: Interval from the time of submission of a job to the system for processing to the time of completion of the job

� Response time: Interval from the time of submission of a job to the system for processing to the time the first response for the job is produced by the system

Parameters for Measuring System PerformanceParameters for Measuring System Performance

Ref. Page 272

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 8/74Chapter 14: Operating Systems

Process Management

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 9/74Chapter 14: Operating Systems

� A process (also called job) is a program in execution

� Process management module of an operating systemmanages the processes submitted to a system in amanner to minimize idle time of processors (CPUs, I/Oprocessors, etc.) of the system

Process ManagementProcess Management

Ref. Page 273

Page 4: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

4

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 10/74Chapter 14: Operating Systems

� Manual loading mechanism: Jobs were manuallyloaded one after another in a computer by thecomputer operator

� Batch processing mechanism: Batch of jobs wassubmitted together to the computer and job-to-jobtransition was done automatically by the operatingsystem

� Job Control Language (JCL): Control statementswere used to identify a new job in a batch of jobs andto determine its resource requirements

Process Management Mechanisms in Early SystemsProcess Management Mechanisms in Early Systems

Ref. Page 273

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 11/74Chapter 14: Operating Systems

Use of Job Control Statements in Batch Processing (An Example)Use of Job Control Statements in Batch Processing (An Example)

$END

Data for program

$LOAD

COBOL program

$JOB, ONGC05839,

USER=SINHA

$COBOL

$RUN

Ref. Page 274

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 12/74Chapter 14: Operating Systems

UniprogrammingUniprogramming

Main memory

OS area

Execution in

progress

CPU

User programarea

User job

Operating system

(Continued on next slide…)

Ref. Page 275

Page 5: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

5

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 13/74Chapter 14: Operating Systems

� A job does not need CPU for entire duration of its processing

� Depending on CPU utilization during the course of processing, jobs are of two types

� CPU-bound jobs, which mostly perform computations with little I/O operations

� I/O-bound jobs, which mostly perform I/O operations with little computation

� In a uniprogramming system, CPU is idle whenever the currently executing job performs I/O operations

UniprogrammingUniprogramming

Ref. Page 275

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 14/74Chapter 14: Operating Systems

MultiprogrammingMultiprogramming

� Multiprogramming is interleaved execution of two or more different and independent programs by a computer

� Multiprogramming enables two or more user programs to reside simultaneously in main memory and carries out their interleaved execution

� With multiple user programs residing simultaneously in main memory, whenever a user program that was executing goes to perform I/O operations, the operating system allocates CPU to another user program in main memory

� In multiprogramming, several user programs share CPU time to keep it busy

� Note that multiprogramming does not mean execution of instructions from several programs simultaneously

(Continued on next slide…)

Ref. Page 275

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 15/74Chapter 14: Operating Systems

Secondary disk

storage

Writing output

data

Main memory

CPU

Job C

(Waiting for CPU)

Job A

Job B

Operating system

Execution in

progress

A typical scenario of jobs in a multiprogramming system

MultiprogrammingMultiprogramming

Ref. Page 276

Page 6: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

6

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 16/74Chapter 14: Operating Systems

Job processing

completedReady Running

Blocked

New job

Job is allocated the

CPU for execution

I/O

completedJob must wait for I/O

completion

Three different states of jobs in main memory in a multiprogramming system

MultiprogrammingMultiprogramming

Ref. Page 276

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 17/74Chapter 14: Operating Systems

� Large memory

� Memory protection

� Job status preservation

� Proper job mix (CPU and I/O bound jobs)

� CPU scheduling

Requirements of Multiprogramming SystemsRequirements of Multiprogramming Systems

Ref. Page 277

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 18/74Chapter 14: Operating Systems

PCB is used to preserve the job status of each loaded process in a multiprogramming system

Process Control Block (PCB)Process Control Block (PCB)

process identifier

process state

program counter

values of various CPU registers

accounting and scheduling information

I/O status information

Ref. Page 277

Page 7: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

7

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 19/74Chapter 14: Operating Systems

MultitaskingMultitasking

� Multitasking is single-user variation of multiprogrammingconcept

� Both refer to the same concept of a system’s capability towork concurrently on more than one task

� Some authors prefer to use the term multiprogramming formulti-user systems and multitasking for single-user systems

� Multitasking eases user operation and saves lots of time whena user has to switch between two or more applications whileperforming a job

� Multiprogramming is interleaved execution of multiple jobs ina multi-user system, while multitasking is interleavedexecution of multiple jobs in a single-user system

Ref. Page 277

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 20/74Chapter 14: Operating Systems

MultithreadingMultithreading

� Threads are a popular way to improve applicationperformance

� In traditional operating systems, the basic unit of CPUutilization is a process

� Each process has its own program counter, its own registerstates, its own stack, and its own address space

� In operating systems with threads facility, the basic unit ofCPU utilization is a thread

� A process consists of an address space and one or morethreads of control

(Continued on next slide…)

Ref. Page 278

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 21/74Chapter 14: Operating Systems

� Each thread of a process has its own program counter, itsown register states, and its own stack

� All the threads of a process share the same address space

� All threads of a process also share the same set of operatingsystem resources

� Threads are often referred to as lightweight processes andtraditional processes are referred to as heavyweightprocesses

MultithreadingMultithreading

Ref. Page 278

Page 8: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

8

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 22/74Chapter 14: Operating Systems

(a) Single-threaded and (b) multithreaded processes. A single-threaded process corresponds to a process of a traditionaloperating system. [Reproduced with permission, from thebook titled Distributed Operating Systems: Concepts andDesign by Pradeep K. Sinha. © 1997 IEEE, USA].

Address space

Thread

Address space

Thread Thread Thread

(b)

Multithreading SystemMultithreading System

(a)

Ref. Page 279

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 23/74Chapter 14: Operating Systems

Motivations for Using ThreadsMotivations for Using Threads

� Overhead involved in creating a new process is considerablygreater than that for creating a new thread within a process

� New thread uses the address space of its process

� Overhead involved in CPU switching among peer threads isvery small as compared to CPU switching among processes

� Resources are shared more efficiently among multiple threadsof a process than among multiple processes

� Users find the threads model more intuitive for applicationprogramming

Ref. Page 278

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 24/74Chapter 14: Operating Systems

� System with two or more CPUs having ability to executemultiple processes concurrently

� Multiple CPUs are used to process either instructions fromdifferent and independent programs or differentinstructions from the same program simultaneously

� Types of multiprocessing:

� Tightly-coupled: Single system-wide primary memoryshared by all processors

� Loosely-coupled: Each processor has its own localmemory

MultiprocessingMultiprocessing

Ref. Page 279

Page 9: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

9

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 25/74Chapter 14: Operating Systems

I/O Units I/O Processors

CPU

Main memory

CPU, Memory, and I/O Processors of a Computer SystemCPU, Memory, and I/O Processors of a Computer System

Ref. Page 280

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 26/74Chapter 14: Operating Systems

Multiprocessing SystemMultiprocessing System

CPU-1 Main memory CPU-2

I/O processors I/O processors

I/O units I/O units

Ref. Page 280

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 27/74Chapter 14: Operating Systems

Difference between Multiprogramming and Multiprocessing Difference between Multiprogramming and Multiprocessing

� Multiprocessing is simultaneous execution of two or moreprocesses by a computer system having more than one CPU

� Multiprogramming is interleaved execution of two or moreprocesses by a single-CPU system

� Multiprogramming involves execution of a portion of oneprogram, then a portion of another, etc., in brief consecutiveperiods

� Multiprocessing involves simultaneous execution of severalprogram segments of the same or different programs

Ref. Page 280

Page 10: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

10

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 28/74Chapter 14: Operating Systems

� Simultaneous interactive use of a computer system bymany users in such a way that each one feels thathe/she is the sole user of the system

� Many user terminals are connected to the samecomputer simultaneously

� Uses multiprogramming with a special CPU schedulingalgorithm

� Short period during which a user process gets to useCPU is known as time slice, time slot, or quantum

� CPU is taken away from a running process when theallotted time slice expires

Time-sharingTime-sharing

Ref. Page 281

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 29/74Chapter 14: Operating Systems

Process State Diagram for a Time-Sharing SystemProcess State Diagram for a Time-Sharing System

Ready Running

Blocked

New job

Job is allocated to

CPU for executionJob processing

completed

I/O

completedJob must wait for

I/O completion

Allotted time slice is over

Process state diagram for a time-sharing system

Ref. Page 281

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 30/74Chapter 14: Operating Systems

� Time-sharing systems require following additional hardwareand software

� Number of user terminals

� Large memory to support multiprogramming

� Memory protection mechanism to prevent a job’s instructions anddata from other jobs

� Job status preservation mechanism to preserve a job’s statusinformation when the operating system takes away CPU from it,and restores this information back

� Special CPU scheduling algorithm that allocates CPU for a shortperiod one-by-one to each user process

� Interrupt mechanism to send an interrupt signal to CPU afterevery time slice

Requirements of Time-sharing SystemsRequirements of Time-sharing Systems

Ref. Page 282

Page 11: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

11

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 31/74Chapter 14: Operating Systems

� Reduces CPU idle time

� Provides advantages of quick response time

� Offers good computing facility to small users

Advantages of Time-sharing SystemsAdvantages of Time-sharing Systems

Ref. Page 282

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 32/74Chapter 14: Operating Systems

Memory Management

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 33/74Chapter 14: Operating Systems

� Memory is important resource of a computer systemthat must be properly managed for the overall systemperformance

� Memory management module:

� Keeps track of parts of memory in use and parts not in use

� Allocates memory to processes as needed and deallocateswhen no longer needed

Memory ManagementMemory Management

Ref. Page 283

Page 12: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

12

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 34/74Chapter 14: Operating Systems

� Used in systems that process one job only at a time, and all system resources are available exclusively for the job until it completes

� Simple and easy to implement

� Does not lead to proper utilization of the main memory as unoccupied memory space by the currently active user process remains unused

� Used only on very small or dedicated computer systems

Uniprogramming Memory ModelUniprogramming Memory Model

Ref. Page 283

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 35/74Chapter 14: Operating Systems

Operating system area

Unused

User process

User area

Operating system

Uniprogramming Memory ModelUniprogramming Memory Model

Ref. Page 283

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 36/74Chapter 14: Operating Systems

� Multiprogramming with fixed number of memory partitions:User area of the memory is divided into a number of fixed-sized partitions

� Multiprogramming with variable number of memorypartitions: Number, size and location of the partitions varydynamically as processes come and go

Multiprogramming Memory ModelsMultiprogramming Memory Models

� In a multiprogramming system, multiple user processescan reside simultaneously in main memory

� Two memory management schemes used to facilitate thisare:

Ref. Page 283

Page 13: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

13

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 37/74Chapter 14: Operating Systems

Multiprogramming with Fixed Number of Memory PartitionMultiprogramming with Fixed Number of Memory Partition

Partition 1

Partition 2

Partition 3

Partition n

Operating system area

User area divided into nequal-sized partitions

Operating system

Ref. Page 284

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 38/74Chapter 14: Operating Systems

Operating

system

Free

Operating

system

Free

P1

Operating

system

Free

P1

P2User

area

P1

comes

P2

comes

P3

comes

(a) (b) (c)

Operating

system

Free

P1

P2

P3

(d)

The number, size, and location of the partitions vary dynamically as

processes come and go. (contd…)

Multiprogramming with Fixed Number of Memory PartitionMultiprogramming with Fixed Number of Memory Partition

Ref. Page 285

Time (a), (b), …, (h)

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 39/74Chapter 14: Operating Systems

terminates

P2

Operating system

Free 1

P1

P2

P3

(e)

Free 2

Operating system

Free 1

P1

P4

P3

(f)

P4

Comes which

cannot fit in Free 1 so is allocated

space from Free 2

Free 2

Operating system

Free 1

Free 3

P4

P3

(g)

Free 2

P1

terminates

Operating system

Free 1

Free 3

P4

P3

(h)

Free 2

P5

comes

which can fit inFree 3

P5

The number, size, and location of the partitions vary dynamically as processes come and go.

Multiprogramming with Variable Number of Memory PartitionsMultiprogramming with Variable Number of Memory Partitions

Ref. Page 285

Page 14: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

14

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 40/74Chapter 14: Operating Systems

Virtual MemoryVirtual Memory

� Conventional memory management schemes suffer from twomain limitations

� Operating system cannot load a process until sufficient freememory for loading the entire process becomes available

� Operating system cannot load a process if main memory size isless than the total memory required

� Virtual memory is a memory management scheme thatovercomes these limitations by allowing execution of aprocess without the need to load the process in main memorycompletely

Ref. Page 285

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 41/74Chapter 14: Operating Systems

How is Virtual Memory Realized?How is Virtual Memory Realized?

� On-line secondary storage

� On-line secondary storage device having much larger capacitythan main memory

� Swapping

� Swapping is the process of transferring a block of data from on-line secondary storage to main memory or vice-versa

� Demand paging

� Instead of loading an entire process before its execution canstart, the operating system uses a swapping algorithm

� When operating system needs to swap to continue a process’sexecution, it invokes a page-replacement algorithm to create onefor the accessed page

� Page replacement deals with selecting a page that is residing inmemory but is not in use currently

(Continued on next slide…)

Ref. Page 286

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 42/74Chapter 14: Operating Systems

� Virtual memory is often described as a hierarchy of twostorage systems – one is a low-cost, large-capacity, low-speed system (on-line disk storage), and the other is a high-cost, small-capacity, high-speed system (main memory)

How is Virtual Memory Realized?How is Virtual Memory Realized?

Ref. Page 286

Page 15: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

15

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 43/74Chapter 14: Operating Systems

� Provides a large virtual memory to programmers on asystem having smaller physical memory

� Enables execution of a process on a system whose mainmemory size is less than the total memory required by theprocess

� Enables a process’s execution to be started even whensufficient free memory for loading the entire process is notavailable

� Makes programming easier as programmers no longerneed to worry about the memory size limitations

� Often leads to less I/O activity resulting in betterthroughput, turnaround time, and response time

Advantages of Virtual MemoryAdvantages of Virtual Memory

Ref. Page 286

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 44/74Chapter 14: Operating Systems

� Difficult to implement because it requires algorithms tosupport demand paging

� If used carelessly, it may substantially decreaseperformance due to high page fault rate

Disadvantages of Virtual MemoryDisadvantages of Virtual Memory

Ref. Page 287

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 45/74Chapter 14: Operating Systems

File Management

Page 16: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

16

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 46/74Chapter 14: Operating Systems

� A file is a collection of related information

� Every file has a name, its data and attributes

� File’s name uniquely identifies it in the system and is usedby its users to access it

� File’s data is its contents

� File’s attributes contain information such as date & time ofits creation, date & time of last access, date & time of lastupdate, its current size, its protection features, etc.

� File management module of an operating system takescare of file-related activities such as structuring,accessing, naming, sharing, and protection of files

File ManagementFile Management

Ref. Page 287

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 47/74Chapter 14: Operating Systems

File Access MethodsFile Access Methods

� Sequential access files

� Operating systems use sequential access files for storage of fileson sequential access storage media

� A process can read the bytes or records in the file in the order inwhich they are stored

� Random access files

� Operating systems use random access files for storage of files onrandom access storage media

� Applications can access the contents of a random access filerandomly, irrespective of the order in which the bytes or recordsare stored

Ref. Page 287

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 48/74Chapter 14: Operating Systems

File Operations (Examples) File Operations (Examples)

File operation Usage

Create Is used to create a new file.

Delete Is used to delete an existing file that is no longer needed.

Open Is used to open an existing file when a user wants to start using it.

Close Is used to close a file when the user has finished using it.

Read Is used to read data stored in a file.

Write Is used to write new data in a file.

Seek Is used with random access files to first position read/write pointer to a specific place in file so that data can be read from, or written to,

that position.

Get attributes Is used to access the attributes of a file.

Set attributes Is used to change user-settable attributes (such as, protection mode) of a file.

Rename Is used to change name of an existing file.

Copy Is used to create a copy of a file, or to copy a file to an I/O device, such as a printer.

Ref. Page 288

Page 17: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

17

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 49/74Chapter 14: Operating Systems

File naming deals with the rules for naming files in an operating system. This may include such rules as:

� Maximum number of characters that a file name may have

� Special characters allowed in a file name

� Distinction between upper case and lower case letters

� Multi-part file names allow file extensions to be part of a file name. File extensions indicate something about the file and its content

� Used by applications to check for the intended type of file before operating on it

File NamingFile Naming

Ref. Page 288

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 50/74Chapter 14: Operating Systems

File Extensions (Example)File Extensions (Example)

(Continued on next slide…)

File

extensionIts meaning

.bas Basic source program file

.c C source program file

.ftn Fortran source program file

.pas Pascal source program file

.obj Object file (compiler output, not yet linked)

.bin Executable binary program file

.lib Library of .obj files used by the linker

.dat Data file

.hlp Text file for HELP command

.man Online manual page file

Ref. Page 289

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 51/74Chapter 14: Operating Systems

File Extensions (Example)File Extensions (Example)

File

extensionIts meaning

.txt General text file

.bak Backup file

.doc Microsoft word document file

.wav Microsoft windows sound file

.wk4 Lotus 1-2-3 spreadsheet file

.xls Microsoft Excel spreadsheet file

.jpg JPEG graphics file

.gif GIF graphics file

Ref. Page 289

Page 18: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

18

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 52/74Chapter 14: Operating Systems

Device Management

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 53/74Chapter 14: Operating Systems

Controlling I/O Devices Controlling I/O Devices

� Computer uses device controllers to connect I/O devices to it

� Each device controller is in charge of and controls a set ofdevices of a specific type

� Device controller maintains some local buffer storage and isresponsible for moving data between an I/O device that itcontrols and its local buffer storage

� Device controller also has a few registers that it uses forcommunicating with CPU

� These registers are part of the regular memory address space

� This scheme is called memory-mapped I/O

(Continued on next slide…)

Ref. Page 290

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 54/74Chapter 14: Operating Systems

� Two methods to transfer data from the controller’s local bufferto the appropriate memory area of the computer are:

� Non-DMA transfer

� As soon as transfer of data from input device to the controller’slocal buffer is complete, the controller sends an interrupt signal toCPU

� CPU then stops what it is doing currently, and transfers control ofexecution to the starting address of the service routine, whichhandles the interrupt

� Interrupt service routine transfers the data from local buffer ofthe device controller to main memory

(Continued on next slide…)

Controlling I/O Devices Controlling I/O Devices

Ref. Page 290

Page 19: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

19

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 55/74Chapter 14: Operating Systems

� DMA transfer

� When the operating system prepares for data transferoperation, it writes the relevant commands and their associatedparameters into the controller’s registers

� After the controller has read the data from the device into itsbuffer, it copies the data one byte or word at a time from itsbuffer into main memory at the specified memory address

� It does not involve the CPU

� Device controller sends an interrupt to CPU only after itcompletes copying the entire data

Controlling I/O Devices Controlling I/O Devices

Ref. Page 290

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 56/74Chapter 14: Operating Systems

Simple and Easy User Interface to I/O Devices Simple and Easy User Interface to I/O Devices

� Operating systems provide simple and easy user interfaceto all I/O devices

� They achieve this by organizing the software for using I/Odevices as a series of layers

� Lower layers hide the internal details

� Upper layers present a nice, clean, uniform interface to theusers

(Continued on next slide…)

Ref. Page 290

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 57/74Chapter 14: Operating Systems

� Operating systems provide simple and easy user interface toall I/O devices

� They achieve this by organizing the software for using I/Odevices as a series of layers

� Lower layers hide the internal details

� Upper layers present a nice, clean, uniform interface to theusers

(Continued on next slide…)

Simple and Easy User Interface to I/O Devices Simple and Easy User Interface to I/O Devices

Ref. Page 290

Page 20: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

20

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 58/74Chapter 14: Operating Systems

Layers of I/O SystemLayers of I/O System

User-level software

Device-independent

software

Device drivers

Interrupt handlers

I/O devices hardware

I/O software

layers

I/O hardware

Supports standard I/O system calls as library procedures.

Performs I/O functions that are common to all

devices and maps symbolic device names to the proper device driver.

Converts I/O requests into suitable commands for the appropriate device controller and writes

the relevant commands and their associated parameters into the controller’s registers.

Causes interrupt to wakeup the device driver

after it completes data transfer.

Performs actual data I/O.

Ref. Page 291

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 59/74Chapter 14: Operating Systems

Security

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 60/74Chapter 14: Operating Systems

� Deals with protecting the various resources and informationof a computer system against destruction and unauthorizedaccess

� External security: Deals with securing computer againstexternal factors such as fires, floods, earthquakes, stolendisks/tapes, etc. by maintaining adequate backup, usingsecurity guards, allowing access to sensitive information toonly trusted employees/users, etc.

� Internal security: Deals with user authentication, accesscontrol, and cryptography mechanisms

SecuritySecurity

Ref. Page 291

Page 21: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

21

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 61/74Chapter 14: Operating Systems

� User authentication: Deals with the problem ofverifying the identity of a user (person or program)before permitting access to the requested resource

� Access Control: Once authenticated, access controlmechanisms prohibit a user/process from accessing thoseresources/information that he/she/it is not authorized toaccess

� Cryptography: Means of encrypting private informationso that unauthorized access cannot use information

SecuritySecurity

Ref. Page 291

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 62/74Chapter 14: Operating Systems

Command Interpretation

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 63/74Chapter 14: Operating Systems

� Provides a set of commands using which the user can giveinstructions to the computer for getting some job done byit

� Commands supported by the command interpretationmodule are known as system calls

Command InterpretationCommand Interpretation

(Continued on next slide…)

Ref. Page 292

Page 22: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

22

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 64/74Chapter 14: Operating Systems

Two types of user interfaces supported by various operatingsystems are:

� Command-line interface: User gives instructions tothe computer by typing the commands

� Graphical User Interface (GUI): User givescommands to the system by selecting icon or menuitem displayed on the screen with the use of a point-and-draw device

Command InterpretationCommand Interpretation

Ref. Page 292

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 65/74Chapter 14: Operating Systems

OS Capability Enhancement Software

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 66/74Chapter 14: Operating Systems

� Perform several tasks of routine nature, frequentlyneeded by users but are not provided as part of the OS

� They are primarily grouped into three categories:

� Translating programs: Translate a source programinto an object program

� Library programs: Consist of frequently usedfunctions and operations

� Utility programs: Assist users with systemmaintenance tasks such as disk formatting, datacompression, data backups, antivirus utilities

OS Capability Enhancement SoftwareOS Capability Enhancement Software

Ref. Page 293

Page 23: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

23

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 67/74Chapter 14: Operating Systems

Some Popular Operating Systems

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 68/74Chapter 14: Operating Systems

� Developed in the early 1970s at Bell Laboratories by KenThompson and Dennis Ritchie

� Written in C high-level language, hence, highly portable

� Multi-user, time-sharing OS

� Used on a wide variety of computers ranging fromnotebook computers to super computers

� Especially prevalent on RISC workstations such as thosefrom Sun Microsystems, Hewlett-Packard, IBM, andSilicon Graphics

� Structured in three layers – kernel, shell, and utilities

UNIX OSUNIX OS

Ref. Page 295

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 69/74Chapter 14: Operating Systems

� Stands for Microsoft Disk Operating System.

� Single-user OS for IBM and IBM-compatible personalcomputers (PC)

� Structured in three layers – BIOS (Basic Input OutputSystem), kernel, and shell

� Very popular in the 1980s. Not in much use now afterdevelopment of Microsoft Windows OS in 1990s

MS-DOSMS-DOS

Ref. Page 295

Page 24: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

24

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 70/74Chapter 14: Operating Systems

� Developed by Microsoft to overcome limitations of MS-DOS operating system

� Single-user, multitasking OS

� Native interface is a GUI

� Designed to be not just an OS but also a complete operating environment

� OS of choice for most PCs after 1990

Microsoft WindowsMicrosoft Windows

Ref. Page 296

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 71/74Chapter 14: Operating Systems

� Multi-user, time-sharing OS developed by Microsoft

� Designed to have UNIX-like features so that it can beused for powerful workstations, network, and databaseservers

� Supports multiprogramming and is designed to takeadvantage of multiprocessing on systems havingmultiple processors

� Native interface is a GUI

� Built-in networking and communications features

� Provides strict system security

� Rich set of tools for software development

Microsoft Windows NTMicrosoft Windows NT

Ref. Page 297

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 72/74Chapter 14: Operating Systems

� Open-source OS enhanced and backed by thousands of programmers world-wide

� Multi-tasking, multiprocessing OS, originally designed to be used in PCs

� Name “Linux” is derived from its inventor Linus Torvalds

� Several Linux distributions available (Red Hat, SuSE). Difference in distribution is mostly set of tools, number and quality of applications, documentation, support, and service

LinuxLinux

Ref. Page 297

Page 25: Computer Fundamentals - lncollegebu.orglncollegebu.org/library/pdf/1429850634.pdf · Making a computer system convenient to use Managing the resources of a computer system Definition

25

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 73/74Chapter 14: Operating Systems

� Access control� Batch processing� Command interpretation� Command-line interface (CLI)� CPU-bound jobs� Cryptography� Demand paging� Device manageemnt� External security� File� File attributes� File extensions� File management� Graphical User Interface (GUI)� I/O-bound jobs� Internal security� Job� Job control language (JCL)� Library programs� Lightweight processes

� Linux� Loosely coupled system� Memory management� Memory partition� Microsoft Windows� Microsoft Windows NT� MS-DOS� Multiprocessing� Multiprogramming� Multiprogramming with fixed tasks (MFT)� Multiprogramming with variable tasks (MVT)� Multitasking� Multithreading� Operating system� Process� Process Control Block (PCB) � Process management� Random access files� Response time� Security

Keywords/PhrasesKeywords/Phrases

(Continued on next slide…)

Computer Fundamentals : Pradeep K. Sinha & Priti SinhaComputer Fundamentals : Pradeep K. Sinha & Priti Sinha

Slide 74/74Chapter 14: Operating Systems

� Sequential access files� Swapping� Throughput� Tightly coupled system� Time-sharing � Time slice� Time slot� Translating programs� Turnaround time� Uniprogramming system� Unix� User authentication� Utility programs� Virtual machine� Virtual memory

Keywords/PhrasesKeywords/Phrases