78
Presented by Wahab khan 1 My name is Wahab khan. I am the student of Class MCS 2 nd At Sarhad university Peshawar pakistan. Fist of All I thanks to My Dear teacher Mr khalid haseeb who give me the opportunity to Present over here. today my topic for presentation is “An Overview of Operating system Course”.

Operating System Presentation

Embed Size (px)

DESCRIPTION

Remember Me in your prayers...

Citation preview

Page 1: Operating System Presentation

Presented by Wahab khan 1

My name is Wahab khan. I am the student of Class MCS 2nd At Sarhad university Peshawar pakistan.

Fist of All I thanks to My Dear teacher Mr khalid haseeb who give me the opportunity to Present over here.

today my topic for presentation is “An Overview of Operating system Course”.

Page 2: Operating System Presentation

What is Operating system ?

A program that manage computer hardware. OR we can say that Operating system is an intermediary between the user and computer hardware.

Page 3: Operating System Presentation

Presented by Wahab khan 3

Computer-System Architecture

Operating systems have been evolving through the years. since operating systems historically have been closely tied to the architecture of the computers on which they run.

Page 4: Operating System Presentation

Presented by Wahab khan 4

Computer-System Architecture Continue…

Simple batch systems Deck of cards.

Spooling Batch Systems OR Multiprogramming batch systems. Magnetic tap instead of deck of cards.

Single processor systemsMultiprocessor SystemsCluster Systems Group of linked computer connected to each other.

GPU(Graphical process unit).Disk-controller microprocessorKeyboard microprocessor

Page 5: Operating System Presentation

Presented by Wahab khan 5

Components of the operating system

kernel management of memory, processes, files, main inputs/outputs and

communication functionalities.

ShellA peace of software provide interface for user.

file systemallowing files to be recorded in a tree structure.

Page 6: Operating System Presentation

Presented by Wahab khan 6

Page 7: Operating System Presentation

Presented by Wahab khan 7

OS operations…

Process management

• A process is a program in execution. give a work to computer to process it) It is a unit of work within the system.

• Process needs resources to accomplish” Done” its task for task it need) CPU, Memory, files, I/O devices

• Process termination requires reclaim of any reusable resources now you can use this memory cause it’s free)

Page 8: Operating System Presentation

Presented by Wahab khan 8

OS operations continue…

Memory Management(OS)

• All data in memory before and after processing

• All instructions in memory in order to execute

• Memory management determines what is in memory when optimizing CPU utilization and computer response to users

Page 9: Operating System Presentation

Presented by Wahab khan 9

OS operations continue…

Storage Management

• OS provides uniform, logical view of information storage

• Each medium is controlled by device (i.e., disk drive, tape drive)

Page 10: Operating System Presentation

Presented by Wahab khan 10

OS operations continue…

File-System management

• Files usually organized into directories

• Access control on most systems to determine who can access what(secutiry in operating system)

• Creating and deleting files and directories

• Mapping files onto secondary storage

• Backup files onto stable (non-volatile) storage media

Page 11: Operating System Presentation

Presented by Wahab khan 11

What is OS process?

A process is just an executing “In running condition”. Program, including the

current values of the program counter, registers, and variables. In other word giving a task to the CPU is called processing..

Q:then we can say that material on the hard disk is being process?

Ans:: the material in hard disk is not a process...

Page 12: Operating System Presentation

Presented by Wahab khan 12

An operating system executes a

variety of programs:

Batch systemGiven All jobs together to CPU for processing.

Time-shared systemsIt will share the job in period of time.

Page 13: Operating System Presentation

Presented by Wahab khan 13

A process includes:

Program counterAre the CPU free or not...

Stackhow many processes the CPU have now

Data sectionWhat type information the CPU has...

Page 14: Operating System Presentation

Presented by Wahab khan 14

As a process executes, it changes state

New: The process is being created.

Running: Instructions are being executed.

Waiting: The process is waiting for some event to occur.

Ready: The process is waiting to be assigned to a process.

Terminated: The process has finished execution.

Page 15: Operating System Presentation

Presented by Wahab khan 15

Process Control Block (PCB )

It contains information about the process

