100% found this document useful (3 votes)
9K views

Operating System Presentation

The document discusses an overview of operating system course presented by Wahab Khan, including definitions of an operating system as a program that manages computer hardware and intermediary between user and computer. It also covers operating system components like the kernel and shell, as well as functions including process management, memory management, storage management, and file system management.

Uploaded by

Wahab khan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
9K views

Operating System Presentation

The document discusses an overview of operating system course presented by Wahab Khan, including definitions of an operating system as a program that manages computer hardware and intermediary between user and computer. It also covers operating system components like the kernel and shell, as well as functions including process management, memory management, storage management, and file system management.

Uploaded by

Wahab khan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 78

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

Presented by Wahab khan 1


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

Presented by Wahab khan 3


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 systems


Multiprocessor Systems
Cluster Systems
 Group of linked computer connected to each other.

GPU(Graphical process unit).


Disk-controller microprocessor
Keyboard microprocessor

Presented by Wahab khan 4


Components of the operating system

kernel
management of memory, processes, files, main inputs/outputs and
communication functionalities.

Shell
A peace of software provide interface for user.

file system
allowing files to be recorded in a tree structure.

Presented by Wahab khan 5


Presented by Wahab khan 6
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)

Presented by Wahab khan 7


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

Presented by Wahab khan 8


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)

Presented by Wahab khan 9


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

Presented by Wahab khan 10


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

Presented by Wahab khan 11


An operating system executes a
variety of programs:

Batch system
Given All jobs together to CPU for processing.

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

Presented by Wahab khan 12


A process includes:

Program counter
Are the CPU free or not...

Stack
how many processes the CPU have now

Data section
What type information the CPU has...

Presented by Wahab khan 13


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.

Presented by Wahab khan 14


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

Presented by Wahab khan 15


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.

Presented by Wahab khan 16


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

Presented by Wahab khan 17


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.

Presented by Wahab khan 18


Process operations continue…

• Process Creation:

• Process termination

• Cooperating processes

Presented by Wahab khan 19


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?

Presented by Wahab khan 20


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.

Presented by Wahab khan 21


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.

Presented by Wahab khan 22


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.

Presented by Wahab khan 23


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:

– switching context
– switching to user mode
– 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.

Presented by Wahab khan 24


Scheduling Criteria

CPU utilization
keep the CPU as busy as possible

Throughput
processes 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 time
amount 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)

Presented by Wahab khan 25


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

Presented by Wahab khan 26


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

Presented by Wahab khan 27


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.

Presented by Wahab khan 28


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.

Presented by Wahab khan 29


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.

Presented by Wahab khan 30


Memory management

• One of the most important tasks that an operating


system does is manage the memory requirements
of your computer.

Presented by Wahab khan 31


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.

Presented by Wahab khan 32


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.

Presented by Wahab khan 33


Memory Allocation

• Multiple-partition allocation
Hole – block of available memory
OS OS OS OS

process 5 process 5 process 5 process 5

process 9 process 9

process 8 process 10

process 2 process 2 process 2 process 2

Presented by Wahab khan 34


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.

Presented by Wahab khan 35


Dynamic Storage-Allocation Problem

Presented by Wahab khan 36


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

Presented by Wahab khan 37


Fragmentation

• External Fragmentation
free 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

Presented by Wahab khan 38


Paging
Divide logical memory into blocks of same size called pages.

Presented by Wahab khan 39


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

Presented by Wahab khan 40


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.

Presented by Wahab khan 41


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.

Presented by Wahab khan 42


File Structures

files can be structured in any of several ways.

3. Byte sequence.
4. Record sequence.
5. Tree.

Presented by Wahab khan 43


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

Presented by Wahab khan 44


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.

Presented by Wahab khan 45


File Types

• Regular files
are the once that contain user information.

• Character special files


are related to input/output and used to model serial i/o devices such
as terminals printers and networks.

• Block special files


are used to model disks

Presented by Wahab khan 46


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.

Presented by Wahab khan 47


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

Presented by Wahab khan 48


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

Presented by Wahab khan 49


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.

Presented by Wahab khan 50


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.

Presented by Wahab khan 51


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

Presented by Wahab khan 52


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

Presented by Wahab khan 53


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

Presented by Wahab khan 54


Protection

File owner/creator should be able to control


what can be done by whom ?

– Types of access
1. Read
2. Write
3. Execute
4. Append
5. Delete
6. List

Presented by Wahab khan 55


Directories

To keep track of files, file system normally have


directories, which , in many systems, are
themselves files.

Presented by Wahab khan 56


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)

Presented by Wahab khan 57


Operations Performed on Directory

• Search for a file


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

Presented by Wahab khan 58


Organize the Directory (Logically) to Obtain

• Efficiency
locating a file quickly

• Naming
convenient to users
– Two users can have same name for different files
– The same file can have several different names

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

Presented by Wahab khan 59


Types of directories

1. Single level directory.


• All files in the same directory.
• Unique name.

2. Two level directory.


• Separate Directory for each user.

4. Three structure directories.


• Here user can create their own directories and to organize
their files accordingly.

5. Acyclic-Graph Directories
1. Shared directory (Two programmers)

Presented by Wahab khan 60


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

Presented by Wahab khan 61


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)

Presented by Wahab khan 62


Linux user accounts


How Linux user accounts work


Where Linux user accounts are stored


Creating and managing user accounts from the
command line

Presented by Wahab khan 63


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

Presented by Wahab khan 64


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

Presented by Wahab khan 65


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.

Presented by Wahab khan 66


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.

Presented by Wahab khan 67


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.

Presented by Wahab khan 68


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

Presented by Wahab khan 69


The /etc/shadow File

Username:Password:Last_Modified:Min_Days:Max_Days:Days_War
n:Disabled_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.

Presented by Wahab khan 70


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.

Presented by Wahab khan 71


Creating and Managing User Accounts from the
Command Line

• Using useradd Useradd Ahmed password ABC.


• Using passwd
• Using usermod
• Using userdel

Presented by Wahab khan 72


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 userdel
Syntax:
userdel username

Presented by Wahab khan 73


Managing groups from the command line

• Using groupadd
Syntax:
groupadd options groupname

• Using groupmod
• Syntax:
groupmod options group

• Using groupdel
Syntax:
groupdel group_name

Presented by Wahab khan 74


Manage ownership, permissions, and quotas

• Managing ownership
• Managing permissions
• Implementing disk quotas

Presented by Wahab khan 75


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?

Presented by Wahab khan 76


MESSAGE FOR YOU SIR????

Presented by Wahab khan 77


Your Sincere Wahab khan

Presented by Wahab khan 78

You might also like