Tell us about the status of the process

Every process have their own PCB.

Process state

Program counter

CPU registers

Input output status

CPU scheduling information

Memory-management information

Accounting information

Page 16: Operating System Presentation

Presented by Wahab khan 16

Types of Process Scheduling

• Job queue – set of all processes in the system. When process” job” not load in memory...

• 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.

Page 17: Operating System Presentation

Presented by Wahab khan 17

Schedulers

Long-term scheduler (or job scheduler) – selects which processes should be brought into the ready queue. Long-term scheduler is invoked very infrequently (seconds, minutes) (may be slow).

Short-term scheduler (or CPU scheduler) – selects which process should be executed next and allocates CPU.

Short-term scheduler is invoked very frequently (milliseconds) (must be fast).

medium term scheduling:- The key idea behind a medium term scheduler is that Sometimes it can be advantageous to remove processes from memory to reduce the degree of multiprogramming. After some time the process can be introduced into memory and its execution can be continued where it left off. This scheme is called swapping...

Page 18: Operating System Presentation

Presented by Wahab khan 18

Process operations

the processes in the system can execute concurrently and must be created and deleted dynamically. Thus, the operating system must provide a mechanism for process creation and termination.

Page 19: Operating System Presentation

Presented by Wahab khan 19

Process operations continue…

1. Process Creation:

2. Process termination

3. Cooperating processes

Page 20: Operating System Presentation

Presented by Wahab khan 20

CPU SCEDULING

THE QUESTION DOES ARRIES???????

We have a single physical CPU and a lot of processes/jobs to run Which process do we run next? For how long do we run it?

Page 21: Operating System Presentation

Presented by Wahab khan 21

Basic Concepts

• Maximum CPU utilization obtained with multiprogramming

• CPU–I/O Burst Cycle – Process execution consists of a cycle of CPU execution and I/O wait.

• CPU burst – distribution Burst time is an assumption of how long a process requires the cpu between I/O waits. It can not be predicted exactly, before a process starts.

Page 22: Operating System Presentation

Presented by Wahab khan 22

CPU Scheduler

When ever the cpu become idle, the operating system must select one of the processes in the ready queue not the FIFO) to be executed. the selection process is carried out by the Short-term scheduler .the scheduler selects from among the processes in memory that are ready to execute, and allocated the cpu to one of them.

Page 23: Operating System Presentation

Presented by Wahab khan 23

Preemptive & non-preemptive scheduling

• Non preemptive – once CPU given to the process it cannot be preempted until completes its CPU burst.

• Terminates.• Switches from running to waiting state.

• Preemptive – if a new process arrives with CPU burst length less than remaining time of current executing process, preempt. This scheme is know as the Shortest-Remaining-Time-First (SRTF).

• Switches from running to ready state.

• Switches from waiting to ready.

Page 24: Operating System Presentation

Presented by Wahab khan 24

Dispatcher

Another component involved in the CPU scheduling function is the dispatcher is the module that gives control of the CPU to the process selected by the short-term scheduler; this involves:

1. switching context

2. switching to user mode

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

Dispatch latency – time it takes for the dispatcher to stop one process and start another running.

Page 25: Operating System Presentation

Presented by Wahab khan 25

Scheduling Criteria

CPU utilizationkeep the CPU as busy as possible

Throughputprocesses that complete their execution per time unit

Turnaround time the interval from the time of submission of a process to the time of completion is the turnaround time. Turnaround time is the sum of the periods spent waiting to get into memory, waiting in the ready queue, executing on the CPU,and doing i/o.

Waiting timeamount of time a process has been waiting in the ready queue

Response time amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)

Page 26: Operating System Presentation

Presented by Wahab khan 26

Scheduling Algorithms

CPU scheduling deals with the problems of deciding which of the processes in the ready queue is to be allocated the CPU. There are many different CPU scheduling algorithms. Here we will describe it one by one

Page 27: Operating System Presentation

Presented by Wahab khan 27

First-Come, First-Served (FCFS) Scheduling

Process Burst Time

P1 24

P2 3

P3 3

Suppose that the processes arrive in the order: P1 , P2 , P3

Waiting time for P1 = 0; P2 = 24; P3 = 27

Advantage Its is fair scheduling

Disadvantage short jobs have to wait for longer jobs

Page 28: Operating System Presentation

Presented by Wahab khan 28

Shortest-Job-First (SJR)

Process Burst Time

P1 24

P2 3

P3 7

the processes will be arrive in the order: P2 , P3 , P1

Waiting time for P2 = 0; P3 = 3; P3 = 10

If two process have the same length next CPU burst,FCFS scheduling is used to break the tie.

Page 29: Operating System Presentation

Presented by Wahab khan 29

Round Robin (RR) Scheduling

Each process gets a small unit of CPU time (time quantum or time

slice), is defined first. usually 10-100 milliseconds. After this time has elapsed, the process is preempted and added to the end of the ready queue.

Example of RR with Time Quantum = 8

Process Burst Time

P1 8

P2 16

P3 23

P4 7

Disadvantage: The most time will be spend in context switching.

Page 30: Operating System Presentation

Presented by Wahab khan 30

Multilevel queue algorithms Multilevel queue algorithms allow different algorithms to be used for various classes of processes.

The most common is a foreground interactive queue, which uses RR scheduling and a background batch queue, which uses FCFS scheduling. Multilevel feedback queues allow processes to move from one queue to another.

Page 31: Operating System Presentation

Presented by Wahab khan 31

Memory management

• One of the most important tasks that an operating system does is manage the memory requirements of your computer.

Page 32: Operating System Presentation

Presented by Wahab khan 32

Why need memory management?

Imagine if you had ten people sitting and working around your desk, and each of those people put their paperwork all over the desk. The desk would soon become unmanageable, with the paperwork hard to find or even lost. Eventually all ten people would probably not be able to complete their tasks. Somebody needs to take control and organize the chaos – so on a computer this management (memory management) one of the jobs of the operating system.

Concept:Main memory is usually too small to accommodate all the data and programs permanently, the computer system must provide

secondary storage to back up main memory.

Page 33: Operating System Presentation

Presented by Wahab khan 33

What is swapping?

• Swapping is just another word for trading (barter) or switching.

• Replacing one segment of a program in memory with another and restoring it back to the original when required.

• A process can be swapped temporarily out of memory to a backing store, and then brought back into memory for continued execution.

Page 34: Operating System Presentation

Presented by Wahab khan 34

Memory Allocation

• Multiple-partition allocationHole – block of available memory

OS

process 5

process 8

process 2

OS

process 5

process 2

OS

process 5

process 2

OS

process 5

process 9

process 2

process 9

process 10

Page 35: Operating System Presentation

Presented by Wahab khan 35

Dynamic Storage-Allocation Problem

• First-fit: Allocate the first hole that is big enough

• Next-fit: look for first-fit from last allocation

• Best-fit: Allocate the smallest hole that is big enough; must search entire list, unless ordered by size. Produces the smallest leftover hole.

• Worst-fit: Allocate the largest hole; must also search entire list. Produces the largest leftover hole.

Page 36: Operating System Presentation

Presented by Wahab khan 36

Dynamic Storage-Allocation Problem

Page 37: Operating System Presentation

Presented by Wahab khan 37

Fragmentation

• Refers to the condition of a disk in which files are divided into pieces scattered around the disk.

Fragmentation occurs naturally when you use a disk frequently, creating, deleting, and modifying files. At some point, the operating system needs to store parts of a file in noncontiguous clusters. This is entirely invisible to users, but it can slow down the speed at which data is accessed because the disk drive must search through different parts of the disk to

put together a single file

Page 38: Operating System Presentation

Presented by Wahab khan 38

Fragmentation

• External Fragmentationfree memory space is broken non-contiguous pieces, none big enough to satisfy a request

• Internal Fragmentation allocated memory may be slightly larger than requested memory; this

size difference is memory internal to a partition, but not being used.

• Reduce external fragmentation by compaction– Shuffle memory contents to place all free memory together in one

large block., this can be expensive – Compaction is possible only if relocation is dynamic, and is done at

execution time.– Or, use Paging

Page 39: Operating System Presentation

Presented by Wahab khan 39

PagingDivide logical memory into blocks of same size called pages.

Page 40: Operating System Presentation

Presented by Wahab khan 40

Paging example

• Page size = 4 bytes• Physical memory = 32 bytes (8 pages)

Page 41: Operating System Presentation

Presented by Wahab khan 41

THE QUESTION DOES ARRIES???????Purpose of File system?

ONE OF SEVERAL REASONZ.

it must be possible to store a very large amount of information.

The information must survive the termination of the process using it (database).

Multiple processes must be able to access the information concurrently.

The usual solution to all these problems is to store information on disks and other external media in units called files.

Page 42: Operating System Presentation

Presented by Wahab khan 42

File System

Commonly, files represent programs (both source and object form)

OR

files are an abstraction mechanism. they provide a way to store information on the disk and read it back later. File mapped on physical device by the operating system, these storage devices are usually nonvolatile, so the contents are persistent through power failures and system reboots. Almost all information stored in a computer must be in a file.

Page 43: Operating System Presentation

Presented by Wahab khan 43

File Structures

files can be structured in any of several ways.

1. Byte sequence.

2. Record sequence.

3. Tree.

Page 44: Operating System Presentation

Presented by Wahab khan 44

File structure continue…

• Byte Sequence: is an unstructured sequence of bytes. In effect, the operating system does not know or care what is in the file. All it sees are bytes, any meaning must be imposed by user-level programs. Both UNIX and MS-DOS use this approach.

• Record Sequence: in this sequence a file is a fixed-length record, each with some internal structure. Central to the idea of a file being a sequence of records is the idea that the read operation returns one record and the write operations overwrites or appends one record.

• Tree: in this organization, a file consists of a tree of records, not necessarily all the same length, each containing a key filed in a fixed position in the record. The tree is sorted on the key field, to allow rapid searching for a particular key...

Page 45: Operating System Presentation

Presented by Wahab khan 45

Files Access Methods

• Sequential Access: In these systems a process could read all the bytes or records in a file in order

• Random Access: Files whose bytes or records can be read in any order are called random access file.

Page 46: Operating System Presentation

Presented by Wahab khan 46

File Types

• Regular filesare the once that contain user information.

• Character special filesare related to input/output and used to model serial i/o devices such as terminals printers and networks.

• Block special filesare used to model disks

Page 47: Operating System Presentation

Presented by Wahab khan 47

File Attributes

• Every file has a name and its data. For example, the date and time the file was created or the file’s size. We will call these extra items the file’s attributes.

Page 48: Operating System Presentation

Presented by Wahab khan 48

File Attributes Continue…

• Name: only information kept in human-readable form.

• Type: needed for systems that support different types

• Location: pointer to file location on device

• Size: current file size

• Protection: controls who can do reading, writing, executing

• Time, Date, And User Identification: data for protection, security, and usage monitoring

• Information About Files Are Kept in the directory structure, which is maintained on the disk

Page 49: Operating System Presentation

Presented by Wahab khan 49

File Operations

Files exist to store information and allow it to be retrieved later.

Different systems provide different operations to allow storage and retrieval. Here is some common system operations relating to files these are...

Page 50: Operating System Presentation

Presented by Wahab khan 50

File operations continue….

• Create: the file is created with no data. The purpose of the call is to announce that the file is coming and to set some of the attributes...

• Delete: when the file is no longer needed, it has to be deleted to free up disk space. Three is always a system cal for this purpose.

• Open: before using a file, a process must open it. The purpose of the OPEN call is to allow the system to fetch the attributes and list of disk address into main memory for rapid access on later calls.

• Close: the file closing mean to free up internal table space.

• Read: data are from file. Usually the bytes come form the current position. The caller must specify how much data are needed and must also provide a buffer to put them in.

Page 51: Operating System Presentation

Presented by Wahab khan 51

File operations continue…

• Write: data are written to the file, again, usually at the current position. If the current position is the end of the file, the fill’s size increases. If the current position is in the middle of the file. Existing data are overwritten and lost forever.

• Append: Mixing and merging the data of two or multi files and add them at the end of the file.

• Seek: for random access files. Method is needed to specify from where to take the data. Also mean searching and finding of data.

• Get Attributes: it’s about the honor and modification times. Cause professes often need to read file attributes to do their work.

• Set Attributes: Some of the attributes are user settable and can be changed after the file has been created.

• Rename: if frequently happens that a user need to change the name of an existing file.

Page 52: Operating System Presentation

Presented by Wahab khan 52

File Sharing

• Sharing of files on multi-user systems is desirable• Sharing may be done through a protection scheme• On distributed systems, files may be shared across a network• Network File System (NFS) is a common distributed file-sharing

method

• User IDs identify users, allowing permissions and protections to be per-user

• Group IDs allow users to be in groups, permitting group access rights

Page 53: Operating System Presentation

Presented by Wahab khan 53

File Sharing – Remote File Systems

• Uses networking to allow file system access between systems

– Manually via programs like FTP

– Automatically, seamlessly using distributed file systems

– Semi automatically via the world wide web

Page 54: Operating System Presentation

Presented by Wahab khan 54

File Sharing – Failure Modes

• Remote file systems add new failure modes, due to network failure, server failure

• Recovery from failure can involve state information about status of each remote request

• Stateless protocols such as NFS include all information in each request, allowing easy recovery but less security

Page 55: Operating System Presentation

Presented by Wahab khan 55

Protection

File owner/creator should be able to controlwhat can be done by whom ?

– Types of access1. Read

2. Write

3. Execute

4. Append

5. Delete

6. List

Page 56: Operating System Presentation

Presented by Wahab khan 56

Directories

To keep track of files, file system normally have directories, which , in many systems, are themselves files.

Page 57: Operating System Presentation

Presented by Wahab khan 57

Information in a Device Directory

• Name • Type• Address • Current length• Maximum length• Date last accessed (for archival)• Date last updated (for dump)• Owner ID• Protection information (discuss later)

Page 58: Operating System Presentation

Presented by Wahab khan 58

Operations Performed on Directory

• Search for a file• Create a file• Delete a file• List a directory• Rename a file• Traverse the file system

Page 59: Operating System Presentation

Presented by Wahab khan 59

Organize the Directory (Logically) to Obtain

• Efficiency

locating a file quickly

• Namingconvenient to users

– Two users can have same name for different files– The same file can have several different names

• Groupinglogical grouping of files by properties, (e.g., all Java programs, all games, …)

Page 60: Operating System Presentation

Presented by Wahab khan 60

Types of directories

1. Single level directory.1. All files in the same directory.

2. Unique name.

2. Two level directory.1. Separate Directory for each user.

3. Three structure directories.1. Here user can create their own directories and to organize

their files accordingly.

4. Acyclic-Graph Directories1. Shared directory (Two programmers)

Page 61: Operating System Presentation

Presented by Wahab khan 61

What is Linux? Linux is a true 32-bit operating system that runs on a variety of different platforms, including Intel, Spark, Alpha, and Power-PC (on

some of these platforms, such as Alpha, Linux is actually 64-bit).

Page 62: Operating System Presentation

Presented by Wahab khan 62

Linux introduction• Multi-user and multitasking operating system.( seven user can work

at the same time)

• Command line/Gui

• Open Office (By default office)

• My Sql

• Open Source (code freely available, either from internet)

• Administrator (root)

Page 63: Operating System Presentation

Presented by Wahab khan 63

Linux user accounts

How Linux user accounts work

Where Linux user accounts are stored

Creating and managing user accounts from the command line

Page 64: Operating System Presentation

Presented by Wahab khan 64

How Linux User Accounts Work

By default, all user home directories are created and maintained in the /home directory.

However, the root user’s home directory is /root

Page 65: Operating System Presentation

Presented by Wahab khan 65

• Information about user.finger user_name

the following information about the user will be displayed.

Login This is the username that is used to authenticate to the system. Name This is the user’s full name. Directory This is the user’s home directory. Last Login This displays the last time the user logged in and where from.

Page 66: Operating System Presentation

Presented by Wahab khan 66

LINUX

• the first regular user account created on the system is always assigned a UID of 1000. The next user account will be assigned a UID of 1001...

• The root user account is always assigned a UID of 0 on most Linux distributions.

Page 67: Operating System Presentation

Presented by Wahab khan 67

Where Linux User Accounts Are Stored

• Linux is a very flexible operating system. One of its flexible features is the location of user accounts on the system. When you originally installed the system, your distribution may have given you several options for where you wanted to store your user accounts.

• /etc/passwd file. This has been the default configuration used by Linux systems for many years.

• NIS This option stands for Network Information Service or user network management.this option will also show that how many user I have in a network.

• Windows domin: used for share purposes.

Page 68: Operating System Presentation

Presented by Wahab khan 68

Local option

• /etc/passwd This file contains the user account information for your system.

• /etc/shadow This file contains passwords for your user accounts.

• /etc/group This file contains your system’s groups.

Page 69: Operating System Presentation

Presented by Wahab khan 69

The /etc/passwd File

Username:Password:UID:GID:Full_Name:Home_Directory:Default_Shel

• Username: The Username field simply identifies the username the user will supply when logging in to the system

• Password: This is a legacy field. At one time, the user’s password was stored in encrypted form in this field in the passwd file. However, for security reasons, the password has been moved from /etc/passwd to /etc/shadow.

• UID This is the user ID for the user account

• GID This field references the group ID number of the user’s default group

• Full_Name This field contains the user’s full name

• Home_Directory This field contains the path to the user’s home directory.

• Default_Shell This field specifies the shell that will be used by default

Page 70: Operating System Presentation

Presented by Wahab khan 70

The /etc/shadow File• Username:Password:Last_Modified:Min_Days:Max_Days:Days_Warn:D

isabled_Days:Expire

• Username This is the user’s login name from /etc/passwd.

• Password This is the user’s password in encrypted format

• Last_Modified This field displays the number of days since January 1, 1970 that the password was last changed

• Min_Days This field displays the minimum number of days required before a password can be changed. In this example, it is set to 0 days.

• Max_Days This field displays the maximum number of days before a password must be changed. In this example, it is set to 99999 days. Effectively, this means a password isn’t required.

• Days_Warn This field displays the number of days prior to password expiration that the user will be warned of the pending expiration. In this case, it’s set to 7 days.

Page 71: Operating System Presentation

Presented by Wahab khan 71

Commands.

• Disabled_Days This field displays the number of days to wait after a password has expired to disable the account.

• Expire This field displays the number of days since January 1, 1970 after which the account will be disabled. In this example, it is set to a null value, indicating the account never expires.

• To verify your /etc/passwd and /etc/shadow files, you can use the pwck command at the shell prompt. This utility will verify each line in the two files and make sure they are valid. Any errors are reported on the screen.

Page 72: Operating System Presentation

Presented by Wahab khan 72

Creating and Managing User Accounts from the Command Line

• Using useradd Useradd Ahmed password ABC.• Using passwd• Using usermod• Using userdel

Page 73: Operating System Presentation

Presented by Wahab khan 73

Using usermod

• From time to time, you will need to modify an existing user account. The syntax for usermod is very similar to that used by useradd.

Syntax:

usermod options username

Using userdelSyntax:

userdel username

Page 74: Operating System Presentation

Presented by Wahab khan 74

Managing groups from the command line

• Using groupadd

Syntax:

groupadd options groupname

• Using groupmod• Syntax:

groupmod options group

• Using groupdelSyntax:

groupdel group_name

Page 75: Operating System Presentation

Presented by Wahab khan 75

Manage ownership, permissions, and quotas

• Managing ownership

• Managing permissions

• Implementing disk quotas

Page 76: Operating System Presentation

Presented by Wahab khan 76

FAQ’S

• Why to share memory between processes ?

• How do processes behave ?

• What is a Real-Time Operating System?

• How does system perform translation ?

• What are the two main function of OS?

• What advantage is there in having different time-quantum sizes on different levels of a multilevel queuing system?

• Why paging is used?

Page 77: Operating System Presentation

Presented by Wahab khan 77

MESSAGE FOR YOU SIR????

Page 78: Operating System Presentation

Presented by Wahab khan 78

Your Sincere Wahab khan